void Solver::uncheckedEnqueue(Lit p, Clause* from) { #ifdef __PRINT if (from) { printClause(*from); } printf("--> "); printLit(p); printf("\n"); if (decisionLevel() == 0) { printf("Zl: "); printLit(p); printf("\n"); } #endif assigns [var(p)] = toInt(lbool(!sign(p))); // <<== abstract but not uttermost effecient level [var(p)] = decisionLevel(); reason [var(p)] = from; trail.push(p); }
void SimpSolver::extendModel() { vec<Var> vs; // NOTE: elimtable.size() might be lower than nVars() at the moment for (int v = 0; v < elimtable.size(); v++) if (elimtable[v].order > 0) vs.push(v); sort(vs, ElimOrderLt(elimtable)); for (int i = 0; i < vs.size(); i++){ Var v = vs[i]; Lit l = lit_Undef; for (int j = 0; j < elimtable[v].eliminated.size(); j++){ Clause& c = *elimtable[v].eliminated[j]; for (int k = 0; k < c.size(); k++) if (var(c[k]) == v) l = c[k]; else if (modelValue(c[k]) != l_False) goto next; assert(l != lit_Undef); model[v] = lbool(!sign(l)); break; next:; } if (model[v] == l_Undef) model[v] = l_True; } }
void Solver::uncheckedEnqueue(Lit p, Clause* from) { assert(value(p) == l_Undef); assigns [var(p)] = toInt(lbool(!sign(p))); // <<== abstract but not uttermost effecient level [var(p)] = decisionLevel(); reason [var(p)] = from; trail.push(p); }
void SAT::aEnqueue(Lit p, Reason r, int l) { assert(value(p) == l_Undef); int v = var(p); assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trail_lim[l]-1; reason [v] = r; trail[l].push(p); }
void satcheck_minisat1_baset::set_assignment(literalt a, bool value) { unsigned v=a.var_no(); bool sign=a.sign(); solver->model.growTo(v+1); value^=sign; solver->model[v]=lbool(value); }
void SAT::enqueue(Lit p, Reason r) { assert(value(p) == l_Undef); int v = var(p); assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trailPos(); reason [v] = r; trail.last().push(p); ChannelInfo& ci = c_info[v]; if (ci.cons_type == 1) engine.vars[ci.cons_id]->channel(ci.val, ci.val_type, sign(p)); }
void SAT::aEnqueue(Lit p, Reason r, int l) { if (so.debug) { std::cerr << "a-enqueue literal " << getLitString(toInt(p)) << " because " << showReason(r) << " and l=" << l << "\n"; } assert(value(p) == l_Undef); int v = var(p); assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trail_lim[l]-1; reason [v] = r; trail[l].push(p); }
/*_________________________________________________________________________________________________ | | enqueue : (p : Lit) (from : Clause*) -> [bool] | | Description: | Puts a new fact on the propagation queue as well as immediately updating the variable's value. | Should a conflict arise, FALSE is returned. | | Input: | p - The fact to enqueue | from - [Optional] Fact propagated from this (currently) unit clause. Stored in 'reason[]'. | Default value is NULL (no reason). | | Output: | TRUE if fact was enqueued without conflict, FALSE otherwise. |________________________________________________________________________________________________@*/ bool Solver::enqueue(Lit p, GClause from) { if (value(p) != l_Undef) return value(p) != l_False; else{ assigns[var(p)] = toInt(lbool(!sign(p))); level [var(p)] = decisionLevel(); reason [var(p)] = from; trail.push(p); return true; } }
void SAT::enqueue(Lit p, Reason r) { /* if (so.debug) { */ /* std::cerr << "enqueue literal " << getLitString(toInt(p)) << " because " << showReason(r) << "\n"; */ /* } */ assert(value(p) == l_Undef); int v = var(p); assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trailPos(); reason [v] = r; trail.last().push(p); ChannelInfo& ci = c_info[v]; if (ci.cons_type == 1) engine.vars[ci.cons_id]->channel(ci.val, ci.val_type, sign(p)); }
void Solver::uncheckedEnqueue(Lit p, Clause* from) { #ifdef RESTORE if (backup.stage == 0) { printf("setting lit "); printLit(p); printf(" decLevel: %d flag: %d detachedClause: %p\n", decisionLevel(), backup.stage, backup.detachedClause); } #endif assert(value(p) == l_Undef); assigns [var(p)] = toInt(lbool(!sign(p))); // <<== abstract but not uttermost effecient level [var(p)] = decisionLevel(); reason [var(p)] = from; polarity[var(p)] = sign(p); trail.push(p); }
void SAT::cEnqueue(Lit p, Reason r) { assert(value(p) != l_True); int v = var(p); if (value(p) == l_False) { if (so.lazy) { if (r == NULL) { assert(decisionLevel() == 0); setConfl(); } else { confl = getConfl(r, p); (*confl)[0] = p; } } else setConfl(); return; } assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trailPos(); reason [v] = r; trail.last().push(p); }
void SAT::cEnqueue(Lit p, Reason r) { /* if (so.debug) { */ /* std::cerr << "c-enqueue literal " << getLitString(toInt(p)) << " because " << showReason(r) << "\n"; */ /* } */ assert(value(p) != l_True); int v = var(p); if (value(p) == l_False) { if (so.lazy) { if (r == NULL) { assert(decisionLevel() == 0); setConfl(); } else { confl = getConfl(r, p); (*confl)[0] = p; } } else setConfl(); return; } assigns [v] = toInt(lbool(!sign(p))); trailpos[v] = engine.trailPos(); reason [v] = r; trail.last().push(p); }
inline lbool toLbool(int v) { return lbool(v); }
lbool operator ~ (void) const { return lbool(-value); }