d_minisat->setFrozen(BVMinisat::var(toMinisatLit(lit)), true);
}
+void BVMinisatSatSolver::spendResource(){
+ // do nothing for the BV solver
+}
+
void BVMinisatSatSolver::interrupt(){
d_minisat->interrupt();
}
void markUnremovable(SatLiteral lit);
+ void spendResource();
+
void interrupt();
SatValue solve();
// Statistics: (formerly in 'SolverStats')
//
- , solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0)
+ , solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0), conflicts(0), resources_consumed(0)
, dec_vars(0), clauses_literals(0), learnts_literals(0), max_literals(0), tot_literals(0)
, ok (true)
Debug("minisat::lemmas") << "Solver::updateLemmas() begin" << std::endl;
+ // Avoid adding lemmas indefinitely without resource-out
+ spendResource();
+
CRef conflict = CRef_Undef;
// Decision level to backtrack to
void budgetOff();
void interrupt(); // Trigger a (potentially asynchronous) interruption of the solver.
void clearInterrupt(); // Clear interrupt indicator flag.
+ void spendResource();
// Memory managment:
//
// Statistics: (read-only member variable)
//
- uint64_t solves, starts, decisions, rnd_decisions, propagations, conflicts;
+ uint64_t solves, starts, decisions, rnd_decisions, propagations, conflicts, resources_consumed;
uint64_t dec_vars, clauses_literals, learnts_literals, max_literals, tot_literals;
protected:
inline void Solver::budgetOff(){ conflict_budget = propagation_budget = -1; }
inline bool Solver::withinBudget() const {
return !asynch_interrupt &&
- (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) &&
+ (conflict_budget < 0 || conflicts + resources_consumed < (uint64_t)conflict_budget) &&
(propagation_budget < 0 || propagations < (uint64_t)propagation_budget); }
+inline void Solver::spendResource() { ++resources_consumed; }
// FIXME: after the introduction of asynchronous interrruptions the solve-versions that return a
// pure bool do not give a safe interface. Either interrupts must be possible to turn off here, or
d_minisat->setConfBudget(resource);
}
Minisat::vec<Minisat::Lit> empty;
- unsigned long conflictsBefore = d_minisat->conflicts;
+ unsigned long conflictsBefore = d_minisat->conflicts + d_minisat->resources_consumed;
SatValue result = toSatLiteralValue(d_minisat->solveLimited(empty));
d_minisat->clearInterrupt();
- resource = d_minisat->conflicts - conflictsBefore;
+ resource = d_minisat->conflicts + d_minisat->resources_consumed - conflictsBefore;
Trace("limit") << "SatSolver::solve(): it took " << resource << " conflicts" << std::endl;
return result;
}
return toSatLiteralValue(d_minisat->solve());
}
+void MinisatSatSolver::spendResource() {
+ d_minisat->spendResource();
+}
void MinisatSatSolver::interrupt() {
d_minisat->interrupt();
SatValue solve();
SatValue solve(long unsigned int&);
+ void spendResource();
void interrupt();
SatValue value(SatLiteral l);
/** 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;
+
/** Interrupt the solver */
virtual void interrupt() = 0;
void renewVar(SatLiteral lit, int level = -1) {
}
+ void spendResource() {
+ }
+
void interrupt() {
}