DLVHEX_NAMESPACE_BEGIN #define DBGLOGD(X,Y) DBGLOG(X,Y) //#define DBGLOGD(X,Y) do{}while(false); // ---------- Class CDNLSolver ---------- bool CDNLSolver::unitPropagation(Nogood& violatedNogood) { DBGLOG(DBG, "Unit propagation starts"); int nogoodNr; while (unitNogoods.size() > 0) { nogoodNr = *(unitNogoods.begin()); const Nogood& nextUnitNogood = nogoodset.getNogood(nogoodNr); unitNogoods.erase(unitNogoods.begin()); // find propagation DL int propDL = 0; BOOST_FOREACH (ID lit, nextUnitNogood) { if (assigned(lit.address) && decisionlevel[lit.address] > propDL) { propDL = decisionlevel[lit.address]; } } // as the nogood is unit, it has a single watched literal // its negation is the propagated one ID propagatedLit = negation(*(watchedLiteralsOfNogood[nogoodNr].begin())); setFact(propagatedLit, propDL, nogoodNr); } if (contradictoryNogoods.size() > 0) { violatedNogood = nogoodset.getNogood(*(contradictoryNogoods.begin())); DBGLOG(DBG, "Unit propagation finished with detected contradiction " << violatedNogood); return false; } DBGLOG(DBG, "Unit propagation finished successfully"); return true; }
MC *new_negation(MC *var1) { MC *ans = negation(var1); return ans; }
pair<Point, Point> compute_intersections(const Point &p, const Point &q, const Point &s, const Point &t) { Point v1 = cross(p, q), v2 = cross(s, t), d = cross(v1, v2), first = normalize(d), second = negation(first); return make_pair(first, second); }