The first READ DATA statement populates the OILS index set and reads the one-dimensional hardness data:
proc optmodel; set <str> OILS; num hardness {OILS}; read data hardness_data into OILS=[oil] hardness; print hardness;
The PRINT statement results in the first section of output, shown in Figure 2.1.
Figure 2.1: hardness Parameter
[1] | hardness |
---|---|
oil1 | 2.0 |
oil2 | 4.2 |
oil3 | 5.0 |
veg1 | 8.8 |
veg2 | 6.1 |
The second READ DATA statement populates the PERIODS index set and uses the already-populated OILS index set to loop across
data set variables when reading the two-dimensional cost data. The PERIODS index set is numeric and is populated by using
the automatic variable _N_
from the cost_data
data set, rather than by using the month names.
set PERIODS; num cost {OILS, PERIODS}; read data cost_data into PERIODS=[_N_] {oil in OILS} <cost[oil,_N_]=col(oil)>; print cost;
The PRINT statement results in the second section of output, shown in Figure 2.2.
Figure 2.2: cost Parameter
cost | ||||||
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
oil1 | 130 | 110 | 130 | 120 | 150 | 140 |
oil2 | 110 | 90 | 100 | 120 | 110 | 80 |
oil3 | 115 | 115 | 95 | 125 | 105 | 135 |
veg1 | 110 | 130 | 110 | 120 | 100 | 90 |
veg2 | 120 | 130 | 140 | 110 | 120 | 100 |
You can declare implicit variables with the IMPVAR statement, instead of defining explicit variables by using the VAR statement with an additional constraint. When you use the IMPVAR statement, PROC OPTMODEL performs an algebraic substitution, thereby reducing the number of variables and constraints passed to the solver.
var Buy {OILS, PERIODS} >= 0; var Use {OILS, PERIODS} >= 0; impvar Manufacture {period in PERIODS} = sum {oil in OILS} Use[oil,period];
The initial and terminal storage constraints for each raw oil are imposed by using the FIX statement to fix the values of
the corresponding Store[oil,period]
variables. An alternate approach is to use the CON statement to explicitly declare an equality constraint that contains exactly
one variable.
num last_period = max {period in PERIODS} period; var Store {OILS, PERIODS union {0}} >= 0 <= &store_ub; for {oil in OILS} do; fix Store[oil,0] = &init_storage; fix Store[oil,last_period] = &init_storage; end;
The following SET statement uses the SAS function SUBSTR together with the colon operator (:) to select the subset of oils whose name starts with ‘veg’:
set VEG = {oil in OILS: substr(oil,1,3) = 'veg'};
The following SET statement uses the DIFF operator to declare the non-vegetable oils to be the oils that do not appear in the set VEG:
set NONVEG = OILS diff VEG;
The following statements declare implicit variables, the objective, and constraints:
impvar Revenue = sum {period in PERIODS} &revenue_per_ton * Manufacture[period]; impvar RawCost = sum {oil in OILS, period in PERIODS} cost[oil,period] * Buy[oil,period]; impvar StorageCost = sum {oil in OILS, period in PERIODS} &storage_cost_per_ton * Store[oil,period]; max Profit = Revenue - RawCost - StorageCost; con Veg_ub_con {period in PERIODS}: sum {oil in VEG} Use[oil,period] <= &veg_ub; con Nonveg_ub_con {period in PERIODS}: sum {oil in NONVEG} Use[oil,period] <= &nonveg_ub; con Flow_balance_con {oil in OILS, period in PERIODS}: Store[oil,period-1] + Buy[oil,period] = Use[oil,period] + Store[oil,period];
As expressed on , the hardness of the final product is a ratio of linear functions of the decision variables. To increase algorithmic performance and reliability, the following two CON statements take advantage of the constant limits on hardness to linearize the nonlinear range constraint by clearing the denominator:
con Hardness_ub_con {period in PERIODS}: sum {oil in OILS} hardness[oil] * Use[oil,period] >= &hardness_lb * Manufacture[period]; con Hardness_lb_con {period in PERIODS}: sum {oil in OILS} hardness[oil] * Use[oil,period] <= &hardness_ub * Manufacture[period];
The following EXPAND statement displays the resulting model with all data populated, as shown in Figure 2.3:
expand;
This optional statement is useful for debugging purposes, to make sure that the model created by PROC OPTMODEL is what you intended.
Figure 2.3: Output from EXPAND Statement
The OPTMODEL Procedure Var Buy[veg1,1] >= 0 Var Buy[veg1,2] >= 0 Var Buy[veg1,3] >= 0 Var Buy[veg1,4] >= 0 Var Buy[veg1,5] >= 0 Var Buy[veg1,6] >= 0 Var Buy[veg2,1] >= 0 Var Buy[veg2,2] >= 0 Var Buy[veg2,3] >= 0 Var Buy[veg2,4] >= 0 Var Buy[veg2,5] >= 0 Var Buy[veg2,6] >= 0 Var Buy[oil1,1] >= 0 Var Buy[oil1,2] >= 0 Var Buy[oil1,3] >= 0 Var Buy[oil1,4] >= 0 Var Buy[oil1,5] >= 0 Var Buy[oil1,6] >= 0 Var Buy[oil2,1] >= 0 Var Buy[oil2,2] >= 0 Var Buy[oil2,3] >= 0 Var Buy[oil2,4] >= 0 Var Buy[oil2,5] >= 0 Var Buy[oil2,6] >= 0 Var Buy[oil3,1] >= 0 Var Buy[oil3,2] >= 0 Var Buy[oil3,3] >= 0 Var Buy[oil3,4] >= 0 Var Buy[oil3,5] >= 0 Var Buy[oil3,6] >= 0 Var Use[veg1,1] >= 0 Var Use[veg1,2] >= 0 Var Use[veg1,3] >= 0 Var Use[veg1,4] >= 0 Var Use[veg1,5] >= 0 Var Use[veg1,6] >= 0 Var Use[veg2,1] >= 0 Var Use[veg2,2] >= 0 Var Use[veg2,3] >= 0 Var Use[veg2,4] >= 0 Var Use[veg2,5] >= 0 Var Use[veg2,6] >= 0 Var Use[oil1,1] >= 0 Var Use[oil1,2] >= 0 Var Use[oil1,3] >= 0 Var Use[oil1,4] >= 0 Var Use[oil1,5] >= 0 Var Use[oil1,6] >= 0 Var Use[oil2,1] >= 0 Var Use[oil2,2] >= 0 Var Use[oil2,3] >= 0 Var Use[oil2,4] >= 0 Var Use[oil2,5] >= 0 |
The OPTMODEL Procedure Var Use[oil2,6] >= 0 Var Use[oil3,1] >= 0 Var Use[oil3,2] >= 0 Var Use[oil3,3] >= 0 Var Use[oil3,4] >= 0 Var Use[oil3,5] >= 0 Var Use[oil3,6] >= 0 Var Store[veg1,1] >= 0 <= 1000 Var Store[veg1,2] >= 0 <= 1000 Var Store[veg1,3] >= 0 <= 1000 Var Store[veg1,4] >= 0 <= 1000 Var Store[veg1,5] >= 0 <= 1000 Fix Store[veg1,6] = 500 Fix Store[veg1,0] = 500 Var Store[veg2,1] >= 0 <= 1000 Var Store[veg2,2] >= 0 <= 1000 Var Store[veg2,3] >= 0 <= 1000 Var Store[veg2,4] >= 0 <= 1000 Var Store[veg2,5] >= 0 <= 1000 Fix Store[veg2,6] = 500 Fix Store[veg2,0] = 500 Var Store[oil1,1] >= 0 <= 1000 Var Store[oil1,2] >= 0 <= 1000 Var Store[oil1,3] >= 0 <= 1000 Var Store[oil1,4] >= 0 <= 1000 Var Store[oil1,5] >= 0 <= 1000 Fix Store[oil1,6] = 500 Fix Store[oil1,0] = 500 Var Store[oil2,1] >= 0 <= 1000 Var Store[oil2,2] >= 0 <= 1000 Var Store[oil2,3] >= 0 <= 1000 Var Store[oil2,4] >= 0 <= 1000 Var Store[oil2,5] >= 0 <= 1000 Fix Store[oil2,6] = 500 Fix Store[oil2,0] = 500 Var Store[oil3,1] >= 0 <= 1000 Var Store[oil3,2] >= 0 <= 1000 Var Store[oil3,3] >= 0 <= 1000 Var Store[oil3,4] >= 0 <= 1000 Var Store[oil3,5] >= 0 <= 1000 Fix Store[oil3,6] = 500 Fix Store[oil3,0] = 500 Impvar Manufacture[1] = Use[veg1,1] + Use[veg2,1] + Use[oil1,1] + Use[oil2,1] + Use[oil3,1] Impvar Manufacture[2] = Use[veg1,2] + Use[veg2,2] + Use[oil1,2] + Use[oil2,2] + Use[oil3,2] Impvar Manufacture[3] = Use[veg1,3] + Use[veg2,3] + Use[oil1,3] + Use[oil2,3] + Use[oil3,3] Impvar Manufacture[4] = Use[veg1,4] + Use[veg2,4] + Use[oil1,4] + Use[oil2,4] + Use[oil3,4] Impvar Manufacture[5] = Use[veg1,5] + Use[veg2,5] + Use[oil1,5] + Use[oil2,5] + Use[oil3,5] Impvar Manufacture[6] = Use[veg1,6] + Use[veg2,6] + Use[oil1,6] + Use[oil2,6] + |
The OPTMODEL Procedure Use[oil3,6] Impvar Revenue = 150*Manufacture[1] + 150*Manufacture[2] + 150*Manufacture[3] + 150*Manufacture[4] + 150*Manufacture[5] + 150*Manufacture[6] Impvar RawCost = 110*Buy[veg1,1] + 130*Buy[veg1,2] + 110*Buy[veg1,3] + 120* Buy[veg1,4] + 100*Buy[veg1,5] + 90*Buy[veg1,6] + 120*Buy[veg2,1] + 130* Buy[veg2,2] + 140*Buy[veg2,3] + 110*Buy[veg2,4] + 120*Buy[veg2,5] + 100* Buy[veg2,6] + 130*Buy[oil1,1] + 110*Buy[oil1,2] + 130*Buy[oil1,3] + 120* Buy[oil1,4] + 150*Buy[oil1,5] + 140*Buy[oil1,6] + 110*Buy[oil2,1] + 90* Buy[oil2,2] + 100*Buy[oil2,3] + 120*Buy[oil2,4] + 110*Buy[oil2,5] + 80* Buy[oil2,6] + 115*Buy[oil3,1] + 115*Buy[oil3,2] + 95*Buy[oil3,3] + 125* Buy[oil3,4] + 105*Buy[oil3,5] + 135*Buy[oil3,6] Impvar StorageCost = 5*Store[veg1,1] + 5*Store[veg1,2] + 5*Store[veg1,3] + 5* Store[veg1,4] + 5*Store[veg1,5] + 5*Store[veg1,6] + 5*Store[veg2,1] + 5* Store[veg2,2] + 5*Store[veg2,3] + 5*Store[veg2,4] + 5*Store[veg2,5] + 5* Store[veg2,6] + 5*Store[oil1,1] + 5*Store[oil1,2] + 5*Store[oil1,3] + 5* Store[oil1,4] + 5*Store[oil1,5] + 5*Store[oil1,6] + 5*Store[oil2,1] + 5* Store[oil2,2] + 5*Store[oil2,3] + 5*Store[oil2,4] + 5*Store[oil2,5] + 5* Store[oil2,6] + 5*Store[oil3,1] + 5*Store[oil3,2] + 5*Store[oil3,3] + 5* Store[oil3,4] + 5*Store[oil3,5] + 5*Store[oil3,6] Maximize Profit=- StorageCost - RawCost + Revenue Constraint Veg_ub_con[1]: Use[veg1,1] + Use[veg2,1] <= 200 Constraint Veg_ub_con[2]: Use[veg1,2] + Use[veg2,2] <= 200 Constraint Veg_ub_con[3]: Use[veg1,3] + Use[veg2,3] <= 200 Constraint Veg_ub_con[4]: Use[veg1,4] + Use[veg2,4] <= 200 Constraint Veg_ub_con[5]: Use[veg1,5] + Use[veg2,5] <= 200 Constraint Veg_ub_con[6]: Use[veg1,6] + Use[veg2,6] <= 200 Constraint Nonveg_ub_con[1]: Use[oil1,1] + Use[oil2,1] + Use[oil3,1] <= 250 Constraint Nonveg_ub_con[2]: Use[oil1,2] + Use[oil2,2] + Use[oil3,2] <= 250 Constraint Nonveg_ub_con[3]: Use[oil1,3] + Use[oil2,3] + Use[oil3,3] <= 250 Constraint Nonveg_ub_con[4]: Use[oil1,4] + Use[oil2,4] + Use[oil3,4] <= 250 Constraint Nonveg_ub_con[5]: Use[oil1,5] + Use[oil2,5] + Use[oil3,5] <= 250 Constraint Nonveg_ub_con[6]: Use[oil1,6] + Use[oil2,6] + Use[oil3,6] <= 250 Constraint Flow_balance_con[veg1,1]: - Store[veg1,1] - Use[veg1,1] + Buy[veg1,1] + Store[veg1,0] = 0 Constraint Flow_balance_con[veg1,2]: - Store[veg1,2] - Use[veg1,2] + Buy[veg1,2] + Store[veg1,1] = 0 Constraint Flow_balance_con[veg1,3]: - Store[veg1,3] - Use[veg1,3] + Buy[veg1,3] + Store[veg1,2] = 0 Constraint Flow_balance_con[veg1,4]: - Store[veg1,4] - Use[veg1,4] + Buy[veg1,4] + Store[veg1,3] = 0 Constraint Flow_balance_con[veg1,5]: - Store[veg1,5] - Use[veg1,5] + Buy[veg1,5] + Store[veg1,4] = 0 Constraint Flow_balance_con[veg1,6]: - Store[veg1,6] - Use[veg1,6] + Buy[veg1,6] + Store[veg1,5] = 0 Constraint Flow_balance_con[veg2,1]: - Store[veg2,1] - Use[veg2,1] + Buy[veg2,1] + Store[veg2,0] = 0 Constraint Flow_balance_con[veg2,2]: - Store[veg2,2] - Use[veg2,2] + Buy[veg2,2] + Store[veg2,1] = 0 Constraint Flow_balance_con[veg2,3]: - Store[veg2,3] - Use[veg2,3] + Buy[veg2,3] + Store[veg2,2] = 0 Constraint Flow_balance_con[veg2,4]: - Store[veg2,4] - Use[veg2,4] + Buy[veg2,4] + Store[veg2,3] = 0 Constraint Flow_balance_con[veg2,5]: - Store[veg2,5] - Use[veg2,5] + Buy[veg2,5] |
The OPTMODEL Procedure + Store[veg2,4] = 0 Constraint Flow_balance_con[veg2,6]: - Store[veg2,6] - Use[veg2,6] + Buy[veg2,6] + Store[veg2,5] = 0 Constraint Flow_balance_con[oil1,1]: - Store[oil1,1] - Use[oil1,1] + Buy[oil1,1] + Store[oil1,0] = 0 Constraint Flow_balance_con[oil1,2]: - Store[oil1,2] - Use[oil1,2] + Buy[oil1,2] + Store[oil1,1] = 0 Constraint Flow_balance_con[oil1,3]: - Store[oil1,3] - Use[oil1,3] + Buy[oil1,3] + Store[oil1,2] = 0 Constraint Flow_balance_con[oil1,4]: - Store[oil1,4] - Use[oil1,4] + Buy[oil1,4] + Store[oil1,3] = 0 Constraint Flow_balance_con[oil1,5]: - Store[oil1,5] - Use[oil1,5] + Buy[oil1,5] + Store[oil1,4] = 0 Constraint Flow_balance_con[oil1,6]: - Store[oil1,6] - Use[oil1,6] + Buy[oil1,6] + Store[oil1,5] = 0 Constraint Flow_balance_con[oil2,1]: - Store[oil2,1] - Use[oil2,1] + Buy[oil2,1] + Store[oil2,0] = 0 Constraint Flow_balance_con[oil2,2]: - Store[oil2,2] - Use[oil2,2] + Buy[oil2,2] + Store[oil2,1] = 0 Constraint Flow_balance_con[oil2,3]: - Store[oil2,3] - Use[oil2,3] + Buy[oil2,3] + Store[oil2,2] = 0 Constraint Flow_balance_con[oil2,4]: - Store[oil2,4] - Use[oil2,4] + Buy[oil2,4] + Store[oil2,3] = 0 Constraint Flow_balance_con[oil2,5]: - Store[oil2,5] - Use[oil2,5] + Buy[oil2,5] + Store[oil2,4] = 0 Constraint Flow_balance_con[oil2,6]: - Store[oil2,6] - Use[oil2,6] + Buy[oil2,6] + Store[oil2,5] = 0 Constraint Flow_balance_con[oil3,1]: - Store[oil3,1] - Use[oil3,1] + Buy[oil3,1] + Store[oil3,0] = 0 Constraint Flow_balance_con[oil3,2]: - Store[oil3,2] - Use[oil3,2] + Buy[oil3,2] + Store[oil3,1] = 0 Constraint Flow_balance_con[oil3,3]: - Store[oil3,3] - Use[oil3,3] + Buy[oil3,3] + Store[oil3,2] = 0 Constraint Flow_balance_con[oil3,4]: - Store[oil3,4] - Use[oil3,4] + Buy[oil3,4] + Store[oil3,3] = 0 Constraint Flow_balance_con[oil3,5]: - Store[oil3,5] - Use[oil3,5] + Buy[oil3,5] + Store[oil3,4] = 0 Constraint Flow_balance_con[oil3,6]: - Store[oil3,6] - Use[oil3,6] + Buy[oil3,6] + Store[oil3,5] = 0 Constraint Hardness_ub_con[1]: - 3*Manufacture[1] + 8.8*Use[veg1,1] + 6.1* Use[veg2,1] + 2*Use[oil1,1] + 4.2*Use[oil2,1] + 5*Use[oil3,1] >= 0 Constraint Hardness_ub_con[2]: - 3*Manufacture[2] + 8.8*Use[veg1,2] + 6.1* Use[veg2,2] + 2*Use[oil1,2] + 4.2*Use[oil2,2] + 5*Use[oil3,2] >= 0 Constraint Hardness_ub_con[3]: - 3*Manufacture[3] + 8.8*Use[veg1,3] + 6.1* Use[veg2,3] + 2*Use[oil1,3] + 4.2*Use[oil2,3] + 5*Use[oil3,3] >= 0 Constraint Hardness_ub_con[4]: - 3*Manufacture[4] + 8.8*Use[veg1,4] + 6.1* Use[veg2,4] + 2*Use[oil1,4] + 4.2*Use[oil2,4] + 5*Use[oil3,4] >= 0 Constraint Hardness_ub_con[5]: - 3*Manufacture[5] + 8.8*Use[veg1,5] + 6.1* Use[veg2,5] + 2*Use[oil1,5] + 4.2*Use[oil2,5] + 5*Use[oil3,5] >= 0 Constraint Hardness_ub_con[6]: - 3*Manufacture[6] + 8.8*Use[veg1,6] + 6.1* Use[veg2,6] + 2*Use[oil1,6] + 4.2*Use[oil2,6] + 5*Use[oil3,6] >= 0 Constraint Hardness_lb_con[1]: - 6*Manufacture[1] + 8.8*Use[veg1,1] + 6.1* Use[veg2,1] + 2*Use[oil1,1] + 4.2*Use[oil2,1] + 5*Use[oil3,1] <= 0 |
The OPTMODEL Procedure Constraint Hardness_lb_con[2]: - 6*Manufacture[2] + 8.8*Use[veg1,2] + 6.1* Use[veg2,2] + 2*Use[oil1,2] + 4.2*Use[oil2,2] + 5*Use[oil3,2] <= 0 Constraint Hardness_lb_con[3]: - 6*Manufacture[3] + 8.8*Use[veg1,3] + 6.1* Use[veg2,3] + 2*Use[oil1,3] + 4.2*Use[oil2,3] + 5*Use[oil3,3] <= 0 Constraint Hardness_lb_con[4]: - 6*Manufacture[4] + 8.8*Use[veg1,4] + 6.1* Use[veg2,4] + 2*Use[oil1,4] + 4.2*Use[oil2,4] + 5*Use[oil3,4] <= 0 Constraint Hardness_lb_con[5]: - 6*Manufacture[5] + 8.8*Use[veg1,5] + 6.1* Use[veg2,5] + 2*Use[oil1,5] + 4.2*Use[oil2,5] + 5*Use[oil3,5] <= 0 Constraint Hardness_lb_con[6]: - 6*Manufacture[6] + 8.8*Use[veg1,6] + 6.1* Use[veg2,6] + 2*Use[oil1,6] + 4.2*Use[oil2,6] + 5*Use[oil3,6] <= 0 |
By using the .sol
suffix, the numeric parameter hardness_sol computes hardness of the final product from the optimal decision variable values returned by the solver:
num hardness_sol {period in PERIODS} = (sum {oil in OILS} hardness[oil] * Use[oil,period].sol) / Manufacture[period].sol;
You can declare hardness_sol even before the solver is called. Because the declaration includes an equals sign, the values are automatically updated each time the right-hand side changes. The following statements call the solver and print the solution:
solve; print Buy Use Store Manufacture hardness_sol;
Multiple CREATE DATA statements, with the variables of interest grouped according to their index sets, create multiple output data sets (not shown):
create data sol_data1 from [oil period] Buy Use Store; create data sol_data2 from [period] Manufacture;
In this example, all variables are real, the objective function is linear, and all constraints are linear. So PROC OPTMODEL automatically recognizes that this model is a linear programming problem, and the first SOLVE statement calls the default linear programming algorithm, which is the dual simplex algorithm. To invoke a non-default algorithm (such as primal simplex, interior point, or network simplex), you can use the ALGORITHM= option in the SOLVE statement:
solve with lp / algorithm=ps; print Buy Use Store Manufacture hardness_sol; solve with lp / algorithm=ip; print Buy Use Store Manufacture hardness_sol; solve with lp / algorithm=ns; print Buy Use Store Manufacture hardness_sol; quit;
Each algorithm returns an optimal solution with a profit of £107,843, although the optimal solutions differ from each other, as shown in Figure 2.4 through Figure 2.7.
Figure 2.4 shows the output when you use the (default) dual simplex algorithm.
Figure 2.4: Output from Dual Simplex Algorithm
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | Profit |
Objective Type | Linear |
Number of Variables | 95 |
Bounded Above | 0 |
Bounded Below | 60 |
Bounded Below and Above | 25 |
Free | 0 |
Fixed | 10 |
Number of Constraints | 54 |
Linear LE (<=) | 18 |
Linear EQ (=) | 30 |
Linear GE (>=) | 6 |
Linear Range | 0 |
Constraint Coefficients | 210 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Dual Simplex |
Objective Function | Profit |
Solution Status | Optimal |
Objective Value | 107842.59259 |
Iterations | 66 |
Primal Infeasibility | 5.684342E-14 |
Dual Infeasibility | 0 |
Bound Infeasibility | 0 |
[1] | [2] | Buy | Use | Store |
---|---|---|---|---|
oil1 | 0 | 500.000 | ||
oil1 | 1 | 0.00 | 0.000 | 500.000 |
oil1 | 2 | 0.00 | 0.000 | 500.000 |
oil1 | 3 | 0.00 | 0.000 | 500.000 |
oil1 | 4 | 0.00 | 0.000 | 500.000 |
oil1 | 5 | 0.00 | 0.000 | 500.000 |
oil1 | 6 | 0.00 | 0.000 | 500.000 |
oil2 | 0 | 500.000 | ||
oil2 | 1 | 0.00 | 250.000 | 250.000 |
oil2 | 2 | 750.00 | 250.000 | 750.000 |
oil2 | 3 | 0.00 | 250.000 | 500.000 |
oil2 | 4 | 0.00 | 250.000 | 250.000 |
oil2 | 5 | 0.00 | 250.000 | 0.000 |
oil2 | 6 | 750.00 | 250.000 | 500.000 |
oil3 | 0 | 500.000 | ||
oil3 | 1 | 0.00 | 0.000 | 500.000 |
oil3 | 2 | 0.00 | 0.000 | 500.000 |
oil3 | 3 | 0.00 | 0.000 | 500.000 |
oil3 | 4 | 0.00 | 0.000 | 500.000 |
oil3 | 5 | 0.00 | 0.000 | 500.000 |
oil3 | 6 | 0.00 | 0.000 | 500.000 |
veg1 | 0 | 500.000 | ||
veg1 | 1 | 0.00 | 159.259 | 340.741 |
veg1 | 2 | 0.00 | 159.259 | 181.481 |
veg1 | 3 | 0.00 | 0.000 | 181.481 |
veg1 | 4 | 0.00 | 159.259 | 22.222 |
veg1 | 5 | 0.00 | 22.222 | 0.000 |
veg1 | 6 | 659.26 | 159.259 | 500.000 |
veg2 | 0 | 500.000 | ||
veg2 | 1 | 0.00 | 40.741 | 459.259 |
veg2 | 2 | 0.00 | 40.741 | 418.519 |
veg2 | 3 | 0.00 | 200.000 | 218.519 |
veg2 | 4 | 0.00 | 40.741 | 177.778 |
veg2 | 5 | 0.00 | 177.778 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |
[1] | Manufacture | hardness_sol |
---|---|---|
1 | 450 | 6.0000 |
2 | 450 | 6.0000 |
3 | 450 | 5.6222 |
4 | 450 | 5.4889 |
5 | 450 | 6.0000 |
6 | 450 | 6.0000 |
Figure 2.5 shows the output when you use the ALGORITHM=PS option to invoke the primal simplex algorithm.
Figure 2.5: Output from Primal Simplex Algorithm
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | Profit |
Objective Type | Linear |
Number of Variables | 95 |
Bounded Above | 0 |
Bounded Below | 60 |
Bounded Below and Above | 25 |
Free | 0 |
Fixed | 10 |
Number of Constraints | 54 |
Linear LE (<=) | 18 |
Linear EQ (=) | 30 |
Linear GE (>=) | 6 |
Linear Range | 0 |
Constraint Coefficients | 210 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Primal Simplex |
Objective Function | Profit |
Solution Status | Optimal |
Objective Value | 107842.59259 |
Iterations | 67 |
Primal Infeasibility | 5.684342E-14 |
Dual Infeasibility | 0 |
Bound Infeasibility | 1.421085E-14 |
[1] | [2] | Buy | Use | Store |
---|---|---|---|---|
oil1 | 0 | 500.000 | ||
oil1 | 1 | 0.00 | 0.000 | 500.000 |
oil1 | 2 | 0.00 | 0.000 | 500.000 |
oil1 | 3 | 0.00 | 0.000 | 500.000 |
oil1 | 4 | 0.00 | 0.000 | 500.000 |
oil1 | 5 | 0.00 | 0.000 | 500.000 |
oil1 | 6 | 0.00 | 0.000 | 500.000 |
oil2 | 0 | 500.000 | ||
oil2 | 1 | 0.00 | 0.000 | 500.000 |
oil2 | 2 | 0.00 | 0.000 | 500.000 |
oil2 | 3 | 0.00 | 250.000 | 250.000 |
oil2 | 4 | 0.00 | 250.000 | 0.000 |
oil2 | 5 | 0.00 | 0.000 | 0.000 |
oil2 | 6 | 750.00 | 250.000 | 500.000 |
oil3 | 0 | 500.000 | ||
oil3 | 1 | 0.00 | 250.000 | 250.000 |
oil3 | 2 | 0.00 | 250.000 | 0.000 |
oil3 | 3 | 0.00 | 0.000 | 0.000 |
oil3 | 4 | 0.00 | 0.000 | 0.000 |
oil3 | 5 | 750.00 | 250.000 | 500.000 |
oil3 | 6 | 0.00 | 0.000 | 500.000 |
veg1 | 0 | 500.000 | ||
veg1 | 1 | 0.00 | 85.185 | 414.815 |
veg1 | 2 | 0.00 | 11.111 | 403.704 |
veg1 | 3 | 0.00 | 159.259 | 244.444 |
veg1 | 4 | 0.00 | 159.259 | 85.185 |
veg1 | 5 | -0.00 | 85.185 | 0.000 |
veg1 | 6 | 659.26 | 159.259 | 500.000 |
veg2 | 0 | 500.000 | ||
veg2 | 1 | 0.00 | 114.815 | 385.185 |
veg2 | 2 | 0.00 | 188.889 | 196.296 |
veg2 | 3 | 0.00 | 40.741 | 155.556 |
veg2 | 4 | 0.00 | 40.741 | 114.815 |
veg2 | 5 | 0.00 | 114.815 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |
[1] | Manufacture | hardness_sol |
---|---|---|
1 | 450 | 5.4889 |
2 | 450 | 5.6222 |
3 | 450 | 6.0000 |
4 | 450 | 6.0000 |
5 | 450 | 6.0000 |
6 | 450 | 6.0000 |
Figure 2.6 shows the output when you use the ALGORITHM=IP option to invoke the interior point algorithm.
Figure 2.6: Output from Interior Point Algorithm
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | Profit |
Objective Type | Linear |
Number of Variables | 95 |
Bounded Above | 0 |
Bounded Below | 60 |
Bounded Below and Above | 25 |
Free | 0 |
Fixed | 10 |
Number of Constraints | 54 |
Linear LE (<=) | 18 |
Linear EQ (=) | 30 |
Linear GE (>=) | 6 |
Linear Range | 0 |
Constraint Coefficients | 210 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 4 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Interior Point |
Objective Function | Profit |
Solution Status | Optimal |
Objective Value | 107842.59259 |
Iterations | 10 |
Primal Infeasibility | 5.521407E-17 |
Dual Infeasibility | 1.549995E-17 |
Bound Infeasibility | 3.007625E-17 |
Duality Gap | 2.269831E-16 |
Complementarity | 0 |
[1] | [2] | Buy | Use | Store |
---|---|---|---|---|
oil1 | 0 | 500.00 | ||
oil1 | 1 | 0.00 | 0.000 | 500.00 |
oil1 | 2 | 0.00 | 0.000 | 500.00 |
oil1 | 3 | 0.00 | 0.000 | 500.00 |
oil1 | 4 | 0.00 | 0.000 | 500.00 |
oil1 | 5 | 0.00 | 0.000 | 500.00 |
oil1 | 6 | 0.00 | 0.000 | 500.00 |
oil2 | 0 | 500.00 | ||
oil2 | 1 | 0.00 | 167.102 | 332.90 |
oil2 | 2 | 338.22 | 188.085 | 483.03 |
oil2 | 3 | 0.00 | 178.491 | 304.54 |
oil2 | 4 | 0.00 | 159.310 | 145.23 |
oil2 | 5 | 0.00 | 145.232 | 0.00 |
oil2 | 6 | 750.00 | 250.000 | 500.00 |
oil3 | 0 | 500.00 | ||
oil3 | 1 | 0.00 | 82.898 | 417.10 |
oil3 | 2 | 0.00 | 61.915 | 355.19 |
oil3 | 3 | 207.56 | 71.509 | 491.24 |
oil3 | 4 | 0.00 | 90.690 | 400.55 |
oil3 | 5 | 204.22 | 104.768 | 500.00 |
oil3 | 6 | 0.00 | 0.000 | 500.00 |
veg1 | 0 | 500.00 | ||
veg1 | 1 | 0.00 | 94.427 | 405.57 |
veg1 | 2 | 0.00 | 96.819 | 308.75 |
veg1 | 3 | 0.00 | 103.891 | 204.86 |
veg1 | 4 | 0.00 | 103.633 | 101.23 |
veg1 | 5 | 0.00 | 101.230 | 0.00 |
veg1 | 6 | 659.26 | 159.259 | 500.00 |
veg2 | 0 | 500.00 | ||
veg2 | 1 | 0.00 | 105.573 | 394.43 |
veg2 | 2 | 0.00 | 103.181 | 291.25 |
veg2 | 3 | 0.00 | 96.109 | 195.14 |
veg2 | 4 | 0.00 | 96.367 | 98.77 |
veg2 | 5 | 0.00 | 98.770 | 0.00 |
veg2 | 6 | 540.74 | 40.741 | 500.00 |
[1] | Manufacture | hardness_sol |
---|---|---|
1 | 450 | 5.7296 |
2 | 450 | 5.7073 |
3 | 450 | 5.7972 |
4 | 450 | 5.8059 |
5 | 450 | 5.8146 |
6 | 450 | 6.0000 |
Figure 2.7 shows the output when you use the ALGORITHM=NS option to invoke the network simplex algorithm.
Figure 2.7: Output from Network Simplex Algorithm
Problem Summary | |
---|---|
Objective Sense | Maximization |
Objective Function | Profit |
Objective Type | Linear |
Number of Variables | 95 |
Bounded Above | 0 |
Bounded Below | 60 |
Bounded Below and Above | 25 |
Free | 0 |
Fixed | 10 |
Number of Constraints | 54 |
Linear LE (<=) | 18 |
Linear EQ (=) | 30 |
Linear GE (>=) | 6 |
Linear Range | 0 |
Constraint Coefficients | 210 |
Performance Information | |
---|---|
Execution Mode | Single-Machine |
Number of Threads | 1 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Network Simplex |
Objective Function | Profit |
Solution Status | Optimal |
Objective Value | 107842.59259 |
Iterations | 48 |
Iterations2 | 46 |
Primal Infeasibility | 5.684342E-14 |
Dual Infeasibility | 0 |
Bound Infeasibility | 5.684342E-14 |
[1] | [2] | Buy | Use | Store |
---|---|---|---|---|
oil1 | 0 | 500.000 | ||
oil1 | 1 | 0.00 | 0.000 | 500.000 |
oil1 | 2 | 0.00 | 0.000 | 500.000 |
oil1 | 3 | 0.00 | 0.000 | 500.000 |
oil1 | 4 | 0.00 | 0.000 | 500.000 |
oil1 | 5 | 0.00 | 0.000 | 500.000 |
oil1 | 6 | 0.00 | 0.000 | 500.000 |
oil2 | 0 | 500.000 | ||
oil2 | 1 | 0.00 | 0.000 | 500.000 |
oil2 | 2 | 0.00 | 250.000 | 250.000 |
oil2 | 3 | 0.00 | 0.000 | 250.000 |
oil2 | 4 | 0.00 | 0.000 | 250.000 |
oil2 | 5 | 0.00 | 250.000 | 0.000 |
oil2 | 6 | 750.00 | 250.000 | 500.000 |
oil3 | 0 | 500.000 | ||
oil3 | 1 | 0.00 | 250.000 | 250.000 |
oil3 | 2 | 0.00 | 0.000 | 250.000 |
oil3 | 3 | 250.00 | 250.000 | 250.000 |
oil3 | 4 | 0.00 | 250.000 | 0.000 |
oil3 | 5 | 500.00 | 0.000 | 500.000 |
oil3 | 6 | 0.00 | 0.000 | 500.000 |
veg1 | 0 | 500.000 | ||
veg1 | 1 | 0.00 | 85.185 | 414.815 |
veg1 | 2 | 0.00 | 85.185 | 329.630 |
veg1 | 3 | 0.00 | 85.185 | 244.444 |
veg1 | 4 | 0.00 | 85.185 | 159.259 |
veg1 | 5 | -0.00 | 159.259 | 0.000 |
veg1 | 6 | 659.26 | 159.259 | 500.000 |
veg2 | 0 | 500.000 | ||
veg2 | 1 | 0.00 | 114.815 | 385.185 |
veg2 | 2 | 0.00 | 114.815 | 270.370 |
veg2 | 3 | 0.00 | 114.815 | 155.556 |
veg2 | 4 | 0.00 | 114.815 | 40.741 |
veg2 | 5 | 0.00 | 40.741 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |
[1] | Manufacture | hardness_sol |
---|---|---|
1 | 450 | 6.0000 |
2 | 450 | 6.0000 |
3 | 450 | 6.0000 |
4 | 450 | 5.1111 |
5 | 450 | 6.0000 |
6 | 450 | 6.0000 |