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 1.1.
Figure 1.1: hardness Parameter
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 1.2.
Figure 1.2: cost Parameter
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 1.3:
expand;
This optional statement is useful for debugging purposes, to make sure that the model that PROC OPTMODEL creates is what you intended.
Figure 1.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 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] + 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=Revenue - RawCost - StorageCost 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,0] + Buy[veg1,1] - Use[veg1,1] - Store[veg1,1] = 0 Constraint Flow_balance_con[veg1,2]: Store[veg1,1] + Buy[veg1,2] - Use[veg1,2] - Store[veg1,2] = 0 Constraint Flow_balance_con[veg1,3]: Store[veg1,2] + Buy[veg1,3] - Use[veg1,3] - Store[veg1,3] = 0 Constraint Flow_balance_con[veg1,4]: Store[veg1,3] + Buy[veg1,4] - Use[veg1,4] - Store[veg1,4] = 0 Constraint Flow_balance_con[veg1,5]: Store[veg1,4] + Buy[veg1,5] - Use[veg1,5] - Store[veg1,5] = 0 Constraint Flow_balance_con[veg1,6]: Store[veg1,5] + Buy[veg1,6] - Use[veg1,6] - Store[veg1,6] = 0 Constraint Flow_balance_con[veg2,1]: Store[veg2,0] + Buy[veg2,1] - Use[veg2,1] - Store[veg2,1] = 0 Constraint Flow_balance_con[veg2,2]: Store[veg2,1] + Buy[veg2,2] - Use[veg2,2] - Store[veg2,2] = 0 Constraint Flow_balance_con[veg2,3]: Store[veg2,2] + Buy[veg2,3] - Use[veg2,3] - Store[veg2,3] = 0 Constraint Flow_balance_con[veg2,4]: Store[veg2,3] + Buy[veg2,4] - Use[veg2,4] - Store[veg2,4] = 0 Constraint Flow_balance_con[veg2,5]: Store[veg2,4] + Buy[veg2,5] - Use[veg2,5] - Store[veg2,5] = 0 Constraint Flow_balance_con[veg2,6]: Store[veg2,5] + Buy[veg2,6] - Use[veg2,6] - Store[veg2,6] = 0 Constraint Flow_balance_con[oil1,1]: Store[oil1,0] + Buy[oil1,1] - Use[oil1,1] - Store[oil1,1] = 0 Constraint Flow_balance_con[oil1,2]: Store[oil1,1] + Buy[oil1,2] - Use[oil1,2] - Store[oil1,2] = 0 Constraint Flow_balance_con[oil1,3]: Store[oil1,2] + Buy[oil1,3] - Use[oil1,3] - Store[oil1,3] = 0 Constraint Flow_balance_con[oil1,4]: Store[oil1,3] + Buy[oil1,4] - Use[oil1,4] - Store[oil1,4] = 0 Constraint Flow_balance_con[oil1,5]: Store[oil1,4] + Buy[oil1,5] - Use[oil1,5] - Store[oil1,5] = 0 Constraint Flow_balance_con[oil1,6]: Store[oil1,5] + Buy[oil1,6] - Use[oil1,6] - Store[oil1,6] = 0 Constraint Flow_balance_con[oil2,1]: Store[oil2,0] + Buy[oil2,1] - Use[oil2,1] - Store[oil2,1] = 0 Constraint Flow_balance_con[oil2,2]: Store[oil2,1] + Buy[oil2,2] - Use[oil2,2] - Store[oil2,2] = 0 Constraint Flow_balance_con[oil2,3]: Store[oil2,2] + Buy[oil2,3] - Use[oil2,3] - Store[oil2,3] = 0 Constraint Flow_balance_con[oil2,4]: Store[oil2,3] + Buy[oil2,4] - Use[oil2,4] - Store[oil2,4] = 0 Constraint Flow_balance_con[oil2,5]: Store[oil2,4] + Buy[oil2,5] - Use[oil2,5] - Store[oil2,5] = 0 Constraint Flow_balance_con[oil2,6]: Store[oil2,5] + Buy[oil2,6] - Use[oil2,6] - Store[oil2,6] = 0 Constraint Flow_balance_con[oil3,1]: Store[oil3,0] + Buy[oil3,1] - Use[oil3,1] - Store[oil3,1] = 0 Constraint Flow_balance_con[oil3,2]: Store[oil3,1] + Buy[oil3,2] - Use[oil3,2] - Store[oil3,2] = 0 Constraint Flow_balance_con[oil3,3]: Store[oil3,2] + Buy[oil3,3] - Use[oil3,3] - Store[oil3,3] = 0 Constraint Flow_balance_con[oil3,4]: Store[oil3,3] + Buy[oil3,4] - Use[oil3,4] - Store[oil3,4] = 0 Constraint Flow_balance_con[oil3,5]: Store[oil3,4] + Buy[oil3,5] - Use[oil3,5] - Store[oil3,5] = 0 Constraint Flow_balance_con[oil3,6]: Store[oil3,5] + Buy[oil3,6] - Use[oil3,6] - Store[oil3,6] = 0 Constraint Hardness_ub_con[1]: 8.8*Use[veg1,1] + 6.1*Use[veg2,1] + 2*Use[oil1,1] + 4.2*Use[oil2,1] + 5*Use[oil3,1] - 3*Manufacture[1] >= 0 Constraint Hardness_ub_con[2]: 8.8*Use[veg1,2] + 6.1*Use[veg2,2] + 2*Use[oil1,2] + 4.2*Use[oil2,2] + 5*Use[oil3,2] - 3*Manufacture[2] >= 0 Constraint Hardness_ub_con[3]: 8.8*Use[veg1,3] + 6.1*Use[veg2,3] + 2*Use[oil1,3] + 4.2*Use[oil2,3] + 5*Use[oil3,3] - 3*Manufacture[3] >= 0 Constraint Hardness_ub_con[4]: 8.8*Use[veg1,4] + 6.1*Use[veg2,4] + 2*Use[oil1,4] + 4.2*Use[oil2,4] + 5*Use[oil3,4] - 3*Manufacture[4] >= 0 Constraint Hardness_ub_con[5]: 8.8*Use[veg1,5] + 6.1*Use[veg2,5] + 2*Use[oil1,5] + 4.2*Use[oil2,5] + 5*Use[oil3,5] - 3*Manufacture[5] >= 0 Constraint Hardness_ub_con[6]: 8.8*Use[veg1,6] + 6.1*Use[veg2,6] + 2*Use[oil1,6] + 4.2*Use[oil2,6] + 5*Use[oil3,6] - 3*Manufacture[6] >= 0 Constraint Hardness_lb_con[1]: 8.8*Use[veg1,1] + 6.1*Use[veg2,1] + 2*Use[oil1,1] + 4.2*Use[oil2,1] + 5*Use[oil3,1] - 6*Manufacture[1] <= 0 Constraint Hardness_lb_con[2]: 8.8*Use[veg1,2] + 6.1*Use[veg2,2] + 2*Use[oil1,2] + 4.2*Use[oil2,2] + 5*Use[oil3,2] - 6*Manufacture[2] <= 0 Constraint Hardness_lb_con[3]: 8.8*Use[veg1,3] + 6.1*Use[veg2,3] + 2*Use[oil1,3] + 4.2*Use[oil2,3] + 5*Use[oil3,3] - 6*Manufacture[3] <= 0 Constraint Hardness_lb_con[4]: 8.8*Use[veg1,4] + 6.1*Use[veg2,4] + 2*Use[oil1,4] + 4.2*Use[oil2,4] + 5*Use[oil3,4] - 6*Manufacture[4] <= 0 Constraint Hardness_lb_con[5]: 8.8*Use[veg1,5] + 6.1*Use[veg2,5] + 2*Use[oil1,5] + 4.2*Use[oil2,5] + 5*Use[oil3,5] - 6*Manufacture[5] <= 0 Constraint Hardness_lb_con[6]: 8.8*Use[veg1,6] + 6.1*Use[veg2,6] + 2*Use[oil1,6] + 4.2*Use[oil2,6] + 5*Use[oil3,6] - 6*Manufacture[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 1.4 through Figure 1.7.
Figure 1.4 shows the output when you use the (default) dual simplex algorithm.
Figure 1.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 |
[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 | 500.00 | 250.000 | 500.000 |
oil2 | 3 | 0.00 | 250.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 | 0.000 | 500.000 |
oil3 | 2 | 0.00 | 0.000 | 500.000 |
oil3 | 3 | 250.00 | 0.000 | 750.000 |
oil3 | 4 | 0.00 | 250.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 | 22.222 | 159.259 |
veg1 | 4 | 0.00 | 0.000 | 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 | 40.741 | 459.259 |
veg2 | 2 | 0.00 | 40.741 | 418.519 |
veg2 | 3 | 0.00 | 177.778 | 240.741 |
veg2 | 4 | 0.00 | 200.000 | 40.741 |
veg2 | 5 | 0.00 | 40.741 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |
Figure 1.5 shows the output when you use the ALGORITHM=PS option to invoke the primal simplex algorithm.
Figure 1.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 |
[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 | 250.00 | 250.000 | 500.000 |
oil2 | 3 | 0.00 | 0.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 | 250.000 | 250.000 |
oil3 | 2 | 0.00 | 0.000 | 250.000 |
oil3 | 3 | 0.00 | 250.000 | 0.000 |
oil3 | 4 | 0.00 | 0.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 | 0.000 | 500.000 |
veg1 | 2 | 0.00 | 96.296 | 403.704 |
veg1 | 3 | 0.00 | 85.185 | 318.519 |
veg1 | 4 | 0.00 | 159.259 | 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 | 200.000 | 300.000 |
veg2 | 2 | 0.00 | 103.704 | 196.296 |
veg2 | 3 | 0.00 | 114.815 | 81.481 |
veg2 | 4 | 0.00 | 40.741 | 40.741 |
veg2 | 5 | 0.00 | 40.741 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |
Figure 1.6 shows the output when you use the ALGORITHM=IP option to invoke the interior point algorithm.
Figure 1.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 |
Solution Summary | |
---|---|
Solver | LP |
Algorithm | Interior Point |
Objective Function | Profit |
Solution Status | Optimal |
Objective Value | 107842.59259 |
Primal Infeasibility | 1.136868E-13 |
Dual Infeasibility | 1.976197E-14 |
Bound Infeasibility | 0 |
Duality Gap | 0 |
Complementarity | 0 |
Iterations | 9 |
Iterations2 | 17 |
Presolve Time | 0.60 |
Solution Time | 0.60 |
[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 | 250.000 | 250.00 |
oil2 | 2 | 750.00 | 250.000 | 750.00 |
oil2 | 3 | 0.00 | 250.000 | 500.00 |
oil2 | 4 | 0.00 | 250.000 | 250.00 |
oil2 | 5 | 0.00 | 250.000 | 0.00 |
oil2 | 6 | 750.00 | 250.000 | 500.00 |
oil3 | 0 | 500.00 | ||
oil3 | 1 | 0.00 | 0.000 | 500.00 |
oil3 | 2 | 0.00 | 0.000 | 500.00 |
oil3 | 3 | 0.00 | 0.000 | 500.00 |
oil3 | 4 | 0.00 | 0.000 | 500.00 |
oil3 | 5 | 0.00 | 0.000 | 500.00 |
oil3 | 6 | 0.00 | 0.000 | 500.00 |
veg1 | 0 | 500.00 | ||
veg1 | 1 | 0.00 | 159.259 | 340.74 |
veg1 | 2 | 0.00 | 22.222 | 318.52 |
veg1 | 3 | 0.00 | 159.259 | 159.26 |
veg1 | 4 | 0.00 | 159.259 | 0.00 |
veg1 | 5 | 0.00 | 0.000 | 0.00 |
veg1 | 6 | 659.26 | 159.259 | 500.00 |
veg2 | 0 | 500.00 | ||
veg2 | 1 | 0.00 | 40.741 | 459.26 |
veg2 | 2 | 0.00 | 177.778 | 281.48 |
veg2 | 3 | 0.00 | 40.741 | 240.74 |
veg2 | 4 | 0.00 | 40.741 | 200.00 |
veg2 | 5 | 0.00 | 200.000 | 0.00 |
veg2 | 6 | 540.74 | 40.741 | 500.00 |
Figure 1.7 shows the output when you use the ALGORITHM=NS option to invoke the network simplex algorithm.
Figure 1.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 |
[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 | 250.00 | 0.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 | 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 | 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 | 159.259 | 170.370 |
veg1 | 4 | 0.00 | 11.111 | 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 | 40.741 | 229.630 |
veg2 | 4 | 0.00 | 188.889 | 40.741 |
veg2 | 5 | 0.00 | 40.741 | 0.000 |
veg2 | 6 | 540.74 | 40.741 | 500.000 |