As mentioned in the documentation for Pi, this attribute is only available for continuous models. Shadow prices are not well-defined in mixed-integer problems, and this is why we don't provide dual values for an integer program.
Gurobi 9 introduces MIP scenario analysis (which can also help with sensitivity analysis).
Note that it is not uncommon (but dangerous) to get dual information from the fixed model by solving the MIP, creating the fixed LP model, solving that, and then getting the dual values for that model. This approach is, however, 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, however, you can't really talk about continuous rates of change because some variables move in discrete steps. Reduced costs on the fixed version of an integer model tell you very little (if anything) about what happens if you allow the integer variables to change value. In fact, the dual values are not even useful/meaningful for the continuous variables: There are examples where a variable has very large reduced costs in the fixed model while you can easily move that variable in the MIP without degrading the objective function value.
Keywords: shadow price, sensitivity