Beispiel #1
0
 private static String prettyMethod(IntVar method) {
   if (method.isInstantiatedTo(0)) {
     return "migration";
   } else if (method.isInstantiatedTo(1)) {
     return "re-instantiation";
   }
   return "(migration || re-instantiation)";
 }
Beispiel #2
0
  @Test(groups = "1s", timeOut = 60000)
  public void test17() {
    Model model = new Model();
    IntVar a = model.intVar("a", -1, 1, false);
    BoolVar b1 = model.boolVar("b1");
    BoolVar b2 = model.boolVar("b2");
    model.arithm(a, "=", 0).reifyWith(b1);
    model.arithm(a, ">", 0).reifyWith(b2);

    model.addClauses(new BoolVar[0], new BoolVar[] {b1, b2});
    model.getMinisat().getPropSat().initialize();
    try {
      model.getSolver().propagate();
      b1.instantiateTo(1, Cause.Null);
      model.getSolver().propagate();
    } catch (ContradictionException ex) {
      Assert.fail();
    }
    Assert.assertTrue(b1.isInstantiatedTo(1));
    Assert.assertTrue(b2.isInstantiatedTo(0));
    Assert.assertTrue(a.isInstantiatedTo(0));
  }
Beispiel #3
0
 @Override
 public void propagate(int evtmask) throws ContradictionException {
   if (j.isInstantiatedTo(1)) {
     i.removeValue(1, this);
   }
 }