35 template<
typename BaseModule>
42 isTheoryAbstraction([&baseModule](
Minisat::Var v){
return (baseModule.mBooleanConstraintMap.size() > v) && (baseModule.mBooleanConstraintMap[v].first !=
nullptr); }),
77 bool empty() {assert(
false);
return true; }
87 void print()
const { assert(
false); }
100 template<
typename Constra
ints>
140 template<
typename BaseModule>
146 template<
typename BaseModule>
154 if(order_heap.
inHeap(v) && valid(v))
156 order_heap.
build(vs);
167 return order_heap[0];
178 while(!order_heap.
empty() && !valid(order_heap[0]))
180 return order_heap.
empty();
216 auto iter =
std::find(ordering.begin(), ordering.end(),
var);
217 if (iter == ordering.end()) {
218 auto it = ordering.begin();
220 if (ordering.size() > 0) {
221 std::random_device rd;
222 std::mt19937 gen(rd());
223 std::uniform_int_distribution<std::size_t> dis(0, ordering.size()-1);
227 iter = ordering.insert(it,
var);
233 template<
typename BaseModule>
244 std::vector<Minisat::Var>
vars;
248 return isDecisionVar(
var) && isBoolValueUndef(
var);
252 template<
typename BaseModule>
261 auto it =
vars.begin();
262 std::random_device rd;
263 std::mt19937 gen(rd());
264 std::uniform_int_distribution<std::size_t> dis(0,
vars.size()-1);
281 auto res =
vars.back();
287 while(!
vars.empty() && !valid(
vars.back()))
299 std::cout <<
"Random scheduler contents: " <<
vars << std::endl;
307 template<TheoryGu
idedDecisionHeuristicLevel theory_conflict_gu
ided_decision_heuristic>
312 template<
typename BaseModule>
315 minisat( baseModule )
328 std::vector<Minisat::Var> varsToRestore;
331 if (minisat.
empty()) {
336 next =
var(minisat.
pop());
338 if (isTheoryAbstraction(next)) {
339 unsigned consistency = currentlySatisfiedByBackend(reabstractVariable(next));
340 bool skipVariable =
false;
341 switch (theory_conflict_guided_decision_heuristic) {
342 case TheoryGuidedDecisionHeuristicLevel::CONFLICT_FIRST: {
343 switch (consistency) {
345 setPolarity(next,
false);
348 setPolarity(next,
true);
356 case TheoryGuidedDecisionHeuristicLevel::SATISFIED_FIRST: {
357 switch (consistency) {
359 setPolarity(next,
true);
362 setPolarity(next,
false);
371 assert( theory_conflict_guided_decision_heuristic == TheoryGuidedDecisionHeuristicLevel::DISABLED );
375 varsToRestore.push_back(next);
381 for (
auto v : varsToRestore) {
385 return minisat.
pop();
392 return minisat.
empty();
void build(vec< int > &ns)
Base class for variable schedulers.
VarSchedulerBase(BaseModule &baseModule)
std::function< bool(Minisat::Var)> isTheoryAbstraction
std::function< bool(Minisat::Var)> isDecisionVar
std::function< const FormulaT &(Minisat::Var)> reabstractVariable
std::function< double(Minisat::Var)> getActivity
void rebuild()
Rebuild heap.
std::function< const Minisat::Clause &(Minisat::CRef)> getClause
std::function< Minisat::lbool(Minisat::Var)> getBoolVarValue
void increaseActivity(Minisat::Var)
std::function< Minisat::lbool(Minisat::Lit)> getBoolLitValue
void rebuildTheoryVars(const Constraints &)
bool empty()
Check if empty.
void insert(Minisat::Var)
Insert a variable.
void relocateClauses(std::function< void(Minisat::CRef &)>)
void attachClause(Minisat::CRef)
std::function< bool(Minisat::Var)> isBoolValueUndef
void detachClause(Minisat::CRef)
std::function< unsigned(const FormulaT &)> currentlySatisfiedByBackend
std::function< const Minisat::Lit(const FormulaT &)> abstractLiteral
std::function< char(Minisat::Var)> getPolarity
std::function< void(Minisat::Var, bool)> setPolarity
std::function< bool(const FormulaT &)> isAbstractedFormula
Minisat::Lit pop()
Returns the next variable to be decided.
std::function< const FormulaT &(Minisat::Lit)> reabstractLiteral
void decreaseActivity(Minisat::Var)
void print() const
Check if variable is contained.
std::function< Minisat::Var(const FormulaT &)> abstractVariable
std::vector< Minisat::Var > ordering
auto getIndex(Minisat::Var var)
VarSchedulerFixedRandom(BaseModule &baseModule)
Minisat's activity-based variable scheduling.
VarSchedulerMinisat(BaseModule &baseModule, std::function< bool(Minisat::Var, Minisat::Var)> cmp)
void increaseActivity(Minisat::Var var)
Minisat::Heap< VarOrderLt > order_heap
VarSchedulerMinisat(BaseModule &baseModule)
void insert(Minisat::Var var)
bool valid(Minisat::Var var)
void decreaseActivity(Minisat::Var var)
std::vector< Minisat::Var > vars
void insert(Minisat::Var var)
bool valid(Minisat::Var var)
VarSchedulerRandom(BaseModule &baseModule)
Scheduler for SMT, implementing theory guided heuristics.
void increaseActivity(Minisat::Var var)
void insert(Minisat::Var var)
VarSchedulerMinisat minisat
VarSchedulerSMTTheoryGuided(BaseModule &baseModule)
void decreaseActivity(Minisat::Var var)
static bool find(V &ts, const T &t)
RegionAllocator< uint32_t >::Ref CRef
Lit mkLit(Var var, bool sign=false)
std::vector< carl::Variable > vars(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
VarOrderLt(std::function< bool(Minisat::Var, Minisat::Var)> cmp)
bool operator()(Minisat::Var x, Minisat::Var y)
std::function< bool(Minisat::Var, Minisat::Var)> cmp