Potassco::Lit_t add(Literal lit) { uint32 word = lit.id() / 32; uint32 bit = lit.id() & 31; if (word >= map.size()) { map.resize(word + 1, 0); } if (!test_bit(map[word], bit)) { vec.push_back(lit); set_bit(map[word], bit); } return encodeLit(lit); }
void pushTrail(Literal p) { trail_.push_back(encodeLit(p)); }
ClingoAssignment::Lit_t ClingoAssignment::decision(uint32_t dl) const { POTASSCO_REQUIRE(dl <= solver_->decisionLevel(), "Invalid decision level"); return encodeLit(dl ? solver_->decision(dl) : lit_true()); }
void ClingoPropagatorInit::removeWatch(Literal lit) { changes_.push_back(Change(encodeLit(lit), RemoveWatch)); }
void ClingoPropagatorInit::removeWatch(uint32 sId, Literal lit) { POTASSCO_REQUIRE(sId < 64, "Invalid solver id"); changes_.push_back(Change(encodeLit(lit), RemoveWatch, sId)); }
Potassco::Lit_t ClingoPropagatorInit::addWatch(uint32 sId, Literal lit) { POTASSCO_REQUIRE(sId < 64, "Invalid solver id"); changes_.push_back(Change(encodeLit(lit), AddWatch, sId)); return changes_.back().lit; }
Potassco::Lit_t ClingoPropagatorInit::addWatch(Literal lit) { changes_.push_back(Change(encodeLit(lit), AddWatch)); return changes_.back().lit; }
Constraint::PropResult ClingoPropagator::propagate(Solver& s, Literal p, uint32&) { registerUndo(s); trail_.push_back(encodeLit(p)); return PropResult(true, true); }
bool ClingoPropagator::inTrail(Literal p) const { return std::find(trail_.begin(), trail_.end(), encodeLit(p)) != trail_.end(); }
Potassco::Lit_t ClingoPropagator::Control::addVariable() { POTASSCO_REQUIRE(!assignment_.hasConflict(), "Invalid addVariable() on conflicting assignment"); ScopedUnlock unlocked(lock(), ctx_); return encodeLit(posLit(solver().pushAuxVar())); }