if (bm->UserFlags.stats_flag)
simp->printCacheStatus();
- const bool useAIGToCNF = (!arrayops || !bm->UserFlags.arrayread_refinement_flag || bm->UserFlags.solver_to_use
- == UserDefinedFlags::MINISAT_SOLVER) && !bm->UserFlags.isSet("traditional-cnf", "0");
-
const bool maybeRefinement = arrayops && bm->UserFlags.arrayread_refinement_flag;
simplifier::constantBitP::ConstantBitPropagation* cb = NULL;
}
ToSATAIG toSATAIG(bm, cb);
+ toSATAIG.setArrayTransformer(arrayTransformer);
- ToSATBase* satBase = useAIGToCNF ? ((ToSAT*) &toSATAIG) : tosat;
+ ToSATBase* satBase = bm->UserFlags.isSet("traditional-cnf", "0") ? tosat : ((ToSAT*) &toSATAIG) ;
// If it doesn't contain array operations, use ABC's CNF generation.
res = Ctr_Example->CallSAT_ResultCheck(NewSolver, simplified_solved_InputToSAT, orig_input, satBase,
assert(a.GetKind() == SYMBOL);
// It was ommitted from the initial problem, so assign it freshly.
for (int i = 0; i < a.GetValueWidth(); i++)
- v_a.push_back(SatSolver.newVar());
+ {
+ SATSolver::Var v = SatSolver.newVar();
+ // We probably don't want the variable eliminated.
+ SatSolver.setFrozen(v);
+ v_a.push_back(v);
+ }
satVar.insert(make_pair(a, v_a));
}
}
// I was going to make SimpSolver and Solver instances of this template.
// But I'm not so sure now because I don't understand what eliminate() does in the simp solver.
template class MinisatCore<Minisat::Solver>;
- template class MinisatCore<Minisat::SimpSolver>;
+ //template class MinisatCore<Minisat::SimpSolver>;
};
virtual lbool false_literal() =0;
virtual lbool undef_literal() =0;
+ // The simplifying solvers shouldn't eliminate index / value variables.
+ virtual void setFrozen(Var x)
+ {}
+
};
};
#endif
if (!s->simplify())
return false;
- // Without the eliminate(true) call. Calling solve() multiple times returns the wrong answer.
- s->eliminate(true);
return s->solve();
}
printf("CPU time : %g s\n", cpu_time);
}
+ void SimplifyingMinisat::setFrozen(Var x)
+ {
+ s->setFrozen(x,true);
+ }
};
virtual lbool false_literal() {return ((uint8_t)1);}
virtual lbool undef_literal() {return ((uint8_t)2);}
+ virtual void setFrozen(Var x);
};
}
;
Cnf_DataFree(cnfData);
cnfData = NULL;
+ // Minisat doesn't, but simplifying minisat and cryptominsat eliminate variables during their
+ // simplification phases. The problem is that we may later add clauses in that refer to those
+ // simplified-away variables. Here we mark them as frozen which prevents them from being removed.
+ for (ArrayTransformer::ArrType::iterator it = arrayTransformer->arrayToIndexToRead.begin(); it
+ != arrayTransformer->arrayToIndexToRead.end(); it++)
+ {
+ ArrayTransformer::arrTypeMap& atm = it->second;
+
+ for (ArrayTransformer::arrTypeMap::const_iterator it2 = atm.begin(); it2 != atm.end(); it2++)
+ {
+ const ArrayTransformer::ArrayRead& ar = it2->second;
+ ASTNodeToSATVar::iterator it = nodeToSATVar.find(ar.index_symbol);
+ if (it != nodeToSATVar.end())
+ {
+ vector<unsigned>& v = it->second;
+ for (int i=0; i < v.size(); i++)
+ satSolver.setFrozen(v[i]);
+ }
+
+ it = nodeToSATVar.find(ar.symbol);
+ if (it != nodeToSATVar.end())
+ {
+ vector<unsigned>& v = it->second;
+ for (int i=0; i < v.size(); i++)
+ satSolver.setFrozen(v[i]);
+ }
+ }
+ }
+
+
bm->GetRunTimes()->start(RunTimes::Solving);
satSolver.solve();
bm->GetRunTimes()->stop(RunTimes::Solving);
#include "../BitBlaster.h"
#include "BBNodeManagerAIG.h"
#include "ToCNFAIG.h"
+#include "../../AST/ArrayTransformer.h"
namespace BEEV
{
ASTNodeToSATVar nodeToSATVar;
simplifier::constantBitP::ConstantBitPropagation* cb;
+ ArrayTransformer *arrayTransformer;
+
// don't assign or copy construct.
ToSATAIG& operator = (const ToSATAIG& other);
ToSATAIG(const ToSATAIG& other);
count = 0;
first = true;
CNFFileNameCounter =0;
+ arrayTransformer = NULL;
}
public:
+ void setArrayTransformer(ArrayTransformer *at)
+ {
+ arrayTransformer = at;
+ }
+
bool cbIsDestructed()
{
return cb == NULL;