import choco.integer.IntDomainVar;
import choco.Problem;
public class LeximinExample {
public static void main (String[] args) {
Problem p = new Problem();
IntDomainVar[] u = p.makeEnumIntVarArray("u", 3, 2, 5);
IntDomainVar[] v = p.makeEnumIntVarArray("v", 3, 2, 4);
p.post(new LeximinConstraint(u, v));
p.post(p.allDifferent(v));
if(p.solve() == Boolean.TRUE) {
System.out.print("u = [ " + u[0].getVal() + " " + u[1].getVal() + " " + u[2].getVal() + " ] - ");
System.out.println("v = [ " + v[0].getVal() + " " + v[1].getVal() + " " + v[2].getVal() + " ]");
}
while(p.nextSolution() == Boolean.TRUE) {
System.out.print("u = [ " + u[0].getVal() + " " + u[1].getVal() + " " + u[2].getVal() + " ] - ");
System.out.println("v = [ " + v[0].getVal() + " " + v[1].getVal() + " " + v[2].getVal() + " ]");
}
}
}
|