Setting a time limit for cbUseSolution
AnsweredHi,
In the MIPNODE callback, I am calling cbSetSolution to fix part of the decision variables of my problem and then I am using cbUseSolution to get a solution out of it.
For my particular application, the variables that I set usually lead to a very quick response by cbUseSolution. However, some partial solutions are not as helpful and the code gets stuck waiting for cbUseSolution. Is it possible to set a time limit for this call?
Thanks,
Thiago
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Thiago,
It is not directly possible to set a time limit for the cbUseSolution function.
However, setting StartNodeLimit to a small value, e.g., 10 or 100, might help in this case.
Other than that, you could measure the time passed on a different thread and if some particular time is exceeded you could call the terminate() function. After the optimization has been terminated, you can then again call the optimize() function to proceed the optimization from the last point of termination. This is a rather tricky way and may take some time to make it work properly.
I hope the above helps.Best regards,
Jaromił0 -
It does help. Thank you very much!
0
Post is closed for comments.
Comments
3 comments