# OptShadow

## Contents

## OptShadow(opt)

Returns the shadow prices, or dual values, for the constraints at the optimal solution.

The shadow price is the amount by which the objective function changes when the constraint is altered by increasing its right-hand side coefficient, *b _{i}*, by one unit. It is valid only for small changes in

*b*, and mathematically is defined as:

_{i}This is the partial derivative of the objective function relative to the constraint RHS coefficient.

For a `'<='`

constraint and maximization problem, a shadow price indicates the amount the objective function improves when the constraint is relaxed. Shadow prices are usually meaningful when you are thinking of them in these terms. However, you should pay attention to the partial derivative definition to get the sign right.

The shadow can only be computed for continuous optimization problems. The shadow price does not exist for integer or mixed-integer optimizations, so can only be computed if every variable in the optimization problem is continuous.

For continuous problems, whether the shadow price can be computed depends upon the problem type and solver engine used. The following table summarizes the combinations for which shadow price can be computed (QP = quadratic objective + linear constraints, QCP = quadratically constrained):

"Problem Type" Engine LP QP QCP NLP LP/Quadratic Y - - - SOCP Barrier Y Y N - GRG Nonlinear Y Y Y Y Evolutionary N N N N LSLP Y - - - LSGRG Y Y Y Y LSSQP Y Y Y - OptQuest N N N N MOSEK Y Y N N Knitro Y Y Y Y XPress Y - - - Gurobi Y - - -

This table may not be 100% accurate. [To do: empirically validate these entries]

## Notes

When you relax a constraint, the objective will always either improve or stay the same. Thus, for a minimization problem, the shadow price of a `'<'`

constraint is always negative or zero, and for a maximization problem it is positive or zero. For a `'>'`

constraint the opposite holds.

Constraints with zero shadow prices have slack -- that is, they are not constraining the optimal solution.

Not all linear programming packages use the same convention for the sign of shadow prices. The LINDO package, for example, uses a different convention for the sign.

## History

This function was introduced in Analytica 4.3 and was formerly named LpShadow.

## See Also

- OptSlack
- OptScalarToConstraint
- OptScalarToDecision
- OptRhsSa
- OptReducedCost
- DefineOptimization (former to Analytica 4.3, see LpDefine)
- OptObjective
- OptSolution
- OptStatusText
- OptStatusNum

Enable comment auto-refresher