Esempio n. 1
0
 public static IntVar bounded(String name, int min, int max, Solver solver) {
   checkIntVar(name, min, max);
   if (min == max) {
     return Views.fixed(name, min, solver);
   } else {
     IntVar var = new IntervalIntVarImpl(name, min, max, solver);
     var.setHeuristicVal(HeuristicValFactory.presetI(var));
     solver.associates(var);
     return var;
   }
 }
Esempio n. 2
0
 public static IntVar enumerated(String name, int[] values, Solver solver) {
   checkIntVar(name, values[0], values[values.length - 1]);
   if (values.length == 1) {
     return Views.fixed(name, values[0], solver);
   } else {
     BitsetIntVarImpl var = new BitsetIntVarImpl(name, values, solver);
     var.setHeuristicVal(HeuristicValFactory.presetI(var));
     solver.associates(var);
     return var;
   }
 }