@Test(expected = IllegalArgumentException.class) public void testIllegalCC1() { final FormulaFactory f = new FormulaFactory(); final CCEncoder encoder = new CCEncoder(f); final int numLits = 100; final Variable[] problemLits = new Variable[numLits]; for (int i = 0; i < numLits; i++) problemLits[i] = f.variable("v" + i); encoder.encode(f.cc(CType.GE, -1, problemLits)); }
private void testCC(int numLits, int rhs, int expected, final FormulaFactory f) { final Variable[] problemLits = new Variable[numLits]; for (int i = 0; i < numLits; i++) problemLits[i] = f.variable("v" + i); final SATSolver solver = MiniSat.miniSat(f); solver.add(f.cc(CType.GE, rhs, problemLits)); if (expected != 0) Assert.assertEquals(Tristate.TRUE, solver.sat()); else Assert.assertEquals(Tristate.FALSE, solver.sat()); final List<Assignment> models = solver.enumerateAllModels(problemLits, new NumberOfModelsHandler(12000)); Assert.assertEquals(expected, models.size()); for (final Assignment model : models) Assert.assertTrue(model.positiveLiterals().size() >= rhs); }