The Linear Programming Solver |
After an LP is solved, you might want to change a set of the parameters of the LP and solve the problem again. This can be done efficiently in PROC OPTMODEL. The warm start technique uses the optimal solution of the solved LP as a starting point and solves the modified LP problem faster than it can be solved again from scratch. This example illustrates reoptimizing the diet problem described in Example 8.1.
Assume the optimal solution is found by the SOLVE statement. Instead of quitting the OPTMODEL procedure, we continue to solve several variations of the original problem.
Suppose the cost of cheese increases from 8 to 10 per unit and the cost of fish decreases from 11 to 7 per serving unit. We change the parameters and solve the modified problem by submitting the following code:
cost['Cheese']=10; cost['Fish']=7; solve with lp/presolver=none basis=warmstart solver=ps printfreq=1; print diet;
Note that the primal simplex solver is preferred because the primal solution to the last-solved LP is still feasible for the modified problem in this case. The solution is shown in Output 8.2.1.
Output 8.2.1: Optimal Solution to the Diet Problem with Modified Objective FunctionThe following iteration log indicates that it takes the LP solver no more iterations to solve the modified problem by using BASIS=WARMSTART, since the optimal solution to the original problem remains optimal after the objective function is changed.
Output 8.2.2: LogNext we restore the original coefficients of the objective function and consider the case that you need a diet that supplies at least 150 calories. We change the parameters and solve the modified problem by submitting the following code:
cost['Cheese']=8; cost['Fish']=11;cal_con.lb=150; solve with lp/presolver=none basis=warmstart solver=ds printfreq=1; print diet;
Note that the dual simplex solver is preferred because the dual solution to the last-solved LP is still feasible for the modified problem in this case. The solution is shown in Output 8.2.3.
Output 8.2.3: Optimal Solution to the Diet Problem with Modified RHSThe following iteration log indicates that it takes the LP solver just one more phase II iteration to solve the modified problem by using BASIS=WARMSTART.
Output 8.2.4: Log
|
Next we restore the original constraint on calories and consider the case that you need a diet that supplies no more than 550 mg of sodium per day. The following row is appended to Table 8.2.
Bread | Milk | Cheese | Potato | Fish | Yogurt | |
sodium, mg | 148 | 122 | 337 | 186 | 56 | 132 |
We change the parameters, add the new constraint, and solve the modified problem by submitting the following code:
cal_con.lb=300; num sod{FOOD}=[148 122 337 186 56 132]; con sodium: sum{i in FOOD}sod[i]*diet[i] <= 550; solve with lp/presolver=none basis=warmstart printfreq=1; print diet;
The solution is shown in Output 8.2.5.
Output 8.2.5: Optimal Solution to the Diet Problem with Additional ConstraintThe following iteration log indicates that it takes the LP solver no more iterations to solve the modified problem by using the BASIS=WARMSTART option, since the optimal solution to the original problem remains optimal after one more constraint is added.
Output 8.2.6: Log
|
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.