@Test(groups = "1s") public void testPropagate() throws Exception { sat.addBoolOrArrayEqualTrue(a, b, c, d); sat.addBoolOrArrayEqualTrue(b, c, d); sat.addBoolOrArrayEqualTrue(a, c, d); Assert.assertTrue(sat.propagate()); Assert.assertTrue(sat.propagateOneLiteral(SatSolver.makeLiteral(a, false))); Assert.assertTrue(sat.propagateOneLiteral(SatSolver.makeLiteral(b, false))); Assert.assertTrue(sat.propagateOneLiteral(SatSolver.makeLiteral(c, false))); Assert.assertFalse(sat.propagateOneLiteral(SatSolver.makeLiteral(d, false))); sat.cancelUntil(2); Assert.assertTrue(sat.propagateOneLiteral(SatSolver.makeLiteral(d, true))); }
boolean propagate() { boolean result = true; while (qhead_ < trail_.size()) { int p = trail_.get(qhead_++); if(!propagateImplies(p)){ return false; } result &= propagateClauses(p); } return result; }
SatSolver implements SatFactory { boolean propagate() { boolean result = true; while (qhead_ < trail_.size()) { int p = trail_.get(qhead_++); if(!propagateImplies(p)){ return false; } result &= propagateClauses(p); } return result; } }
SatSolver implements SatFactory { boolean propagate() { boolean result = true; while (qhead_ < trail_.size()) { int p = trail_.get(qhead_++); if(!propagateImplies(p)){ return false; } result &= propagateClauses(p); } return result; } SatSolver(); }
SatSolver implements SatFactory { boolean propagate() { boolean result = true; while (qhead_ < trail_.size()) { int p = trail_.get(qhead_++); if(!propagateImplies(p)){ return false; } result &= propagateClauses(p); } return result; } SatSolver(); @Override SatSolver _me(); int newVariable(); boolean addClause(TIntList ps); boolean learnClause(int... ps); boolean addClause(int l); void cancelUntil(int level); int trailMarker(); int nLearnt(); boolean propagateOneLiteral(int lit); void detachLearnt(int ci); static int makeLiteral(int var, boolean sign); static int negated(int l); static boolean sign(int l); static int var(int l); void copyFrom(SatSolver o); long nbclauses(); long numvars(); }
SatSolver implements SatFactory { boolean propagate() { boolean result = true; while (qhead_ < trail_.size()) { int p = trail_.get(qhead_++); if(!propagateImplies(p)){ return false; } result &= propagateClauses(p); } return result; } SatSolver(); @Override SatSolver _me(); int newVariable(); boolean addClause(TIntList ps); boolean learnClause(int... ps); boolean addClause(int l); void cancelUntil(int level); int trailMarker(); int nLearnt(); boolean propagateOneLiteral(int lit); void detachLearnt(int ci); static int makeLiteral(int var, boolean sign); static int negated(int l); static boolean sign(int l); static int var(int l); void copyFrom(SatSolver o); long nbclauses(); long numvars(); public boolean ok_; public ArrayList<Clause> clauses; public ArrayList<Clause> learnts; public TIntObjectHashMap<TIntArrayList> implies_; public TIntArrayList touched_variables_; }