The OPTLP Procedure
Example 6.5 Reoptimizing after Modifying the Right-Hand Side
You can also modify the right-hand side of your problem and use the BASIS=WARMSTART option to obtain an optimal solution more quickly. Since the dual solution to the original LP is still feasible for the modified problem in this case, the dual simplex algorithm is preferred. This case is illustrated by using the same diet problem as in Example 6.3. Assume that you now need a diet that supplies at least 150 calories. The RHS section in the input data table ex3 is updated (and the data set is saved as ex5) as follows:
...
RHS . . . . .
. . calories 150 protein 10
. . fat 8 carbs 10
BOUNDS . . . . .
...
You can use the following DATA step to create the data table ex5:
data mycas.ex5; 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 8 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 150 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 in the following call to PROC OPTLP to solve the modified problem:
proc optlp data=mycas.ex5 presolver = none basis = warmstart primalin = mycas.ex3pout dualin = mycas.ex3dout algorithm = dual primalout = mycas.ex5pout dualout = mycas.ex5dout logfreq = 1; run;
Note that the dual simplex algorithm is preferred because the dual solution to the last solved LP is still feasible for the modified problem in this case.
The following iteration log indicates that it takes the dual simplex algorithm just one more phase II iteration to solve the modified problem by using BASIS=WARMSTART.
Output 6.5.1: 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 Dual Simplex algorithm is used. |
| Objective Entering Leaving |
| Phase Iteration Value Time Variable Variable |
| D 2 1 8.813205E+00 0 calories (S) carbs (S) |
| D 2 2 9.174413E+00 0 |
| NOTE: Optimal. |
| NOTE: Objective = 9.1744131985. |
| NOTE: The Dual Simplex solve time is 0.00 seconds. |
| NOTE: The Cloud Analytic Services server processed the request in 0.057669 |
| seconds. |
| NOTE: The data set MYCAS.EX5POUT has 6 observations and 10 variables. |
| NOTE: The data set MYCAS.EX5DOUT has 4 observations and 10 variables. |
Compare this with the following call to PROC OPTLP:
proc optlp data=mycas.ex5 presolver = none algorithm = dual logfreq = 1; run;
This call to PROC OPTLP solves the modified problem "from scratch" (without using the BASIS=WARMSTART option) and produces the following iteration log.
Output 6.5.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 Dual Simplex algorithm is used. |
| Objective Entering Leaving |
| Phase Iteration Value Time Variable Variable |
| D 2 1 5.500000E+00 0 mi fat (S) |
| D 2 2 8.650000E+00 0 ch protein (S) |
| D 2 3 8.925676E+00 0 po carbs (S) |
| D 2 4 9.174413E+00 0 |
| NOTE: Optimal. |
| NOTE: Objective = 9.1744131985. |
| NOTE: The Dual Simplex solve time is 0.00 seconds. |
| NOTE: The Cloud Analytic Services server processed the request in 0.03546 |
| seconds. |
It is clear that using the BASIS=WARMSTART option saves computation time. For larger or more complex examples, the benefits of using this option are more pronounced.