chocoteam / choco-solver

An open-source Java library for Constraint Programming
http://choco-solver.org/
BSD 4-Clause "Original" or "Old" License
690 stars 140 forks source link

[BUG] Clause learning broken since Choco 4.10.14 #1118

Open Holt59 opened 4 days ago

Holt59 commented 4 days ago

Describe the bug

I am trying to upgrade a project from Choco 4.10.13 to 4.10.14, but every time I try to run with clause-learning enabled, I get the following exception:

java.lang.IllegalStateException: cannot find maximum of an empty set
        at org.chocosolver.util.objects.setDataStructures.iterable.IntIterableRangeSet.max(IntIterableRangeSet.java:221) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.learn.LazyImplications.createDomain(LazyImplications.java:316) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.learn.LazyImplications.addEntry(LazyImplications.java:353) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.learn.LazyImplications.pushEvent(LazyImplications.java:383) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.learn.EventRecorder.updateLowerBound(EventRecorder.java:75) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.variables.view.integer.IntAffineView.updateLowerBound(IntAffineView.java:133) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.variables.IntVar.updateBounds(IntVar.java:415) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.constraints.ternary.PropXplusYeqZ.filterPlus(PropXplusYeqZ.java:91) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.constraints.ternary.PropXplusYeqZ.propagate(PropXplusYeqZ.java:72) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.propagation.PropagationEngine.propagateEvents(PropagationEngine.java:215) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.propagation.PropagationEngine.propagate(PropagationEngine.java:199) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.Solver.doPropagate(Solver.java:481) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.Solver.initialize(Solver.java:417) ~[carioca-solver-compute-functional-tests.jar:?]
        at org.chocosolver.solver.Solver.solve(Solver.java:305) ~[carioca-solver-compute-functional-tests.jar:?]

I cannot share the actual code since it's from a huge internal project, but I am available to discuss this on Discord. This might be linked to PropLexInt since I seem to only get the error when activating it.

Environment (please complete the following information):

cprudhom commented 4 days ago

I'm annoyed for two reasons:

  1. firstly because there's a bug
  2. but more importantly because I'm working on a completely different version of the explanations framework (namely LCG), which will soon replace the current system (by the end of the year maybe).

So, I would encourage you to wait for the release which will support LCG. But it will force you to adapt your code (even more if you declare specific constraints).

NB: a public branch with this work in progress is available

Holt59 commented 4 days ago

I'm annoyed for two reasons:

1. firstly because there's a bug

2. but more importantly because I'm working on a completely different version of the explanations framework (namely LCG), which will soon replace the current system (by the end of the year maybe).

So, I would encourage you to wait for the release which will support LCG. But it will force you to adapt your code (even more if you declare specific constraints).

NB: a public branch with this work in progress is available

There is no urgency on my side, and the only thing I'm using regarding clause-learning is Model.setLearningSignedClauses so hopefully the impact will be minimal.