Exemplo 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;
   }
 }
Exemplo 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;
   }
 }
Exemplo n.º 3
0
 /**
  * Build a boolean variable, ie domain is [0,1]
  *
  * @param name name of variable
  * @param solver solver involving the variable
  * @return a BoolVar
  */
 public static BoolVar bool(String name, Solver solver) {
   BooleanBoolVarImpl var = new BooleanBoolVarImpl(name, solver);
   var.setHeuristicVal(HeuristicValFactory.presetI(var));
   solver.associates(var);
   return var;
 }