Try our new documentation site (beta).


Type: double
Modifiable: No

The constraint dual value in the current solution (also known as the shadow price).

Given a linear programming problem

\mathrm{minimize} & c'x \
\mathrm{subject\ to} & Ax \ge b \
& x \ge 0

and a corresponding dual problem

\mathrm{maximize} & b'y \
\mathrm{subject\ to} & A'y \le c \
& y \ge 0

the Pi attribute returns <span>$</span>y<span>$</span>.

Of course, not all models fit this canonical form. In general, dual values have the following properties:

  • Dual values for <span>$</span>\ge<span>$</span> constraints are <span>$</span>\ge 0<span>$</span>.
  • Dual values for <span>$</span>\le<span>$</span> constraints are <span>$</span>\le 0<span>$</span>.
  • Dual values for <span>$</span>=<span>$</span> constraints are unconstrained.
For models with a maximization sense, the senses of the dual values are reversed: the dual is <span>$</span>\ge 0<span>$</span> for a <span>$</span>\le<span>$</span> constraint and <span>$</span>\le 0<span>$</span> for a <span>$</span>\ge<span>$</span> constraint.

Note that constraint dual values for linear constraints of QCP models are only available when the QCPDual parameter is set to 1. To query the duals of the quadratic constraints in a QCP model, see QCPi.

Only available for convex, continuous models.

For examples of how to query or modify attributes, refer to our Attribute Examples.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.