As mentioned in the documentation for Pi, this attribute is only available for convex continuous models. Shadow prices are not well-defined in mixed-integer programs, so we do not provide dual values for a model with integer variables.
Note that Gurobi 9 introduced MIP scenario analysis, which can help with sensitivity analysis for MIP problems.
You can, however, obtain dual information from the so-called fixed model by solving the MIP, calling method fixed() that creates a continuous model by fixing all integer variables to the values of the best solution found, solving the fixed model, and then querying the dual values for that model. However, this approach is problematic:
- For continuous models, reduced costs are a lower bound on the rate of change in the objective relative to the change in the variable value.
- For integer models, continuous rates of change are not valid because some variables move in discrete steps. Reduced costs on the fixed version of an integer model reveal very little (if anything) about what happens if the integer variables change value. In fact, the dual values are not useful and meaningful for the continuous variables: There are examples where a variable has a very large reduced cost in the fixed model even though you can easily move that variable in the MIP without degrading the objective function value.
Please sign in to leave a comment.