When are MIP callbacks executed ?
AnsweredThree questions regarding callbacks -
1. When do MIP callbacks with ``where = 3`` first executed ? The documentation says "in MIP" but what does that mean exactly, as there are different phases in a MIP solve (presolve, root node solve, B&B tree etc.).
2. How frequently are the MIP callbacks executed ? Like, MIPSOL and MIPNODE callbacks are executed whenever a new incumbent is found or a node is being explored respectively. Is there a set frequency for the MIP callbacks ?
3. Similar to the POLLING callbacks, is there a callback which will be executed periodically (say, every 10 seconds or so), the time_interval being a user input. Right now, we are maintaining an interval counter in the MIP callback to check if the time_interval has elapsed or not.
Some context - we are using MIP callbacks in our code to potentially terminate the solve if some criteria are met. These criteria are standard like "if the solve has been running for a minimum time, and a certain MIPGap has been achieved, then terminate". We get the runtime and MIPGap information using cget.RUNTIME etc.
We observed in some cases that this callback was being executed during presolve or during the rootnode solve and triggering a termination of the solve. This only happens sporadically and we are unable to reproduce this reliably. Wondering if this is a bug in our code or a bug in Gurobi (currently using 9.1 version).
Does the return value of cget.RUNTIME differ if we are using Gurobi Compute Server or not ? Meaning, does that function return the total time spent in GCS queue + actual solve time, or only the time since the solve actually started ?
-
This question is tagged as answered but I couldn't find the answer. Would you able to provide how you solved this issue?
0 -
Hi Erdem, this post was actually converted into an internal ticket and answered there, as the poster is a commercial customer. The responses were as follows:
-
When do MIP callbacks with
where = 3
first executed ? The documentation says "in MIP" but what does that mean exactly, as there are different phases in a MIP solve (presolve, root node solve, B&B tree etc.). - How frequently are the MIP callbacks executed ? Like, MIPSOL and MIPNODE callbacks are executed whenever a new incumbent is found or a node is being explored respectively. Is there a set frequency for the MIP callbacks ?
The MIP callback is called at the following places: inside the NoRel Heuristic, when solving the root node and inside every node. You can find out at which phase the MIP callback has been called via the MIP_PHASE value. So the first time that the callback is executed depends for example on whether you are using the NoRel heuristic or note. There is no specific frequency set for the MIP callbacks, they are called at the places mentioned above.
3. Similar to the POLLING callbacks, is there a callback which will be executed periodically (say, every 10 seconds or so), the time_interval being a user input. Right now, we are maintaining an interval counter in the MIP callback to check if the time_interval has elapsed or not.
There is no other callback that will be executed periodically besides the POLLING callback. Also, the time_interval of the POLLING callback cannot be set by the user. The way to achieve this is as you are doing now, by manually maintaining an interval counter. This is to avoid extensive callback usage and possible performance degradation, especially when using remote services. It is sometimes also possible that one thread is taking a bit longer because a node LP is harder to solve.
4. Does the return value of cget.RUNTIME differ if we are using Gurobi Compute Server or not ? Meaning, does that function return the total time spent in GCS queue + actual solve time, or only the time since the solve actually started ?
The RUNTIME "what" value always returns the elapsed solver runtime. That is, it does not account for the time spent in the Compute Server queue. However, this time might differ when using a Compute Server vs. when running the code locally, depending on the performance of the machine.- Riley
1 -
When do MIP callbacks with
Please sign in to leave a comment.
Comments
2 comments