How to store multiple solutions with the same objVal in my SolPool?
AnsweredI have set the solution params according to online tutorial as follow.
model_handler.build_sp(data)
model_handler.SP.Params.PoolSolutions = 30
model_handler.SP.Params.PoolSearchMode = 2
model_handler.SP.optimize()
model_handler.SP.Params.PoolSolutions = 30
model_handler.SP.Params.PoolSearchMode = 2
model_handler.SP.optimize()
However, the SolPool is still 1, seen as follow:
model_handler.SP.SolCount
Python 3.9.6 (default, Dec 7 2023, 05:42:47)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.6.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 8.6.0
Out[1]: 1
Python 3.9.6 (default, Dec 7 2023, 05:42:47)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.6.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 8.6.0
Out[1]: 1
When I add a constraint to avoid the same solution to the model and solved it, another solution comes with the same objVal. This told the model has other good solution. I want k of them stored in the solution pool.
0
-
Do the solutions you found, only differ in the value of continuous variables or also in binary/integer variables? See this article for some limitations, e.g. how we consider whether two solutions are equal or not. Let me know if that helps!
1 -
THANKS. The variables are all continuous type, and comes out to be 0 or 1 in the solution. I can't find the article, is there any link?
0 -
Apologies, something went wrong there - I just added the link above.
1 -
MANY THANKS! Turning the type to binary works.
0
Please sign in to leave a comment.
Comments
4 comments