Lecture 2 - LP Basics1
Lecture 2 - LP Basics1
604
Deterministic Optimization:
Models & Methods
Ali A. Yassine, Ph.D.
Engineering Management Program
American University of Beirut
[email protected]
LP Intro. & Graphical Solution
– Optimization Basics
– Geometry of LPs illustrated on GTC
– Graphical Sensitivity Analysis
– Excel Solution
1
Deterministic models
- Assume all data are known with certainty
- Involve optimization
Stochastic models
- explicitly represent uncertain data via random
variables or stochastic processes.
- characterize / estimate system performance.
Mathematical Program
Xj ≥ 0 j = 1,…,n
2
• xj are called decision variables. These are things that
you control.
• g i (x 1 ,x 2 ,…, x n )
{} ≤
≥
=
b i are called structural
Linear Programming
Linear Program:
Maximize/minimize z = c 1 x 1 + c 2 x 2 + • • • + cnxn
Subject to a i1 x 1 + a i2 x 2 + …+ a in x n
{}≤
≥
=
bi , i = 1,…,m
x j ≤ u j, j = 1,…,n
xj ≥ 0, j = 1,…,n
3
(i) activity j’s contribution to obj fcn is c jx j
usage in constraint i a ij x j
both are proportional to the level of activity j
1
(ii) no "cross terms", e.g., x x
2 1 5 , may not appear in
the objective or constraints.
4
Data for the GTC Problem
In order to formulate this problem
as an LP:
1.Define the Decision Variables (DVs) that we seek to determine
2. Build the Objective Function (OF), which the goal that we seek
to optimize
5
( )
x1
.
.
.
• A feasible solution x = satisfies the
xn
constraints (both structural and non-negativity)
Formulating the GTC Problem
P = number of pliers manufactured
W = number of wrenches manufactured
Maximize Profit = .4 W + .3 P
6
Reformulation
P = number of 1000s of pliers manufactured
W = number of 1000s of wrenches manufactured
Maximize Profit = 400 W + 300 P
Steel: 1.5 W + P ≤ 15
Molding: W + P ≤ 12
Assembly: 0.4 W + 0.5 P ≤ 5
Wrench Demand: W ≤ 8
Pliers Demand: P ≤ 10
Non-negativity: P,W ≥ 0
Characteristics of Solutions to LPs
A Graphical Solution Procedure (LP’s with 2 decision variables
can be solved/viewed this way.)
7
Graphing the Feasible Region
P
We will construct and shade
14
W
2 4 6 8 10 12 14
Graphing the Feasible Region
P
14
12
1.5 W + P ≤ 15
8
6
4
2
W
2 4 6 8 10 12 14
8
Graphing the Feasible Region
P
14
12
10
W
2 4 6 8 10 12 14
Graphing the Feasible Region
P
14
12
0.4 W + 0.5 P ≤ 5
8
constraint :
4
W + P ≤ 12?
2
W
2 4 6 8 10 12 14
9
Graphing the Feasible Region
P
14
12
10
8
W ≤ 8
4
P ≤ 10
2
W
2 4 6 8 10 12 14
How do we find an optimal solution?
P
14
12
feasible solution
2
W
2 4 6 8 10 12 14
10
How do we find an optimal solution?
P
14
12
z=1200
2
W
2 4 6 8 10 12 14
Is there a feasible
z=3600 solution with z = 2400?
8
z =2400
6
Is there a feasible
4
W
2 4 6 8 10 12 14
11
How do we find an optimal solution?
P
14
z = 2400
4
2
W
2 4 6 8 10 12 14
vector? W = ? P = ?
6
z = ?
2
W
2 4 6 8 10 12 14
12
Optimal Solution Structure
P Binding constraints
Maximize z = 400W + 300P
1.5 W + P ≤ 15
14
.4W + .5P ≤ 5
12
optimum solution.
4
W
2 4 6 8 10 12 14
How do we find an optimal solution?
Optimal solutions occur at
P corner points. In two
dimensions, this is the
intersection of 2 lines.
14
1.5W + P = 15
10
.4W + .5P = 5
8
Solution:
6
.7W = 5, W = 50/7
4
P = 15 - 75/7 = 30/7
z = 29,000/7 = 4,142 6/7
2
W
2 4 6 8 10 12 14
13
Finding an optimal solution in
two dimensions: Summary
• The optimal solution (if one exists) occurs at a “corner point” of
the feasible region.
• In two dimensions with all inequality constraints, a corner point
is a solution at which two (or more) constraints are binding.
• There is always an optimal solution that is a corner point
solution (if a feasible solution exists).
• More than one solution may be optimal in some situations
Possible Outcomes of an LP
14
x2
Maximize z = x1 + x2
4 subject to 3x1 + x2 ≥ 6
3 3x1 + x2 ≤ 3
2
x1 ≥ 0, x2 ≥ 0
1
x1 –4 –3 –2 –1 0 Maximize z = x1 + x2
0
–1 subject to x1 – 2x2 ≥ 0
–2
–x1 +x2 ≥ 1
–3
x1 ≥ 0, x2 ≥ 0
–4
x2
Figure 11. Constraint system allowing only nonpositive values for x1 and x2
x2
z1 z2 z3
Maximize z = 3x1 – x2
4
subject to 15x1 – 5x2 ≤ 30
3
10x1 + 30x2 ≤ 120
2
x1 ≥ 0, x2 ≥ 0
1
x2 z3
z2 Maximize z = –x1 + x2
z1
4
subject to –x1 + 4x2 ≤ 10
3
–3x1 + 2x2 ≤ 2
2
x1 ≥ 0, x2 ≥ 0
1
0
0 1 2 3 4 x1 Figure 7. Bounded objective function with an unbounded feasible region
15
Preview of the Simplex Algorithm
• In n dimensions, one cannot evaluate the
solution value of every extreme point
efficiently. (There are too many.)
• The simplex method finds the best solution by
a neighborhood search technique.
• Two feasible corner points are said to be
“adjacent” if they have one binding constraint
in common.
Preview of the Simplex Method
P
14
objective value.
2
W
2 4 6 8 10 12 14
16
Sensitivity Analysis
The study of the sensitivity of the optimal solution to changes in
model parameters.
Sensitivity Analysis
P Suppose the pliers What is the impact on
demand is decreased the optimal solution
to 10 - Δ. value?
14
12
W
2 4 6 8 10 12 14
17
Preview of Sensitivity Analysis
P
Suppose slightly more steel is
14
available? 1.5W + P ≤ 15 + Δ
12
10
solution value?
6
4
2
W
2 4 6 8 10 12 14
Shifting a Constraint
P
5 Steel is increased to 15 + Δ.
What happens to the
optimal solution?
What happens to the
4 optimal solution value?
3 W
6 7 8
18
Shifting a Constraint
P
5 Steel is increased to 15 +Δ.
What happens to the
optimal solution?
What happens to the
4 optimal solution value?
3 W
6 7 8
Finding the New Optimum Solution
Maximize z = 400W + 300P
Binding 1.5W + P = 15 + Δ
Constraints: .4W + .5P = 5
W = 50/7 +(10/7)Δ
Solution: P= 30/7 -8/7Δ
z = 29,000/7 +(1,600/7)Δ
19
Some Questions on Shadow Prices
• Suppose the amount of steel was decreased by Δ units. What is
the impact on the optimum objective value?
• How large can the increase in steel availability be so that the
shadow price remains as 228 4/7?
• Suppose that steel becomes available at $1200 per ton. Should
you purchase the steel?
• Suppose that you could purchase 1 ton of steel for $450.
Should you purchase the steel? (Assume here that this is the
correct market value for steel.)
Bounds on RHS coefficients in
Sensitivity Analysis
• Recall that the optimum solution is a corner
point, which in 2 dimensions is the solution of
2 equations in 2 variables, and the equations
are the binding constraints.
• Compute the largest changes in the RHS
coefficient so that all constraints remain
satisfied.
20
Shifting a Constraint
GTC
P
5 Steel is increased to 15 + Δ.
What happens to the
optimal solution?
Recall that W <= 8.
4
The structure of the
optimum solution
changes when Δ = .6, and
W is increased to 8
3 W
6 7 8
Changing the RHS coefficient
Increase steel from 15 to 15 + Δ
1.5 W + P ≤ 15
= 15 + Δ Binding Constraint
W + P ≤ 12
≤
0.4 W + 0.5 P = 5 Binding Constraint
W ≤ 8
P ≤ 10
P,W ≥ 0
21
Changing the RHS coefficient
Compute changes in the LHS of remaining constraints
1.5 W + P = 15 + Δ
W + P ≤ 80/7 + (2/7)Δ ≤ 12
= 12
0.4 W + 0.5 P ≤
= 5
W ≤
= 50/7
8 + (10/7)Δ ≤ 8
P =≤ 1030/7 – (8/7)Δ ≤ 10
50/7 +(10/7)P,W ≥ 030/7 –(8/7)Δ ≥ 0
Δ ≥ 0;
Changing the RHS coefficient
Compute upper and lower bounds on Δ
1.5 W + P = 15 + Δ
80/7 + (2/7)Δ ≤ 12 Δ≤ 2
≤
0.4 W + 0.5 P = 5
50/7W+ (10/7)Δ ≤ ≤ 8 8 Δ ≤ 3/5
30/7 – (8/7)Δ P≤ ≤1010 Δ ≥ -5
50/7 +(10/7)P,W 0
Δ ≥ ≥0; Δ ≥ -5
30/7 –(8/7)Δ ≥ 0 Δ ≤ 15/4
So, -5 ≤ Δ ≤ 3/5
22
Summary for changes in RHS coefficients
• Determine the binding constraints
• Determine the change in the “corner point solution” as a
function of Δ.
• Compute the largest and smallest values of Δ so that the
solution stays feasible.
• The shadow price is valid so long as the “corner point
solution” remains optimal, which is so long as it is feasible.
• If there are three binding constraints, then choose two of
these to get the two equations to solve, and the technique
still works. (But the change in the solution as a function of
Δ depends on which two constraints are chosen.)
Bounds on Cost coefficients in
Sensitivity Analysis
• Recall that the optimum solution is a corner point, which in 2
dimensions is the solution of 2 equations in 2 variables, and
the equations are the binding constraints.
• The solution has two neighboring corner point solutions
• Compute the largest changes in the cost coefficient so that
the current corner point solution has a better objective value
than its neighboring corner point solutions.
23
Shifting a Cost Coefficient
The objective is:
P
Maximize z = 400W + 300P
10
.4W + .5P = 5
W
2 4 6 8 10
GTC
Determining Bounds on Cost Coefficients
z = 400W + (300+δ) P
P W = 0; P= 10;
z = 3000 + 10 δ
10
8
W = 50/7; P= 30/7;
6
z = 29,000/7 + 30 δ /7
4
W = 8; P= 3;
2
z = 4100 + 3 δ
W
2 4 6 8 10
24
Determining Bounds on z = 29,000/7 + 30 δ /7
Cost Coefficients ≥ 4100 + 3 δ Î
δ ≥ -100/3
P W = 0; P= 10; z = 29,000/7 + 30 δ /7
z = 3000 + 10 δ ≥ 3000 + 10 δ Î
10
δ ≤ 200
8
W = 50/7; P= 30/7;
6
z = 29,000/7 + 30 δ /7
4
W = 8; P= 3;
2
z = 4100 + 3 δ
W
2 4 6 8 10
Summary: 2D Geometry helps
guide the intuition
• The Geometry of the Feasible Region
– Graphing the constraints
• Finding an optimal solution
– Graphical method
– Searching all the extreme points
– Simplex Method
• Sensitivity Analysis
– Changing the RHS
– Changing the Cost Coefficients
25
How to solve LPs using Excel Solver
26
27
Computations with Excel Add-ins
Math Programming Add-in
Where?
Download from:
www.ormm.net
28
Available ORMM Add-ins
29
Sensitivity Analysis
MSR Marketing Inc.
adapted from Frontline Systems
Max # of ads 20 15 10 15
30
Formulating as a math model
Work with your partner
1. The decisions are how many ads of each type
to choose. Let x1 be the number of TV ads
selected. Let x2, x3, x4 denote the number of
radio, mail, and newspaper ads. These are
the “decision variables.”
2. What is the objective? Express the objective
in terms of the decision variables.
3. What are the constraints? Express these in
terms of the decision variables.
4. If you have time, try to find the best solution.
The MSR Marketing Problem
subject to 50 x1 + 25 x2 + 20 x3 + 15 x4 ≥ 1,500
0 ≤ x1 ≤ 20
0 ≤ x2 ≤ 15
0 ≤ x3 ≤ 10
0 ≤ x4 ≤ 15
MSR Marketing
31
The pigskin problem
• Pigskin company makes footballs
• All data below is for 1000s of footballs
• Forecast demand for next 6 months
– 10, 15, 30, 35, 25 and 10
• Current inventory of footballs: 5
• Determine the production levels and inventory levels over
the next six months
– meet demand at minimum cost
– satisfy constraints
The pigskin problem (continued)
• Max Production capacity: 30 per month
• Max Storage capacity: 10 per month
• Production Cost per football for next 6 months:
– $12.50, $12.55, $12.70, $12.80, $12.85, $12.95
• Holding cost: $.60 per football per month
• With your partner: write an LP to describe the problem.
32
On the formulation
• Choose decision variables.
– Let xj = the number of footballs produced in
month j (in 1000s)
– Let yj = the number of footballs held in
inventory from month j to month j + 1.
(in 1000s)
– y0 = 5
• Then write the constraints and the
objective.
Pigskin Spreadsheet
33