Constraint::PropResult ModelEnumerator::BacktrackFinder::propagate(Solver& s, Literal, uint32& pos) { assert(pos < nogoods.size() && nogoods[pos] != 0); ClauseHead* c = static_cast<ClauseHead*>(nogoods[pos]); if (!c->locked(s)) { c->destroy(&s, true); nogoods[pos] = (c = 0); while (!nogoods.empty() && !nogoods.back()) { nogoods.pop_back(); } } return PropResult(true, c != 0); }
Clasp::Constraint::PropResult ClingconDLPropagator::propagate(Clasp::Solver& s, Clasp::Literal p, uint32& data) { /// only called if p is gets true (otherwise ~p gets true) assert(s_.isTrue(p)); Clasp::Literal l(Clasp::Literal::fromRep(data)); difflogic::DLPropagator::EdgeId id = l.var(); if (l.sign()) id *=-1; pending_.emplace_back(id); //std::cout << "add " << p.var() << "," << p.sign() << " to pending: " << id << " <- id on level " << s_.level(p.var()) << std::endl; return PropResult(true, true); }
///////////////////////////////////////////////////////////////////////////////////////// // DefaultUnfoundedCheck - Constraint interface ///////////////////////////////////////////////////////////////////////////////////////// // a (relevant) literal was assigned. Check which node is affected and update it accordingly Constraint::PropResult DefaultUnfoundedCheck::propagate(Solver& s, Literal, uint32& data) { assert(&s == solver_); (void)s; uint32 index = data >> 1; uint32 type = data & 1; if (type == 0) { // a body became false // update source if necessary if (bodies_[index].watches > 0) { invalid_.push_back(index); } } else if (watches_[index].bodyId == idMax) { // head of a choice rule became false // normally head false -> body false and hence the head has its source // autmatically removed when the invalid body is processed; // for choice rules we must force source removal explicity const ExtWatch w = watches_[index]; invalidExt_.push_back((w.data << 1) | ExtWatch::watch_choice_false); } else { // a literal relevant to a body became false invalidExt_.push_back((index << 1) | ExtWatch::watch_body_goal_false); } return PropResult(true, true); // always keep the watch }
Constraint::PropResult PostPropagator::propagate(Solver&, Literal, uint32&) { return PropResult(true, false); }
Constraint::PropResult Enumerator::propagate(const Literal&, uint32&, Solver&) { return PropResult(true, false); }
Constraint::PropResult TheoryPropagator::PP::propagate(Solver&, Literal p, uint32&) { pushTrail(p); return PropResult(true, true); }
Constraint::PropResult ClingoPropagator::propagate(Solver& s, Literal p, uint32&) { registerUndo(s); trail_.push_back(encodeLit(p)); return PropResult(true, true); }