Package solver

Examples of solver.Solver.propagate()


        IntVar var = VariableFactory.scale(VariableFactory.enumerated("b", new int[]{1, 2, 4}, solver), 2);
    if(!Configuration.ENABLE_VIEWS){
      try {
        // currently, the propagation is not sufficient (bound)
        // could be fixed with an extension filtering
        solver.propagate();
      }catch (Exception e){
        e.printStackTrace();
        throw new UnsupportedOperationException();
      }
    }
View Full Code Here


            int[][] domains = DomainBuilder.buildFullDomains(1, -5, 5, random, random.nextDouble(), random.nextBoolean());
            IntVar o = VariableFactory.enumerated("o", domains[0], solver);
            IntVar v = VariableFactory.offset(o, 2);
      if(!Configuration.ENABLE_VIEWS){
        try {
          solver.propagate();
        }catch (Exception e){
          e.printStackTrace();
          throw new UnsupportedOperationException();
        }
      }
View Full Code Here

            IntVar v = VariableFactory.scale(o, 2);
      if(!Configuration.ENABLE_VIEWS){
        try {
          // currently, the propagation is not sufficient (bound)
          // could be fixed with an extension filtering
          solver.propagate();
        }catch (Exception e){
          e.printStackTrace();
          throw new UnsupportedOperationException();
        }
      }
View Full Code Here

      IntVar z = VF.enumerated("z", 3, 4, s);
      s.post(ICF.arithm(z, "=", 3));
      Constraint c = ICF.times(a, b, z);
      s.post(c);
    try {
      s.propagate();
      Assert.assertFalse(a.contains(0));
      for (Propagator p : c.getPropagators()) {
        p.propagate(PropagatorEventType.FULL_PROPAGATION.getMask());
      }
      Assert.assertFalse(a.contains(0));
View Full Code Here

    public void test2() {
        Solver solver = new Solver();
        IntVar res = VariableFactory.bounded("r", 1, 2, solver);
        solver.post(IntConstraintFactory.mod(res, VariableFactory.fixed(2, solver), VariableFactory.fixed(1, solver)));
        try {
            solver.propagate();
            Assert.assertTrue(res.isInstantiatedTo(1));
        } catch (ContradictionException e) {
            Assert.fail();
        }
    }
View Full Code Here

        Y[1] = VF.bounded("Y2", 0, 0, solver);
        Y[2] = VF.bounded("Y3", 1, 1, solver);

        solver.post(ICF.sort(X, Y));
        try {
            solver.propagate();
            Assert.assertEquals(X[1].getValue(), 0);
        } catch (ContradictionException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        Y[1] = VF.bounded("Y2", 0, 0, solver);
        Y[2] = VF.bounded("Y3", 2, 2, solver);

        solver.post(ICF.sort(X, Y));
        try {
            solver.propagate();
            Assert.assertEquals(X[1].getValue(), 0);
        } catch (ContradictionException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        Y[1] = VF.bounded("Y2", 1, 9, solver);
        Y[2] = VF.bounded("Y3", 7, 9, solver);

        solver.post(ICF.sort(X, Y));
        try {
            solver.propagate();
            Assert.assertEquals(X[0].getValue(), 7);
        } catch (ContradictionException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

        IntVar X = VariableFactory.enumerated("X", 1, 10, solver);
        IntVar Y = VariableFactory.minus(X);

        try {
      if(!Configuration.ENABLE_VIEWS)
        solver.propagate();
            Assert.assertFalse(Y.isInstantiated());
            Assert.assertEquals(Y.getLB(), -10);
            Assert.assertEquals(Y.getUB(), -1);
            Assert.assertTrue(Y.contains(-5));
            Assert.assertEquals(Y.nextValue(-11), -10);
View Full Code Here

            Assert.assertEquals(Y.previousValue(-4), -5);
            Assert.assertEquals(Y.previousValue(-10), Integer.MIN_VALUE);

            Y.updateLowerBound(-9, Cause.Null);
      if(!Configuration.ENABLE_VIEWS)
        solver.propagate();
            Assert.assertEquals(Y.getLB(), -9);
            Assert.assertEquals(X.getUB(), 9);

            Y.updateUpperBound(-2, Cause.Null);
      if(!Configuration.ENABLE_VIEWS)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.