The OPTMODEL Procedure

Dual Values

A dual value is associated with each constraint. To access the dual value of a constraint, use the constraint name followed by the suffix .dual.

For linear programming problems, the dual value associated with a constraint is also known as the dual price (also called the shadow price). The shadow price is usually interpreted economically as the rate at which the optimal value changes with respect to a change in some right-hand side that represents a resource supply or demand requirement.

For nonlinear programming problems, the dual values correspond to the values of the optimal Lagrange multipliers. For more details about duality in nonlinear programming, see Bazaraa, Sherali, and Shetty (1993).

From the dual value associated with the constraint, you can also tell whether the constraint is active or not. A constraint is said to be active (tight at a point) if it holds with equality at that point. It can be informative to identify active constraints at the optimal point and check their corresponding dual values. Relaxing the active constraints might improve the objective value.

Background on Duality in Mathematical Programming

For a minimization problem, there exists an associated problem with the following property: any feasible solution to the associated problem provides a lower bound for the original problem, and conversely any feasible solution to the original problem provides an upper bound for the associated problem. The original and the associated problems are referred to as the primal and the dual problem, respectively. More specifically, consider the primal problem,

StartLayout 1st Row 1st Column minimize Underscript x Endscripts 2nd Column f left-parenthesis x right-parenthesis 2nd Row 1st Column subject to 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis equals 0 comma i element-of script upper E 3rd Row 1st Column Blank 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis less-than-or-equal-to 0 comma i element-of script upper L 4th Row 1st Column Blank 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis greater-than-or-equal-to 0 comma i element-of script upper G EndLayout

where script upper E, script upper L, and script upper G denote the sets of equality, less-than-or-equal-to inequality, and greater-than-or-equal-to inequality constraints, respectively. Variables x element-of double-struck upper R Superscript n are called the primal variables. The Lagrangian function of the primal problem is defined as

upper L left-parenthesis x comma lamda comma mu comma nu right-parenthesis equals f left-parenthesis x right-parenthesis minus sigma-summation Underscript i element-of script upper E Endscripts lamda Subscript i Baseline c Subscript i Baseline left-parenthesis x right-parenthesis minus sigma-summation Underscript i element-of script upper L Endscripts mu Subscript i Baseline c Subscript i Baseline left-parenthesis x right-parenthesis minus sigma-summation Underscript i element-of script upper G Endscripts nu Subscript i Baseline c Subscript i Baseline left-parenthesis x right-parenthesis

where lamda Subscript i Baseline element-of double-struck upper R, mu Subscript i Baseline less-than-or-equal-to 0, and nu Subscript i Baseline greater-than-or-equal-to 0. By convention, the Lagrange multipliers for inequality constraints have to be nonnegative. Hence lamda, negative mu, and nu correspond to the Lagrange multipliers in the preceding Lagrangian function. It can be seen that the Lagrangian function is a linear combination of the objective function and constraints of the primal problem.

The Lagrangian function plays a fundamental role in nonlinear programming. It is used to define the optimality conditions that characterize a local minimum of the primal problem. It is also used to formulate the dual problem of the preceding primal problem. To this end, consider the following dual function:

d left-parenthesis lamda comma mu comma nu right-parenthesis equals inf Underscript x Endscripts upper L left-parenthesis x comma lamda comma mu comma nu right-parenthesis

The dual problem is defined as

StartLayout 1st Row 1st Column maximize Underscript lamda comma mu comma nu Endscripts 2nd Column d left-parenthesis lamda comma mu comma nu right-parenthesis 2nd Row 1st Column subject to 2nd Column mu less-than-or-equal-to 0 3rd Row 1st Column Blank 2nd Column nu greater-than-or-equal-to 0 period EndLayout

The variables lamda, mu, and nu are called the dual variables. Note that the dual variables associated with the equality constraints (lamda) are free, whereas those associated with less-than-or-equal-to inequality constraints (mu) have to be nonpositive and those associated with greater-than-or-equal-to inequality constraints (nu) have to be nonnegative.

The relation between the primal and the dual problems provides a nice connection between the optimal solutions of the problems. Suppose x Superscript asterisk is an optimal solution of the primal problem and left-parenthesis lamda Superscript asterisk Baseline comma mu Superscript asterisk Baseline comma nu Superscript asterisk Baseline right-parenthesis is an optimal solution of the dual problem. The difference between the objective values of the primal and dual problems, delta equals f left-parenthesis x Superscript asterisk Baseline right-parenthesis minus d left-parenthesis lamda Superscript asterisk Baseline comma mu Superscript asterisk Baseline comma nu Superscript asterisk Baseline right-parenthesis greater-than-or-equal-to 0, is called the duality gap. For some restricted class of convex nonlinear programming problems, both the primal and the dual problems have an optimal solution and the optimal objective values are equal—that is, the duality gap delta equals 0. In such cases, the optimal values of the dual variables correspond to the optimal Lagrange multipliers of the primal problem with the correct signs.

A maximization problem is treated analogously to a minimization problem. For the maximization problem

StartLayout 1st Row 1st Column maximize Underscript x Endscripts 2nd Column f left-parenthesis x right-parenthesis 2nd Row 1st Column subject to 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis equals 0 comma i element-of script upper E 3rd Row 1st Column Blank 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis less-than-or-equal-to 0 comma i element-of script upper L 4th Row 1st Column Blank 2nd Column c Subscript i Baseline left-parenthesis x right-parenthesis greater-than-or-equal-to 0 comma i element-of script upper G comma EndLayout

the dual problem is

StartLayout 1st Row 1st Column minimize Underscript lamda comma mu comma nu Endscripts 2nd Column d left-parenthesis lamda comma mu comma nu right-parenthesis 2nd Row 1st Column subject to 2nd Column mu greater-than-or-equal-to 0 3rd Row 1st Column Blank 2nd Column nu less-than-or-equal-to 0 period EndLayout

where the dual function is defined as d left-parenthesis lamda comma mu comma nu right-parenthesis equals sup Underscript x Endscripts upper L left-parenthesis x comma lamda comma mu comma nu right-parenthesis and the Lagrangian function upper L left-parenthesis x comma lamda comma mu comma nu right-parenthesis is defined the same as earlier. In this case, lamda, mu, and negative nu correspond to the Lagrange multipliers in upper L left-parenthesis x comma lamda comma mu comma nu right-parenthesis.

Minimization Problems

For inequality constraints in minimization problems, a positive optimal dual value indicates that the associated greater-than-or-equal-to inequality constraint is active at the solution, and a negative optimal dual value indicates that the associated less-than-or-equal-to inequality constraint is active at the solution. In PROC OPTMODEL, the optimal dual value for a range constraint (a constraint with both upper and lower bounds) is the sum of the dual values associated with the upper and lower inequalities. Since only one of the two inequalities can be active, the sign of the optimal dual value, if nonzero, identifies which one is active.

For equality constraints in minimization problems, the optimal dual values are unrestricted in sign. A positive optimal dual value for an equality constraint implies that, starting close enough to the primal solution, the same optimum could be found if the equality constraint were replaced with a greater-than-or-equal-to inequality constraint. A negative optimal dual value for an equality constraint implies that the same optimum could be found if the equality constraint were replaced with a less-than-or-equal-to inequality constraint.

The following is an example where simple linear programming is considered:

proc optmodel;
   var x, y;
   min z = 6*x + 7*y;
   con
      4*x +   y >=  5,
       -x - 3*y <= -4,
        x +   y <=  4;
   solve;
   print x y;
   expand _ACON_ ;
   print _ACON_.dual _ACON_.body;

The PRINT statements generate the output shown in Figure 63.

Figure 63: Dual Values in Minimization Problem: Display

Problem Summary
Objective SenseMinimization
Objective Functionz
Objective TypeLinear
  
Number of Variables2
Bounded Above0
Bounded Below0
Bounded Below and Above0
Free2
Fixed0
  
Number of Constraints3
Linear LE (<=)2
Linear EQ (=)0
Linear GE (>=)1
Linear Range0
  
Constraint Coefficients6

Solution Summary
SolverLP
AlgorithmDual Simplex
Objective Functionz
Solution StatusOptimal
Objective Value13
  
Primal Infeasibility0
Dual Infeasibility0
Bound Infeasibility0
  
Iterations4
Presolve Time0.00
Solution Time0.00

xy
11

Constraint _ACON_[1]: 4*x + y >= 5                                              
Constraint _ACON_[2]: - x - 3*y <= -4                                           
Constraint _ACON_[3]: x + y <= 4                                                

[1]_ACON_.DUAL_ACON_.BODY
115
2-2-4
302


It can be seen that the first and second constraints are active, with dual values 1 and –2. Continue to submit the following statements. Notice how the objective value is changed in Figure 64.

   _ACON_[1].lb = _ACON_[1].lb - 1;
   solve;
   _ACON_[2].ub = _ACON_[2].ub + 1;
   solve;

Figure 64: Dual Values in Minimization Problem: Interpretation

Problem Summary
Objective SenseMinimization
Objective Functionz
Objective TypeLinear
  
Number of Variables2
Bounded Above0
Bounded Below0
Bounded Below and Above0
Free2
Fixed0
  
Number of Constraints3
Linear LE (<=)2
Linear EQ (=)0
Linear GE (>=)1
Linear Range0
  
Constraint Coefficients6

Solution Summary
SolverLP
AlgorithmDual Simplex
Objective Functionz
Solution StatusOptimal
Objective Value12
  
Primal Infeasibility0
Dual Infeasibility0
Bound Infeasibility0
  
Iterations4
Presolve Time0.00
Solution Time0.00

Problem Summary
Objective SenseMinimization
Objective Functionz
Objective TypeLinear
  
Number of Variables2
Bounded Above0
Bounded Below0
Bounded Below and Above0
Free2
Fixed0
  
Number of Constraints3
Linear LE (<=)2
Linear EQ (=)0
Linear GE (>=)1
Linear Range0
  
Constraint Coefficients6

Solution Summary
SolverLP
AlgorithmDual Simplex
Objective Functionz
Solution StatusOptimal
Objective Value10
  
Primal Infeasibility0
Dual Infeasibility0
Bound Infeasibility0
  
Iterations4
Presolve Time0.00
Solution Time0.00


The change is just as the dual values imply. After the first constraint is relaxed by one unit, the objective value is improved by one unit. For the second constraint, the relaxation and improvement are one unit and two units, respectively.

Note: The signs of dual values produced by PROC OPTMODEL depend, in some instances, on the way in which the corresponding constraints are entered. See the section Constraints for details.

Maximization Problems

For inequality constraints in maximization problems, a positive optimal dual value indicates that the associated less-than-or-equal-to inequality constraint is active at the solution, and a negative optimal dual value indicates that the associated greater-than-or-equal-to inequality constraint is active at the solution. The optimal dual value for a range constraint is the sum of the dual values associated with the upper and lower inequalities. The sign of the optimal dual value identifies which inequality is active.

For equality constraints in maximization problems, the optimal dual values are unrestricted in sign. A positive optimal dual value for an equality constraint implies that, starting close enough to the primal solution, the same optimum could be found if the equality constraint were replaced with a less-than-or-equal-to inequality constraint. A negative optimal dual value for an equality constraint implies that the same optimum could be found if the equality constraint were replaced with a greater-than-or-equal-to inequality constraint.

Caution: The signs of dual values produced by PROC OPTMODEL depend, in some instances, on the way in which the corresponding constraints are entered. See the section Constraints for details.

Last updated: June 22, 2026