I am preparing to use gurobi callbacks for the first time. (I have used cplex callbacks.)
I was hoping someone could answer the question below before I start.
I see the gurobi 9.0 python callback documentation says:
"When solving a model using multiple threads, the user callback is only ever called from a single thread, so you don't need to worry about the thread-safety of your callback"
With the following situation:
Solving a MIP model w/ multiple cores (say 24 cores), where model.optimize() was given my custom callback function which examines a new incumbent for feasibility ( given where = MIPSOL , 4, Found new MIP incumbent), and the callback adds a cut to eliminate the new candidate solution when not feasible.
Given that the process reaches the point of solving using all 24 cores (not in the root node, but deep in the branch and cut tree) will the other 23 cores continue to be used by gurobi to explore the branch and cut tree while my custom callback is executing on one core? Or will all gurobi threads stop while my callback is running?
Also, if multiple threads continue to explore the tree while one thread runs my callback, assuming any other candidate solutions that are found while my callback is running are queued by gurobi, when my callback completes, how is the next MIPSOL selected from the queue to be given to the callback? That is, are solutions to be given the callback selected from a FIFO queue? Or is it something like a priority queue (best objective value having the highest priority in the queue of candidate solutions to next be given to the callback) ?
Thank you, Lee
Please sign in to leave a comment.