Output solutions during solve
AnsweredHi there.
When using a gurobi solver to solve an instance of an ILP, is it possible for it to output 'current' best possible solutions (in terms of variable assignment) during the solve? For instance, suppose that (during the solve) the current 'best' solution gives an objective value of 23. However, a new 'best' solution of 22 is found. While it continues to solve, it would be fantastic to have it also print out (in the log) the variable assignments for the current best. This would be particularly helpful for solves which require a long time.
Thanks!
0
-
Here are two ways to view new incumbent solutions as Gurobi finds them:
- Query the new incumbent solution in a MIPSOL callback. In Python, this can be done with Model.cbGetSolution(). You might find the callback examples (e.g., callback.py) helpful.
- Set the SolFiles parameter. This directs Gurobi to write each new incumbent solution to disk as a .sol solution file. This is a bit easier than the previous approach, as it only requires you to set a parameter.
0 -
Awesome. Thanks so much Eli. SolFile is perfect.
0
Please sign in to leave a comment.
Comments
2 comments