Example #1
0
 @Test(groups = "1s", timeOut = 60000)
 public void test14() {
   Model model = new Model();
   BoolVar a = model.boolVar("a");
   BoolVar b = model.boolVar("b");
   LogOp l = LogOp.or(a, b, a.not(), a.not());
   ILogical ll = LogicTreeToolBox.toCNF(l, model);
   Assert.assertEquals(ll.toString(), "cste -- 1 = 1");
 }
Example #2
0
 @Test(groups = "1s", timeOut = 60000)
 public void test11() {
   Model model = new Model();
   BoolVar a = model.boolVar("a");
   BoolVar b = model.boolVar("b");
   LogOp l = LogOp.or(LogOp.and(a, b.not()), LogOp.and(a.not(), b), LogOp.and(a.not(), b.not()));
   ILogical ll = LogicTreeToolBox.toCNF(l, model);
   Assert.assertEquals(ll.toString(), "(not(b) or not(a))");
 }
Example #3
0
  @Test(groups = "1s", timeOut = 60000)
  public void test6() {
    Model model = new Model();

    BoolVar a = model.boolVar("a");
    BoolVar b = model.boolVar("b");

    LogOp root = LogOp.implies(a, b);

    ILogical l = LogicTreeToolBox.toCNF(root, model);

    Assert.assertEquals(l.toString(), "(b or not(a))");
  }
Example #4
0
  @Test(groups = "1s", timeOut = 60000)
  public void test7() {
    Model model = new Model();

    BoolVar a = model.boolVar("a");
    BoolVar b = model.boolVar("b");
    BoolVar c = model.boolVar("c");

    LogOp root = LogOp.ifThenElse(a, b, c);

    ILogical l = LogicTreeToolBox.toCNF(root, model);

    Assert.assertEquals(l.toString(), "((a or c) and (b or c) and (b or not(a)))");
  }
Example #5
0
  @Test(groups = "1s", timeOut = 60000)
  public void test1() {
    Model model = new Model();

    BoolVar a = model.boolVar("a");
    BoolVar b = model.boolVar("b");
    BoolVar c = model.boolVar("c");
    BoolVar d = model.boolVar("d");

    LogOp root = LogOp.nand(LogOp.nor(a, b), LogOp.or(c, d));

    ILogical l = LogicTreeToolBox.toCNF(root, model);

    Assert.assertEquals(l.toString(), "((a or b or not(c)) and (a or b or not(d)))");
  }
Example #6
0
  @Test(groups = "1s", timeOut = 60000)
  public void test9() {
    Model model = new Model();

    BoolVar a = model.boolVar("a");
    BoolVar na = a.not();
    BoolVar b = model.boolVar("b");
    BoolVar c = model.boolVar("c");
    BoolVar d = model.boolVar("d");

    LogOp root = LogOp.and(a, b, na, c, d);

    ILogical l = LogicTreeToolBox.toCNF(root, model);

    Assert.assertEquals(l.toString(), "cste -- 0 = 0");
  }
Example #7
0
  @Test(groups = "1s", timeOut = 60000)
  public void test8() {
    Model model = new Model();

    BoolVar a = model.boolVar("a");
    BoolVar na = a.not();
    BoolVar b = model.boolVar("b");
    BoolVar nb = b.not();
    BoolVar c = model.boolVar("c");
    BoolVar d = model.boolVar("d");

    LogOp root = LogOp.and(LogOp.or(a, b, na), LogOp.or(c, d), LogOp.or(b, nb));

    ILogical l = LogicTreeToolBox.toCNF(root, model);

    Assert.assertEquals(l.toString(), "(c or d)");
  }