Seeking to maximize E8, it is subject to
$B$9:$D$9 >= 0
$E$3:$E$7 <= $G$3:$G$7
with the changing cells $B$9:$D$9.
This results in the answer below.
Produce
20 of S
30 of F
0 of L
Now to do the same problem using the GNU Linear Programming Kit (GLPK), the model is built as follows.
--------
# This finds the optimal solution for maximizing the RV plants's profit
#
/* Decision variables */
var x1 >=0; /* Standard */
var x2 >=0; /* Fancy */
var x3 >=0; /* Luxury */
/* Objective function */
maximize z: 840*x1 + 1120*x2 + 1200*x3;
/* Constraints */
s.t. Engine_Shop : 3*x1 + 2*x2 + 1*x3 <= 120;
s.t. Body_Shop : 1*x1 + 2*x2 + 3*x3 <= 80;
s.t. Standard_Fin : 2*x1 + 0*x2 + 0*x3 <= 96;
s.t. Fancy_Fin : 0*x1 + 3*x2 + 0*x3 <= 102;
s.t. Luxury_Fin : 0*x1 + 0*x2 + 2*x3 <= 40;
end;
--------
While spreadsheet fans may find this slightly harder to follow, the format in this tool is closer to how a student defines a linear programming problem in class, only slightly more complex given scripting variables. GLPK produces the following report after running "glpsol -m glpk_Science_of_decision_Ch001.mod -o test.sol"
--------
Problem: glpk_Science_of_decision_Ch001
Rows: 6
Columns: 3
Non-zeros: 12
Status: OPTIMAL
Objective: z = 50400 (MAXimum)
No. Row name St Activity Lower bound Upper bound Marginal
------ ------------ -- ------------- ------------- ------------- -------------
1 z B 50400
2 Engine_Shop NU 120 120 140
3 Body_Shop NU 80 80 420
4 Standard_Fin B 40 96
5 Fancy_Fin B 90 102
6 Luxury_Fin B 0 40
No. Column name St Activity Lower bound Upper bound Marginal
------ ------------ -- ------------- ------------- ------------- -------------
1 x1 B 20 0
2 x2 B 30 0
3 x3 NL 0 0 -200
Karush-Kuhn-Tucker optimality conditions:
KKT.PE: max.abs.err. = 0.00e+000 on row 0
max.rel.err. = 0.00e+000 on row 0
High quality
KKT.PB: max.abs.err. = 0.00e+000 on row 0
max.rel.err. = 0.00e+000 on row 0
High quality
KKT.DE: max.abs.err. = 1.14e-013 on column 1
max.rel.err. = 1.35e-016 on column 1
High quality
KKT.DB: max.abs.err. = 0.00e+000 on row 0
max.rel.err. = 0.00e+000 on row 0
High quality
End of output
--------
While the report introduces a greater amount of information, we can still see the same results.
The company should produce
20 of the standard
30 of the fancy
0 of the luxury
The Google Docs spreadsheet looks almost the same as Excel for the purposes of this post so a screenshot of it is excluded. The only difference between the two for this example is how the constraints are setup. See the previous post for the details.