Exemplo n.º 1
0
 @Test(groups = "1s")
 public void testregExp8() {
   Solver solver = new Solver();
   IntVar[] CS = VF.enumeratedArray("CS", 3, new int[] {43, 59, 117}, solver);
   solver.post(ICF.regular(CS, new FiniteAutomaton("<43><59><117>")));
   solver.set(ISF.lexico_LB(CS));
   solver.findAllSolutions();
   Assert.assertEquals(solver.getMeasures().getSolutionCount(), 1);
 }
Exemplo 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();
  }
Exemplo n.º 3
0
 @Test(groups = "1s")
 public void testregExp7() {
   Solver solver = new Solver();
   IntVar[] CS = VF.enumeratedArray("CS", 10, 0, 2, solver);
   solver.post(ICF.regular(CS, new FiniteAutomaton("0*(1{2,4}0{0,2}0)*0*")));
   Chatterbox.showSolutions(
       solver,
       () -> {
         for (int i = 0; i < 10; i++) {
           System.out.printf("%d", CS[i].getValue());
         }
         //            System.out.printf("\n");
         return "";
       });
   solver.set(ISF.lexico_LB(CS));
   //        Chatterbox.showDecisions(solver);
   solver.findAllSolutions();
   Assert.assertEquals(solver.getMeasures().getSolutionCount(), 84);
 }