LP Formulation
LP Formulation
LP Formulation
A Production Problem
Weekly supply of raw materials:
Table Chair
Profit = $20/Table Profit = $15/Chair
Linear Programming
Linear programming uses a mathematical
model to find the best allocation of scarce
resources to various activities so as to
maximize profit or minimize cost.
Chairs
Decision variables
Changing cells
Objective function
Target cell
Constraints
Four Assumptions of Linear
Programming
Linearity
Divisibility
Certainty
Nonnegativity
Why Use Linear Programming?
x1
1 2 3 4 5 6 7 8 9 10
Example #1 Solution
Maximize Z = 3x1 5x 2 9
subject to
8
x1 4
2x 2 12 7
3x1 2 x2 18
6
and X2
x1 0, x 2 0. 5
1 2 3 4 5 6 X1
3X1 + 5X2 = 15
Example #2
Minimize Z = 15x1 20x2
subject to
x1 2x 2 10
2x1 3x 2 6 x2
x1 x2 6 10
and 9
x1 0, x2 0. 8
x1
1 2 3 4 5 6 7 8 9 10
Example #2 Solution
9
subject to
x1 2x 2 10 7
2x1 3x 2 6 6
x1 x2 6 X2
5
and
x1 0, x2 0. 4
1
15X1 + 20X2 = 12
1 2 3 4 5 6 7 8 9 10
3X1 + 5X2 = 15 X1
Example #3
Maximize Z = x1 x 2
subject to
x1 2x 2 8
x2
x1 x2 0
10
and
9
x1 0, x 2 0.
8
x1
1 2 3 4 5 6 7 8 9 10
1 2
sub je c t to
Example #3 Solution
a nd
x1 2 x 2 8
x1 x2 0
x1 0, x 2 0.
Maximize Z = x1 x 2
subject to
8
x1 2x 2 8 7
x1 x2 0
and 6
x1 0, x 2 0.
X2
1 2 3 4 5 6 7 8 X1
Solving Linear Programs with
Excel
Enter the input data and construct relationships among data elements in a readable, easy
to understand way. Include:
If you don’t have any particular initial values you want to enter for your decision variables,
you can start by just entering a value of 0 in each decision variable cell.
The formulas in the spreadsheet are shown below. Note the use of the
SUMPRODUCT function.
For linear programming you should try to always use the SUMPRODUCT
function (or SUM) for the objective function and constraints, as this guarantees
that the equations will be linear.
Defining the Target Cell (Objective
Function)
To select the cell you wish to optimize, select the “Set Target Cell”
window within the Solver dialogue box, and then either
•drag the cursor across all cells you wish to treat as decision variables, or
• type the addresses of every cell you wish to treat as a decision variable,
separating them by commas. (or enter the “name”)
If you wish to use the “dragging” method, but the decision variables
do not all lie in a connected rectangle in the spreadsheet, you can
“drag” them in one group at a time:
2-22
Adding Constraints
To begin entering constraints, click on the “Add” button to the right of the constraints
window. A new dialogue box will appear. The cursor will be in the “Cell Reference” window
within this dialogue box.
Click on the cell that contains the quantity you want to constrain, or
type the cell address that contains the quantity you want to constrain.
The default inequality that first appears for a constraint is “<= ”. To change this,
click on the arrow beside the “<= ” sign.
Select the inequality (or equality) you wish from the list provided.
Notice that you may also force a decision variable to be an integer or binary (i.e.,
either 0 or 1) using this window. We will use this feature later in the course.
After setting the inequality, move the cursor to the “Constraint” window.
Click on the cell you want to use as the constraining value for that constraint, or
type the number or the cell reference you want to use as the constraining value
for that constraint, or
type a number that you want to use as the constraining value.
You may define a set of like constraints (e.g., all <= constraints, or all >=
constraints) in one step if they are in adjacent rows (as was done here).
Simply select the range of cells for the set of constraints in both the “Cell
Reference” and “Constraint” window.
2-24
Some Important Options
.
Once you are satisfied with the optimization model you have input, there is one more very
important step. Click on the “Options” button in the Solver dialogue box, and click in both
the “Assume Linear Model” and the “Assume Non-Negative” box.
The Solution
After setting up the model, and selecting the appropriate options, it is
time to click “Solve”. When it is done, you will receive one of four
messages:
2-27
Properties of Linear Programming
Solutions
1. An optimal solution must lie on the boundary of the feasible region.
4. If an LP model has many optimal solutions, at least two of these optimal solutions are at
corner points.
Example #4 (Multiple Optimal
Solutions)
Maximize Z = 6x1 4x2
subject to
x1 4
x2
2x 2 12
10
3x1 2 x2 18
9
and 8
x1 0, x 2 0. 7
x1
1 2 3 4 5 6 7 8 9 10
Example #5 (No Feasible Solution)
Maximize Z = 3x1 5x 2
x2
subject to
x1 5 10
x2 4 9
3x1 2x 2 18 8
7
and
6
x1 0, x 2 0.
5
x1
1 2 3 4 5 6 7 8 9 10
Example #6 (Unbounded Solution)
Maximize Z = 5x1 12x2 x2
subject to
10
x1 5 9
2x1 x 2 2 8
and 7
x1 0, x 2 0. 6
x1
1 2 3 4 5 6 7 8 9 10
The Simplex Method
x1
1 2 3 4 5 6 7 8 9 10
Linear Programming
Formulations and
Applications
Steps in Formulating a Linear
Programming Problem
1. What decisions need to be made? Define the decision variables.
2. What is the goal of the problem? Write down the objective function.
3. What resources are in short supply and/or what requirements must be met?
Formulate the constraints.
Some Examples:
Product Mix
Diet / Blending
Scheduling
Transportation / Distribution
Assignment
A prison is trying to decide what to feed its prisoners. They would like to
offer some combination of milk, beans, and oranges. Their goal is to
minimize cost, subject to meeting the minimum nutritional requirements
imposed by law. The cost and nutritional content of each food, along with the
minimum nutritional requirements are shown below.
An airline reservations office is open to take reservations by telephone 24 hours per day,
Monday through Friday.The number of reservation agents needed for each time period is
shown below.
Number of
Time Period Officers Needed
12 a.m. - 4 a.m. 11
4 a.m. - 8 a.m. 15
8 a.m. - 12 p.m. 31
12 p.m. - 4 p.m. 17
4 p.m. - 8 p.m. 25
8 p.m. - 12 a.m. 19
Goal: Hire the minimum number of reservation agents needed to cover all shifts.
Spreadsheet Solution of LP Example #3
1 2 3
A $4 $6 $4
Plant
B $6 $5 $2
Question: How many units should be shipped from each plant to each
distribution center?
Spreadsheet Formulation
B C D E F G H
3 Distribution Distribution Distribution
4 Cost Center 1 Center 2 Center 3
5 Plant A $4 $6 $4
6 Plant B $6 $5 $2
7
8
9 Shipment Distribution Distribution Distribution
10 Quantities Center 1 Center 2 Center 3 Shipped Available
11 Plant A 40 20 0 60 <= 60
12 Plant B 0 20 40 60 <= 60
13 Shipped 40 40 40 Cost = $460
14 >= >= >=
15 Needed 40 40 40
Distribution System at Proctor and
Gamble
Proctor and Gamble needed to consolidate and re-design their North
American distribution system in the early 1990’s.
50 product categories
60 plants
15 distribution centers
1000 customer zones
Solved many transportation problems (one for each product category).
Goal: find best distribution plan, which plants to keep open, etc.
Closed many plants and distribution centers, and optimized their
product sourcing and distribution location.
Implemented in 1996. Saved $200 million per year.
For more details, see 1997 Jan-Feb Interfaces article, “Blending OR/MS,
Judgement, and GIS: Restructuring P&G’s Supply Chain”, downloadable
at www.mhhe.com/hillier2e/articles
LP Example #5 (Assignment
Problem)
The coach of a swim team needs to assign swimmers to a 200-yard medley
relay team (four swimmers, each swims 50 yards of one of the four
strokes). Since most of the best swimmers are very fast in more than one
stroke, it is not clear which swimmer should be assigned to each of the
four strokes. The five fastest swimmers and their best times (in seconds)
they have achieved in each of the strokes (for 50 yards) are shown below.
Question: How should the swimmers be assigned to make the fastest relay team?
Spreadsheet Formulation
B C D E F G H I
3 Best Times Backstroke Breastroke Butterfly Freestyle
4 Carl 37.7 43.4 33.3 29.2
5 Chris 32.9 33.1 28.5 26.4
6 David 33.8 42.2 38.9 29.6
7 Tony 37.0 34.7 30.4 28.5
8 Ken 35.4 41.8 33.6 31.1
9
10
11 Assignment Backstroke Breastroke Butterfly Freestyle
12 Carl 0 0 0 1 1 <= 1
13 Chris 0 0 1 0 1 <= 1
14 David 1 0 0 0 1 <= 1
15 Tony 0 1 0 0 1 <= 1
16 Ken 0 0 0 0 0 <= 1
17 1 1 1 1 Time = 126.2
18 = = = =
19 1 1 1 1
Football Problem
TE SE RT RG C LT LG QB FB TB FL
Bob 15 25 10 10 5 10 10 50 10 50 30
Bill 25 15 30 25 20 30 25 5 25 10 10
John 20 15 50 40 40 40 50 5 25 10 10
Frank 30 15 30 20 25 30 25 5 25 0 10
Dave 25 15 25 25 20 30 25 0 25 5 10
Ken 25 15 45 45 40 45 50 5 25 0 10
Tom 35 30 20 25 25 20 25 20 30 5 20
Jack 25 40 15 15 15 15 15 50 20 50 40
Art 30 35 15 15 15 15 15 40 20 40 45
Rick 25 25 5 10 10 5 10 45 20 45 40
Mike 20 25 5 5 5 5 5 35 10 25 25
TE SE RT RG C LT LG QB FB TB FL
Bob 0 0 0 0 0 0 0 0 0 1 0 1 = 1
Bill 0 0 1 0 0 0 0 0 0 0 0 1 = 1
John 0 0 0 0 0 0 1 0 0 0 0 1 = 1
Frank 0 0 0 0 1 0 0 0 0 0 0 1 = 1
Dave 0 0 0 0 0 1 0 0 0 0 0 1 = 1
Ken 0 0 0 1 0 0 0 0 0 0 0 1 = 1
Tom 0 0 0 0 0 0 0 0 1 0 0 1 = 1
Jack 0 1 0 0 0 0 0 0 0 0 0 1 = 1
Art 0 0 0 0 0 0 0 0 0 0 1 1 = 1
Rick 0 0 0 0 0 0 0 1 0 0 0 1 = 1
Mike 1 0 0 0 0 0 0 0 0 0 0 1 = 1
1 1 1 1 1 1 1 1 1 1 1
= = = = = = = = = = =
1 1 1 1 1 1 1 1 1 1 1
Think-Big Capital Budgeting Problem
Think-Big Development Co. is a major investor in commercial real-estate
development projects.
They are considering three large construction projects
Construct a high-rise office building.
Construct a hotel.
Construct a shopping center.
Each project requires each partner to make four investments: a down
payment now, and additional capital after one, two, and three years.
Assume for years 0 through 3 the firm has: $25MM, $45MM, $65MM, and $80MM available.
(cumulative)
Spreadsheet Formulation
B C D E F G H
3 Office Shopping
4 Building Hotel Center
5 Net Present Value 45 70 50
6 ($millions) Cumulative Cumulative
7 Capital Capital
8 Cumulative Capital Required ($millions) Spent Available
9 Now 40 80 90 25 <= 25
10 End of Year 1 100 160 140 44.757 <= 45
11 End of Year 2 190 240 160 60.583 <= 65
12 End of Year 3 200 310 220 80 <= 80
13
14 Office Shopping Total NPV
15 Building Hotel Center ($millions)
16 Participation Share 0.00% 16.50% 13.11% 18.11