Search code examples
pythonmathematical-optimizationgurobi

Python Gurobi : Iteration with a threshold on gap


I try to solve a MIP for planification over several periods by solving the same model over several ierations. How can i use 'callback' to go to next iteration when threshold of the gap is reached or the resolution takes some time without improvement ? Thanks for all.


Solution

  • In most cases, it's easier to use restarts with multiple termination criteria; for details, see Gurobi FAQ 13. If you must use a callback, look at the callback code in the examples subdirectory.