chocoteam / chocoteam/choco-solver
Resetting solver to an intermediate state
- Dominant language
- Java
- Stars
- 779
- Forks
- 159
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
Assessment
This issue has not been assessed yet.