Skip to content

Commit

Permalink
reHC*, use 'real id's for user-specified assumptions/constraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
yp committed Jun 15, 2011
1 parent 67ce21e commit eb0ed49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion include/assumptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@


#include "pedcnf.hpp"
#include "pedigree.hpp"
#include "io-pedigree.hpp"

#include <istream>


void
add_assumptions(std::istream& is,
const plink_reader_t<>::multifamily_pedigree_t::pedigree_t& ped,
pedcnf_t& cnf);

#endif
2 changes: 1 addition & 1 deletion include/rehc_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class rehcstar_t:
if (has_assumptions) {
std::ifstream assumptions(assumption_file);
if (assumptions) {
add_assumptions(assumptions, cnf);
add_assumptions(assumptions, mped.families().front(), cnf);
assumptions.close();
} else {
L_FATAL("Impossible to open assumption file '" << assumption_file << "'. Aborting...");
Expand Down
16 changes: 13 additions & 3 deletions src/lib/assumptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ operator>>(std::istream& in, pedcnf_t::pedvar_t& var) {

class assumption_manager_t
:public log_able_t<assumption_manager_t> {
public:
typedef plink_reader_t<>::multifamily_pedigree_t::pedigree_t pedigree_t;

private:
std::istream& in;
const pedigree_t& ped;
pedcnf_t& cnf;

class invalid_line_t {
Expand All @@ -62,8 +66,11 @@ class assumption_manager_t
};

public:
assumption_manager_t(std::istream& _in, pedcnf_t& _cnf)
:in(_in), cnf(_cnf)

assumption_manager_t(std::istream& _in,
const pedigree_t& _ped,
pedcnf_t& _cnf)
:in(_in), ped(_ped), cnf(_cnf)
{
};

Expand All @@ -87,6 +94,8 @@ class assumption_manager_t
if (!(is >> value)) throw invalid_line_t("unrecognized boolean value");
L_DEBUG("Read assumption '" << buff << "' ==> ("
<< v << " == " << (value?"True":"False") << ").");
v.get<1>()= ped.get_by_id(v.get<1>()).progr_id();
L_DEBUG("...and transformed into " << v << " == " << (value?"True":"False") << ".");
if (v.get<0>() == ped_var_kind::SP) {
if (!cnf.has_sp(v.get<1>(), v.get<2>())) {
L_WARN("Variable '" << v << "' does not exist in the SAT instance."
Expand Down Expand Up @@ -163,7 +172,8 @@ class assumption_manager_t

void
add_assumptions(std::istream& is,
const plink_reader_t<>::multifamily_pedigree_t::pedigree_t& ped,
pedcnf_t& cnf) {
assumption_manager_t mgr(is, cnf);
assumption_manager_t mgr(is, ped, cnf);
mgr.add_assumptions();
};

0 comments on commit eb0ed49

Please sign in to comment.