virtual bool addPost(Clasp::Solver& s) { if (conf_.dlprop==2) if (!addDLProp(s,n_.constraints())) return false; std::vector<order::ReifiedLinearConstraint> constraints; if (conf_.dlprop==1) { constraints = n_.constraints(); } ///solver takes ownership of propagator clingcon::ClingconOrderPropagator* cp = new clingcon::ClingconOrderPropagator(s, n_.getVariableCreator(), conf_, std::move(n_.constraints()),n_.getEqualities(), &(to_.names_)); to_.props_[s.id()]=cp; if (!s.addPost(cp)) return false; if (conf_.dlprop==1) if (!addDLProp(s, constraints)) return false; return true; }
bool addDLProp(Clasp::Solver& s, const std::vector<order::ReifiedLinearConstraint>& constraints) { clingcon::ClingconDLPropagator* dlp = new clingcon::ClingconDLPropagator(s, conf_); for (const auto&i : constraints) { if (dlp->isValidConstraint(i)) dlp->addValidConstraint(i); } if (!s.addPost(dlp)) return false; return true; }
void ExternalKnowledge::addPostPropagator(Clasp::Solver& solver) { my_post_ = false; solver.addPost(post_); }
bool TheoryPropagator::attach(Clasp::Solver& s) { return s.addPost(new PP(*this)); }