Constraint constraint(FloatVar v) {

    ArrayList<Constraint> list = new ArrayList<Constraint>();

    for (int i = 0; i < v.dom().modelConstraints.length; i++)
      if (v.dom().modelConstraints[i] != null)
        for (int j = 0; j < v.dom().modelConstraints[i].length; j++) {
          if (v.dom().modelConstraints[i][j] != null) {

            Constraint c = v.dom().modelConstraints[i][j];

            if (eval.search(c) == -1) {
              if (Derivative.derivateConstraints.contains(c)) continue;

              if (!list.contains(c)) list.add(c);
            }
          }
        }

    // if (debug)
    //     System.out.println ("Possible constraints for variable " + v + " are " + list);

    Constraint c;
    if (list.size() == 1) c = list.get(0);
    else c = Derivative.resolveConstraint(v, list);

    return c;
  }
Ejemplo n.º 2
0
 @Override
 public boolean notSatisfied() {
   FloatDomain pDom = p.dom(), rDom = r.dom();
   return (pDom.max() + c < rDom.min() || pDom.min() + c > rDom.max());
 }