Query the optimizer from within the user callback.
what: Integer code that indicates what type of information is being requested by the callback. The set of valid codes depends on the where value that is passed into the user callback function. Please refer to the Callback Codes section for a list of possible where and what values.
def mycallback(model, where): if where == GRB.Callback.SIMPLEX: print(model.cbGet(GRB.Callback.SPX_OBJVAL)) model.optimize(mycallback)