You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the Python interface of Choco to do incremental solving.
My situation is the following.
I have a model with a given objective to solve. After getting the optimal solution, I want to add a constraint to the model and re-solve to optimality again.
However, because of the consrtraints added to the solver during optimization, the status seems to be invalid.
Is there a way around this? Below is a minimal working example.
BoolVar 'a' = [0, 1] 0
BoolVar 'b' = [0, 1] 0
BoolVar 'c' = [0, 1] 1
Solution: Choco Solution
Unhandled exception: org.chocosolver.solver.exception.SolverException: Cannot access value of a = [0,1]: No solution has been recorded yet (empty solution). Make sure this.record() has been called.
at org.chocosolver.solver.Solution.getIntVal(Solution.java:221)
at org.chocosolver.capi.SolutionApi.getIntVal(SolutionApi.java:28)
Kind regards,
Ignace
The text was updated successfully, but these errors were encountered:
I need to include reset()and hardReset() in the API. It should be quick to do, I'll do it ASAP. Meanwhile, you can also encapsulate the creation of your base model (with the constraints of the first solving) in a function (e.g. make_model()), or a small encapsulating class if you want facilitated access to variables. That way, after solving the first problem, you can call make_model() again, post additional constraints, and solve again.
I will close this issue and let you know as soon as reset()and hardReset() are added to the API.
Hi,
I am using the Python interface of Choco to do incremental solving.
My situation is the following.
I have a model with a given objective to solve. After getting the optimal solution, I want to add a constraint to the model and re-solve to optimality again.
However, because of the consrtraints added to the solver during optimization, the status seems to be invalid.
Is there a way around this? Below is a minimal working example.
Which produces the following output:
Kind regards,
Ignace
The text was updated successfully, but these errors were encountered: