The Linear Programming Solver

Example 8.2: Reoptimizing the Diet Problem Using BASIS=WARMSTART

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 Function
The OPTMODEL Procedure

[1] diet
Bread 0.000000
Cheese 0.449499
Fish 0.500000
Milk 0.053599
Potato 1.865168
Yogurt 0.000000



The 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: Log
NOTE: The problem has 6 variables (0 free, 0 fixed).
NOTE: The problem has 4 linear constraints (1 LE, 0 EQ, 3 GE, 0 range).
NOTE: The problem has 23 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTLP presolver value NONE is applied.
NOTE: The PRIMAL SIMPLEX solver is called.
NOTE: Optimal.
NOTE: Objective = 10.980335514.



Next 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 RHS
The OPTMODEL Procedure

[1] diet
Bread 0.00000
Cheese 0.18481
Fish 0.50000
Milk 0.56440
Potato 0.14702
Yogurt 0.00000



The 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
NOTE: The problem has 6 variables (0 free, 0 fixed).
NOTE: The problem has 4 linear constraints (1 LE, 0 EQ, 3 GE, 0 range).
NOTE: The problem has 23 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTLP presolver value NONE is applied.
NOTE: The DUAL SIMPLEX solver is called.
NOTE: Objective Entering Leaving
Phase Iteration Value Variable Variable
2 1 9.174413 cal_con (S) carb_con (S)
NOTE: Optimal.
NOTE: Objective = 9.1744131985.



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, mg14812233718656132

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 Constraint
The OPTMODEL Procedure

[1] diet
Bread 0.000000
Cheese 0.449499
Fish 0.500000
Milk 0.053599
Potato 1.865168
Yogurt 0.000000



The 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
NOTE: The problem has 6 variables (0 free, 0 fixed).
NOTE: The problem has 5 linear constraints (2 LE, 0 EQ, 3 GE, 0 range).
NOTE: The problem has 29 linear constraint coefficients.
NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range).
NOTE: The OPTLP presolver value NONE is applied.
NOTE: The DUAL SIMPLEX solver is called.
NOTE: Optimal.
NOTE: Objective = 12.081337881.



Previous Page | Next Page | Top of Page