Skip to main content

Help with python callback -- adding callback on different line than optimize()



1 comment

  • Eli Towle
    Gurobi Staff Gurobi Staff

    The only way to set a callback function in the Python API is by passing the function object as an argument to Model.optimize().

    The default argument of Model.optimize() is \( \texttt{None} \), which tells Gurobi there is no callback function. So you could do something like this:

    m._cb = subtourelim  # or None

Please sign in to leave a comment.