The OPTLP Procedure

Example 5.9 Sensitivity Analysis

In this example, consider again the diet problem from Example 5.3. Example 5.4 and Example 5.5 show how to reoptimize the optimization problem if the input data change. This is useful if you want to investigate other scenarios or see how the optimal solution changes as a function of the input data. Sensitivity analysis automates this process by providing stability intervals for the input data.

After solving the diet problem, you can ask how much the price of each food item can change without invalidating the optimal basis that is found. You can calculate this by using the following solver call:

proc optlp data=mylib.ex3
   presolver = none
   algorithm = ps
   primalout = mylib.ex3pout
   dualout   = mylib.ex3dout
   logfreq   = 1;
   sensitivity change=obj;
run;

The results are shown in Output 5.9.1.

Output 5.9.1: Optimal Solutions to the Original Diet Problem and Sensitivity Analysis for the Objective Coefficients

Primal Solution

ObsVariable
Name
Objective
Coefficient
Lower BoundUpper BoundVariable ValueVariable
Status
Reduced CostObjective Coefficient
Minimum
Objective Coefficient
Maximum
1br2.00.01.7977E3080.00000L1.190660.809341.7977E308
2mi3.50.010.05360B0.00000-1.7977E3084.0884
3ch8.00.01.7977E3080.44950B0.000006.8228419.4228
4po1.50.01.7977E3081.86517B-0.00000-0.191893.5006
5fi11.00.51.7977E3080.50000L5.156415.843591.7977E308
6yo1.00.01.7977E3080.00000L1.10849-0.108491.7977E308


Note that you can combine the sensitivity analysis with the initial solve of the optimization problem.

From the output, you can see that changing the price of cheese between 6.82284 and 19.4228 would result in the same optimal basis.

You can easily verify this by using the warm-start technique shown in Example 5.4. First, you change the price of cheese to 15.0. The COLUMNS section in the input data table ex3 is updated (and the data table is saved as ex9) as follows:

   COLUMNS     .          .        .     .         .
      ...
   .           ch         diet     15     calories  106
      ...
   RHS         .          .        .     .         .
      ...

   ENDATA
   ;

You can use the following DATA step to create the data table ex9:

data mylib.ex9;
   input _id_ field1 $ field2 $ field3 $ field4 field5 $ field6;
   datalines;
1  NAME        .          EX3      .     .         .
2  ROWS        .          .        .     .         .
3  N           diet       .        .     .         .
4  G           calories   .        .     .         .
5  L           protein    .        .     .         .
6  G           fat        .        .     .         .
7  G           carbs      .        .     .         .
8  COLUMNS     .          .        .     .         .
9  .           br         diet     2     calories  90
10 .           br         protein  4     fat       1
11 .           br         carbs    15    .         .
12 .           mi         diet     3.5   calories  120
13 .           mi         protein  8     fat       5
14 .           mi         carbs    11.7  .         .
15 .           ch         diet     15    calories  106
16 .           ch         protein  7     fat       9
17 .           ch         carbs    .4    .         .
18 .           po         diet     1.5   calories  97
19 .           po         protein  1.3   fat       .1
20 .           po         carbs    22.6  .         .
21 .           fi         diet     11    calories  130
22 .           fi         protein  8     fat       7
23 .           fi         carbs    0     .         .
24 .           yo         diet     1     calories  180
25 .           yo         protein  9.2   fat       1
26 .           yo         carbs    17    .         .
27 RHS         .          .        .     .         .
28 .           .          calories 300   protein   10
29 .           .          fat      8     carbs     10
30 BOUNDS      .          .        .     .         .
31 UP          .          mi       1     .         .
32 LO          .          fi       .5    .         .
33 ENDATA      .          .        .     .         .
;

You can use the BASIS=WARMSTART option (and the ex3pout and ex3dout data tables from Example 5.3) in the following call to PROC OPTLP to solve the modified problem:

proc optlp data=mylib.ex9
   presolver = none
   basis     = warmstart
   primalin  = mylib.ex3pout
   dualin    = mylib.ex3dout
   algorithm = primal
   logfreq   = 1;
run;

The following iteration log indicates that it takes the primal simplex algorithm no extra iterations to solve the modified problem by using BASIS=WARMSTART, because the optimal basis to the LP problem in Example 5.3 remains optimal after the objective function is changed.

Output 5.9.2: Iteration Log

NOTE: The problem EX3 has 6 variables (0 free, 0 fixed).                        
NOTE: The problem has 4 constraints (1 LE, 0 EQ, 3 GE, 0 range).                
NOTE: The problem has 23 constraint coefficients.                               
NOTE: The LP presolver value NONE is applied.                                   
NOTE: The LP solver is called.                                                  
NOTE: The Primal Simplex algorithm is used.                                     
                           Objective                Entering      Leaving       
      Phase Iteration        Value         Time     Variable      Variable      
       P 2          1    1.522783E+01         0                                 
NOTE: Optimal.                                                                  
NOTE: Objective = 15.227829598.                                                 
NOTE: The Primal Simplex solve time is 0.00 seconds.                            
NOTE: The Cloud Analytic Services server processed the request in 0.499424      
      seconds.                                                                  


Last updated: March 04, 2026