Previous Page | Next Page

The Linear Programming Solver

Example 10.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 10.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 10.2.1.

Output 10.2.1 Optimal Solution to the Diet Problem with Modified Objective Function
The OPTMODEL Procedure

Problem Summary
Objective Sense Minimization
Objective Function f
Objective Type Linear
   
Number of Variables 6
Bounded Above 0
Bounded Below 5
Bounded Below and Above 1
Free 0
Fixed 0
   
Number of Constraints 4
Linear LE (<=) 1
Linear EQ (=) 0
Linear GE (>=) 3
Linear Range 0

Solution Summary
Solver Primal Simplex
Objective Function f
Solution Status Optimal
Objective Value 10.980335514
Iterations 5
   
Primal Infeasibility 8.881784E-16
Dual Infeasibility 0
Bound Infeasibility 0

[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 10.2.2 Log
line
 
NOTE: There were 6 observations read from the data set WORK.FOODDATA.           
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 OPTMODEL presolver removed 0 variables, 0 linear constraints, and 0   
      nonlinear constraints.                                                    
NOTE: No basis information is available.  The BASIS=WARMSTART option is ignored.
NOTE: The OPTLP presolver value NONE is applied.                                
NOTE: The PRIMAL SIMPLEX solver is called.                                      
                       Objective     Entering        Leaving                    
      Phase Iteration  Value         Variable        Variable                   
        1           1      2.333259  diet[Cheese]    prot_con    (S)            
        2           2     11.340909  diet[Potato]    fat_con     (S)            
        2           3     11.065455  diet[Yogurt]    cal_con     (S)            
        2           4     10.980336  diet[Milk]      diet[Yogurt](S)            
NOTE: Optimal.                                                                  
NOTE: Objective = 10.9803355.                                                   
 
 

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 10.2.3.

Output 10.2.3 Optimal Solution to the Diet Problem with Modified RHS
The OPTMODEL Procedure

Problem Summary
Objective Sense Minimization
Objective Function f
Objective Type Linear
   
Number of Variables 6
Bounded Above 0
Bounded Below 5
Bounded Below and Above 1
Free 0
Fixed 0
   
Number of Constraints 4
Linear LE (<=) 1
Linear EQ (=) 0
Linear GE (>=) 3
Linear Range 0

Solution Summary
Solver Dual Simplex
Objective Function f
Solution Status Optimal
Objective Value 9.1744131985
Iterations 3
   
Primal Infeasibility 0
Dual Infeasibility 0
Bound Infeasibility 0

[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 10.2.4 Log
line
 
NOTE: There were 6 observations read from the data set WORK.FOODDATA.           
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 OPTMODEL presolver removed 0 variables, 0 linear constraints, and 0   
      nonlinear constraints.                                                    
NOTE: No basis information is available.  The BASIS=WARMSTART option is ignored.
NOTE: The OPTLP presolver value NONE is applied.                                
NOTE: The DUAL SIMPLEX solver is called.                                        
                       Objective     Entering        Leaving                    
      Phase Iteration  Value         Variable        Variable                   
        2           1      8.650000  diet[Milk]      fat_con     (S)            
        2           2      8.925676  diet[Cheese]    prot_con    (S)            
        2           3      9.174413  diet[Potato]    carb_con    (S)            
NOTE: Optimal.                                                                  
NOTE: Objective = 9.1744132.                                                    
 
 

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 10.2.

Table 10.3 (continued)
 

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 10.2.5.

Output 10.2.5 Optimal Solution to the Diet Problem with Additional Constraint
The OPTMODEL Procedure

Problem Summary
Objective Sense Minimization
Objective Function f
Objective Type Linear
   
Number of Variables 6
Bounded Above 0
Bounded Below 5
Bounded Below and Above 1
Free 0
Fixed 0
   
Number of Constraints 5
Linear LE (<=) 2
Linear EQ (=) 0
Linear GE (>=) 3
Linear Range 0

Solution Summary
Solver Dual Simplex
Objective Function f
Solution Status Optimal
Objective Value 12.081337881
Iterations 4
   
Primal Infeasibility 0
Dual Infeasibility 0
Bound Infeasibility 0

[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 10.2.6 Log
line
 
NOTE: There were 6 observations read from the data set WORK.FOODDATA.           
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 OPTMODEL presolver removed 0 variables, 0 linear constraints, and 0   
      nonlinear constraints.                                                    
NOTE: No basis information is available.  The BASIS=WARMSTART option is ignored.
NOTE: The OPTLP presolver value NONE is applied.                                
NOTE: The DUAL SIMPLEX solver is called.                                        
                       Objective     Entering        Leaving                    
      Phase Iteration  Value         Variable        Variable                   
        2           1      8.650000  diet[Milk]      fat_con     (S)            
        2           2      8.894231  diet[Yogurt]    cal_con     (S)            
        2           3     11.552207  diet[Potato]    prot_con    (S)            
        2           4     12.081338  diet[Cheese]    diet[Yogurt](S)            
NOTE: Optimal.                                                                  
NOTE: Objective = 12.0813379.                                                   
 
 

Previous Page | Next Page | Top of Page