d_minisat->setFrozen(BVMinisat::var(toMinisatLit(lit)), true);
}
-void BVMinisatSatSolver::spendResource(){
- // do nothing for the BV solver
+bool BVMinisatSatSolver::spendResource(){
+ // Do nothing for the BV solver.
+ return false;
}
void BVMinisatSatSolver::interrupt(){
void markUnremovable(SatLiteral lit);
- void spendResource();
+ bool spendResource();
void interrupt();
if (type == CHECK_FINAL) {
// Do the theory check
theoryCheck(CVC4::theory::Theory::EFFORT_FULL);
- // Pick up the theory propagated literals (there could be some, if new lemmas are added)
+ // Pick up the theory propagated literals (there could be some,
+ // if new lemmas are added)
propagateTheory();
// If there are lemmas (or conflicts) update them
if (lemmas.size() > 0) {
int intro_level (Var x) const; // User level at which this variable was created
int trail_index (Var x) const; // Index in the trail
double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ...
+public:
bool withinBudget () const;
+protected:
// Static helpers:
//
return toSatLiteralValue(d_minisat->solve());
}
-void MinisatSatSolver::spendResource() {
+bool MinisatSatSolver::spendResource() {
d_minisat->spendResource();
+ return !d_minisat->withinBudget();
}
void MinisatSatSolver::interrupt() {
SatValue solve();
SatValue solve(long unsigned int&);
- void spendResource();
+ bool spendResource();
void interrupt();
SatValue value(SatLiteral l);
Debug("prop") << "Constructing the PropEngine" << endl;
- d_satSolver = SatSolverFactory::createDPLLMinisat();
+ d_satSolver = SatSolverFactory::createDPLLMinisat();
d_registrar = new theory::TheoryRegistrar(d_theoryEngine);
d_cnfStream = new CVC4::prop::TseitinCnfStream
(d_satSolver, d_registrar,
userContext,
- // fullLitToNode Map =
- options::threads() > 1 ||
+ // fullLitToNode Map =
+ options::threads() > 1 ||
options::decisionMode() == decision::DECISION_STRATEGY_RELEVANCY
);
d_decisionEngine->setSatSolver(d_satSolver);
d_decisionEngine->setCnfStream(d_cnfStream);
- PROOF (ProofManager::currentPM()->initCnfProof(d_cnfStream); );
+ PROOF (ProofManager::currentPM()->initCnfProof(d_cnfStream); );
}
PropEngine::~PropEngine() {
d_interrupted = true;
d_satSolver->interrupt();
- d_theoryEngine->interrupt();
+ d_theoryEngine->interrupt();
Debug("prop") << "interrupt()" << endl;
}
void PropEngine::spendResource() throw() {
- d_satSolver->spendResource();
+ if(d_satSolver->spendResource()) {
+ d_satSolver->interrupt();
+ d_theoryEngine->interrupt();
+ }
checkTime();
}
/** Check the satisfiability of the added clauses */
virtual SatValue solve(long unsigned int&) = 0;
- /** Instruct the solver that it should bump its consumed resource count. */
- virtual void spendResource() = 0;
+ /**
+ * Instruct the solver that it should bump its consumed resource count.
+ * Returns true if resources are exhausted.
+ */
+ virtual bool spendResource() = 0;
/** Interrupt the solver */
virtual void interrupt() = 0;
bool QuantifiersEngine::addInstantiation( Node f, InstMatch& m, bool mkRep, bool modEq, bool modInst ){
// For resource-limiting (also does a time check).
- getOutputChannel().spendResource();
+ getOutputChannel().safePoint();
std::vector< Node > terms;
//make sure there are values for each variable we are instantiating