ENTC 412 - Lab 1: An Introduction To LP and MS Excel Solver: Objectives
ENTC 412 - Lab 1: An Introduction To LP and MS Excel Solver: Objectives
Solver
Objectives
Learning Linear Programming (LP) basics, mathematical formulation of an LP problem and geometric
interpretation of two-variable LP problems. Learning how to use MS Excel Solver to solve a simple LP
problem and interpret the solution.
Materials
1. Handouts distributed by the instructor
2. MS Excel Solver
3. USB memory-stick to save your work.
Procedure
This laboratory exercise consists two parts. In the first part, you will be given an introductory lecture to LP,
which is a tool for solving optimization problems. During this lecture you will be given information on some
important terms and characteristics used to describe linear programming problems. You will also learn how
to formulate a real life problem, how to solve it and how to interpret and improve the solution. In the second
part you will use MS Excel to solve a simple problem in order to gain experience and prepare yourself for
solving more difficult problems.
Part 1
Prototype Example: (Hillier and Liberman, Introduction to Operations Research, McGraw Hill, 2001, 7th
Edition)
1
2
3
4
5
Some words on Sensitivity Analysis
Objective function:
1. The opportunity/reduced cost of a given decision variable can be interpreted as the
rate at which the value of the objective function (i.e., profit) will deteriorate for each unit
change in the optimized value of the decision variable with all other data held fixed.
Constraint:
1. The shadow price of a given constraint can be interpreted as the rate of improvement
in the optimal objective function value, (e.g., Z in maximizing profit or C in minimizing
cost) as RHS of that constraint increases with all other data held fixed. "Rate of
improvement" means "rate of increase" for a maximization model; and "rate of decrease"
for a minimization model. If the RHS is decreased, the shadow price is the rate at which
Z (or C) is impaired.
2. The above interpretation of shadow price is valid only within a range of the given
RHS. The shadow price may change to a different value outside this allowable range. The
6
shadow price information does not tell us how the optimal solution mix (i.e., the values
for decision variables X1, X2, etc.) changes.
Part 2
Having formulated the problem, you can then proceed to entering it into Excel.
1) Set cells to hold the values of the decision variables. For this example we have two
decision variables so let’s assign cells D3 for x1 and E3 for x2:
Observe that in the figure above the values for the variables are set to “1” – eventually these cells
will hold the best values for these variables.
b. Set the cell that will hold the value of the objective function. In the figure above,
cell G5 contains the product of G5 = D3*D5 + E3*E5. It is more convenient to
use the function “SUMPRODUCT” as follows:
7
3) Set the constraints:
a. Set the cells to hold the coefficients of the decision variables in each constraint.
In the figure below we has designated D7:E7, D8:E8, and D9:E9 for the
coefficients in the constraints for Plant 1, 2 and 3 capacities, respectively.
b. Set a cell for the value of each constraint calculated using the variable values.
For instance for Plant 1 capacity constraint, the value is in cell F7, and it is
calculated using SUMPRODUCT:
The values for the values of the constraints for Plants 2 and 3 were calaculated
similarly.
c. Set cells to hold the values of the right-had-side (RHS) of each constraint. In our
example these given values are conveniently set in cells G7:G9.
8
Notice that, the values for the objective function value (G5), and the constraint
values (F7:F9), are calculated correctly for the given values of the variables
(D3:E3).
9
5) Run Solver by clicking on “Solve” :
You will notice that the cells with the variable values now contain the optimal solution to
the LP-formulation. Select “Answer” and click OK:
10
Report:
Ask the instructor for the problem set you need to solve using linear programming – your
report for this laboratory exercise consist of the solution of these problems.
11