|
From: Joost G. <jpt...@gm...> - 2011-04-27 16:24:13
|
Hello,
I have the following CSP :
- three integer variables: v1, v2, v3 (all with a domain of 0..1000)
- one constraint: v1 = v2 * v3.
Solving this in Choco 2.1.1 takes about 30871ms on my (admittedly oldish) macbook. It is a lot longer than i expected. Any explanation for this? Find my code below.
many thanks!
Joost Geurts
public Test() {
System.out.println("start test");
CPModel model = new CPModel();
Solver solver = new CPSolver();
//int max = 100 // finds a solution in 37ms
int max = 1000; // 30871ms
IntegerVariable v1 = Choco.makeIntVar("v1", 0, max);
IntegerVariable v2 = Choco.makeIntVar("v2", 0, max);
IntegerVariable v3 = Choco.makeIntVar("v3", 0, max);
model.addVariable(v1);
model.addVariable(v2);
model.addVariable(v2);
//model.addConstraint(Choco.eq(v1, Choco.plus(v2,v3)));
model.addConstraint(Choco.eq(v1, Choco.mult(v2,v3)));
solver.read(model);
System.out.println("start solving");
solver.solve();
solver.checkSolution();
System.out.println(solver.pretty());
}
output:
Pb[3 vars, 0 tasks, 1 cons]
Limits Solutions: 1
Time (ms): 30871
Nodes: 4
Backtracks: 0
Restarts: 0
==== VARIABLES ====
v1:0[1]{0}
v2:0[1]{0}
v3:0[1]{0}
==== TASKS ====
==== CONSTRAINTS ====
GAC3rmValidLarge({v1:0[1]{0}, v2:0[1]{0}, v3:0[1]{0}}) relation:
|