Constraint Programming Solver JaCoP solution found but store inconsistent

419 Views Asked by At

I am using JaCoP - a constraint programming solver for Java - to calculate a solution to a complex scheduling problem. Now I am facing the problem that the found solution is not correct.

I am imposing the following constraint:

store.impose(new XplusYeqZ(start, duration, cipStart));

After finishing the search the solver found a solution, but unfortunately the solution is clearly wrong, violating the constraint above.

I am checking the consistency of the store with consistency() before I start the search and it returns true, but after the search it returns false.

I also iterated over all constraints of the store after the search and printed if satisfied using this code:

store.getConstraints().forEach(constraint -> {
            System.out.println(constraint.id() + "   " + constraint.satisfied());
});

The the method returned false on the constraint above.

My question is: Is there a logical explanation why not every constraint has to be satisfied for a correct solution? Am I overlooking something?

Addendum: I am using JaCoP 4.4.0

1

There are 1 best solutions below

1
On

First, when you do search you should check the result (true/false) of the search. If the result is false the model is inconsistent and the store is in a undefined state. It might be the case in your problem.