Esempio n. 1
0
 @Test(groups = "1s")
 public void test2() {
   Solver solver = new Solver();
   IntVar[] VARS = VF.enumeratedArray("X", 2, 0, 2, solver);
   Constraint CSTR = ICF.arithm(VARS[0], "+", VARS[1], "=", 2);
   solver.post(CSTR, CSTR);
   solver.findAllSolutions();
   Assert.assertEquals(solver.getMeasures().getSolutionCount(), 3);
   solver.getSearchLoop().reset();
   solver.unpost(CSTR);
   solver.findAllSolutions();
   Assert.assertEquals(solver.getMeasures().getSolutionCount(), 3);
 }
Esempio n. 2
0
  @Test(groups = "1s")
  public void testJL() {
    Solver solver = new Solver();
    final SetVar s0 = VF.set("s0", 0, 1, solver);
    final BoolVar b0 = VF.bool("b0", solver);
    final BoolVar b1 = VF.bool("b1", solver);
    final IntVar i0 = VF.bool("i0", solver);
    solver.set(ISF.lexico_LB(i0));
    solver.post(SCF.bool_channel(new BoolVar[] {b0, b1}, s0, 0));
    solver.post(SCF.cardinality(s0, VF.fixed(0, solver)));

    solver.findSolution();
    solver.getSearchLoop().reset();
    solver.findSolution();
  }