choco-solver icon indicating copy to clipboard operation
choco-solver copied to clipboard

Resetting solver to an intermediate state

Open miguelneto0 opened this issue 2 years ago • 0 comments

Hi, I have been trying to implement a validation of partial solutions in Choco. For that, I have been using the Solver.getEnvironment().worldPopUntil(0) and Solver.hardReset() methods to reset the solver at first and then look for complete solutions for partial validation.

More precisely, I stored in a collection the possible combinations of a subset of variables in my model (e.g. A={0..3} and B={0..3}). Then, for each partial solution {A, B}, which ones led to a complete solution (e.g. {A=0, B=1, C=2, D=2}) were identified and marked as valid. It works! However, the idea from now on is to validate partial solutions as soon as they are discovered (jointly), in the same solver instance, without having to hard reset, as we hope it will improve the performance.

Recently, I discovered that it is possible to perform a soft reset through the Solver.reset() method, which should allow returning to an intermediate state between 0 (rootWorldIndex) and the current one (getWorldIndex). However, whenever I use this method, it returns the worldIndex = 1. What I would expect to get would be: returning to a state with index w = 5 after performing a Solver.getEnvironment().worldPopUntil(w) and reset().

Any suggestions on how to resolve this?

I checked discussions #472, #490 and #491, but they don't express what exactly I'm looking for.

miguelneto0 avatar Apr 27 '23 01:04 miguelneto0