Week 11 MMW
Week 11 MMW
In the classes we will focus on the manual application of the simplex algorithm (using
EXCEL), although computer packages to apply the simplex algorithm have been
developed (LINDO and LINGO)
Simplex Method
Formulation
Simplex Method - Formulation
In LP problem, the decision maker
usually wants to:
Poets’ Problem
maximize (usually revenue or profit)
mminimize (usually costs)
1st - transform all inequalities into equalities by introducing one additional variable to
each constraint (the slack variables: S1, S2, S3).
Original form: Standard or augmented form:
1st - transform all inequalities into equalities by introducing one additional variable to
each constraint (the slack variables: S1, S2, S3).
2nd - transform the objective function into an additional constraint
Max: Z = 90 x1 + 120 x2
Z - 90 x1 - 120 x2 = 0
Subject to:
x1 + S1 = 40
x1 + S1 = 40
x2 + S2 = 50
x2 + S2 = 50
2x1 + 3x2 + S3 = 180
2x1 + 3x2 + S3 = 180
Simplex Method - Formulation
The Simplex algorithm is an algebraic procedure to solve LP problems based on geometric
concepts that must be translated into algebraic language to allow solving systems of equations.
1st - transform all inequalities into equalities by introducing one additional variable to each
constraint (the slack variables: S1, S2, S3).
2nd - transform the objective function into an additional constraint
3rd - build the Simplex tabular form where only the essential information is recorded
Z - 90 x1 - 120 x2 = 0
x1 + S1 = 40
x2 + S2 = 50
2x1 + 3x2 + S3 = 180
Simplex Method - Formulation
The Simplex algorithm is an algebraic procedure to solve LP problems based on geometric
concepts that must be translated into algebraic language to allow solving systems of equations.
1st - transform all inequalities into equalities by introducing one additional variable to each
constraint (the slack variables: S1, S2, S3).
2nd - transform the objective function into an additional constraint
3rd - build the Simplex tabular form where only the essential information is recorded
Each basic feasible solution has basic or
non-basic variables
- non-basic variables are set to ZERO
- basic variables are directly obtained from
the table
Non-basic Basic initialize the procedure setting x1 = x2 = 0
variables variables (X1, X2, S1, S2, S3 ) =( 0, 0, 40, 50, 180)
Simplex Method - Graphical analysis
• The Simplex algorithm is a search procedure that:
- shifts through the set of basic feasible solutions, one at a time, until the
optimal basic feasible solution (whenever it exists) is identified.
Optimality check:
The current BFS is optimal (in No Find another feasible solution
a max LP) if every coefficient
in Row 0 is ≥ 0. Entering variable: Choose the entering variable (in a max problem) to be
the NBV with the most negative coefficient in Row 0. Ties may be broken
Yes
in an arbitrary fashion.
Leaving BV: apply minimum ratio test - identify the row with the smallest
ratio RHS /aij (the most restrictive Row); the BV for this row is the leaving
BV (it becomes nonbasic).
Apply Gauss-Jordan elimination procedure to solve the system of linear
equations.
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 -120 0 0 0 0 -120 -> 0
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 3 0 0 1 180 3 -> 0
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 0 0 120 0 6000
R1 S1 0 1 0 1 0 0 40
R2 x2 0 0 1 0 1 0 50
R3 S3 0 2 0 0 -3 1 30
0 2 0 0 -3 1 30
Simplex Method - Procedure
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 0 0 120 0 6000
Z = 6000 X1 = 0
R1 S1 0 1 0 1 0 0 40 S1 = 40 S2 = 0
R2 x2 0 0 1 0 1 0 50 X2 = 50
R3 S3 0 2 0 0 -3 1 30 S3 = 30
(x1, x2) = (0,50) (x1, x2, S1, S2, S3) = (0, 50, 40, 0, 30)
X1 = 0 Plant 0 ha of pine
X2 = 50 Plant 50 ha of eucalypt
S1 = 40 40 ha of area available for pine plant.
S2 = 0 no ha of area available for eucalypt plant.
S3 = 30 30 working hours still available
Simplex Method - Procedure
(x1, x2) = (0,0) (x1, x2, S1, S2, S3) = (0, 0, 40, 50, 180)
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 0 0 120 0 6000
Z = 6000 X1 = 0
R1 S1 0 1 0 1 0 0 40 S1 = 40 S2 = 0
R2 x2 0 0 1 0 1 0 50 X2 = 50
R3 S3 0 2 0 0 -3 1 30 S3 = 30
(x1, x2) = (0,50) (x1, x2, S1, S2, S3) = (0, 50, 40, 0, 30)
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 0 0 120 0 6000
Z = 6000 X1 = 0
R1 S1 0 1 0 1 0 0 40 S1 = 40 S2 = 0
R2 x2 0 0 1 0 1 0 50 X2 = 50
R3 S3 0 2 0 0 -3 1 30 S3 = 30
(x1, x2) = (0,50) (x1, x2, S1, S2, S3) = (0, 50, 40, 0, 30)
B= (0,50) C= (15,50)
D= (40,33)
A= (0,0) E= (40,0)
Optimality check:
Simplex Method - Procedure
The current BFS is optimal (in
a max LP) if every coefficient
in Row 0 is ≥ 0.
Row
coefficients of: X1 will become basic
basic var. Z x1 x2 S1 S2 S3 right side ratio S3 will become non-basic variable
R0 Z 1 -90 0 0 120 0 6000
R1 S1 0 1 0 1 0 0 40 40/1= 40
(X1 column will have to take the
shape of S3: (0, 0, 0, 1)
R2 x2 0 0 1 0 1 0 50 -
R3 S3 0 2 0 0 -3 1 30 30/2= 15
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side ratio
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -90 0 0 120 0 6000
-90 -> 0
R1 S1 0 1 0 1 0 0 40 1 -> 0
R2 x2 0 0 1 0 1 0 50
R3 x1 0 1 0 0 -1.5 0.5 15
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 0 0 0 -15 45 7350
Z = 7350 S2 = 0
R1 S1 0 0 0 1 1.5 -0.5 25 S1 = 25 S3 = 0
R2 x2 0 0 1 0 1 0 50 X2 = 50
R3 x1 0 1 0 0 -1.5 0.5 15 x1 = 15
(x1, x2) = (0,0) (x1, x2, S1, S2, S3) = (0, 0, 40, 50, 180) z=0 (A)
(x1, x2) = (0,50) (x1, x2, S1, S2, S3) = (0, 50, 40, 0, 30) z=6000 (B)
(x1, x2) = (15,50) (x1, x2, S1, S2, S3) = (15, 50, 25, 0, 0) z=7350 (C)
B= (0,50) C= (15,50)
X1 = 15 Planted 15 ha of pine
X2 = 50 Planted 50 ha of eucalypt
S1 = 25 25 ha of area available for pine plant.
D= (40,33)
S2 = 0 no ha of area available for eucalypt plant.
S3 = 0 no working hours available
A= (0,0) E= (40,0)
Optimality check:
Simplex Method - Procedure
The current BFS is optimal (in
a max LP) if every coefficient
in Row 0 is ≥ 0.
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side ratio
R0 Z 1 0 0 0 -15 45 7350
R1 S1 0 0 0 1 1.5 -0.5 25 25/1.5= 17
R2 x2 0 0 1 0 1 0 50 -
R3 x1 0 1 0 0 -1.5 0.5 15 15/-1.5= -10
S2 will become basic Entering variable: the most negative coefficient in Row 0
S1 will become non-basic variable Leaving BV: the smallest positive ratio RHS /aij
coefficients of:
Row S2 will become basic
basic var. Z x1 x2 S1 S2 S3 right side
S1 will become non-basic
R0 Z 1 0 0 0 -15 45 7350
variable
R1 S2 0 0 0 0.67 1 -0.33 16.67
R2 x2 0 0 1 0 1 0 50 (S2 column will have to take
R3 x1 0 1 0 0 -1.5 0.5 15 the shape of S1: (0, 1, 0, 0)
X1 = 40 Planted 40 ha of pine
X2 = 33.33 Planted 33.33 ha of eucalypt
S1 = 0 0 ha of area available for pine plant. D= (40,33)
S2 = 16.67 16.67 ha of area available for eucalypt plant.
S3 = 0 no working hours available A= (0,0) E= (40,0)
Simplex Method – Graphical approach
Graphical Method Simplex Method
to draw a line that cuts the plane into 2 half-planes) Test different combinations of basic variables
Find which half-plane satisfies the inequality • Select the non-basic var. that results in a bigger increase in Z (the
smallest coefficient in R0)
Intercept all the half-plane areas to find the feasible • Select the basic var. that guarantees the biggest increase in Z
region (FR) – feasible solutions = (x1, x2) corners without leaving the feasible region and that all basic variables are
nonnegative (smallest positive ratio)
Draw iso-lines for the objective function to find the
• Gaussian elimination so that the new basic var. only has: 0,1
optimal solution: (x1, x2) corner point of the FR • Test optimality: all coeff. in R0 >=0? If not, test new combination
Simplex Method
Particular cases
Simplex Method – Particular cases
• Tie for the Entering BV:
– Entering variable: Choose the entering variable (in a max problem) to be the
NBV with the most negative coefficient in Row 0.
– What to do when there is a tie for the entering basic variable ? Selection
made arbitrarily.
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 -3 -3 0 0 0 0
R1 S1 0 1 0 1 0 0 4
R2 S2 0 0 2 0 1 0 12
R3 S3 0 3 2 0 0 1 18
Simplex Method – Particular cases
• Tie for the Leaving BV - Degenerate:
– Leaving BV: apply minimum ratio test - identify the row with the smallest
positive ratio bi /aij (the most restrictive Row); the BV for this row is the leaving
BV (it becomes nonbasic).
- Choose the leaving Row
basic var. Z x1 x2
coefficients of:
S1 S2 S3 S4
right
side
variable arbitrary R0 Z 1 -3 -4 0 0 0 0 0
R1 S1 0 1 1 1 0 0 0 10 10 / 1 = 10
- basic variables with a R2 S2 0 2 3 0 1 0 0 18 18 / 3 = 6
R3 S3 0 1 0 0 0 1 0 8 -
value of zero are called R4 S4 0 0 1 0 0 0 1 6 6/1= 6
degenerate R0 Z 1 -3 0 0 0 0 4 24
R1 S1 0 1 0 1 0 0 -1 4
- continue the Simplex R2 S2 0 2 0 0 1 0 -3 0
R3 S3 0 1 0 0 0 1 0 8
procedure until R4 X2 0 0 1 0 0 0 1 6
optimality is reached
Simplex Method – Particular cases
• No leaving BV – Unbounded Z:
Occurs if all the coefficients in the pivot column (where the entering basic variable is) are either
negative or zero (excluding row 0)
No solution – when the constraints do not prevent improving the objective function indefinitely
coefficients of:
Row
basic var. Z x1 x2 S1 S2 S3 right side
R0 Z 1 0 -1 1 0 0 10
R1 x1 0 1 0 1 0 0 10 -
R2 S2 0 0 -3 -1 1 0 5 5 / -3 <0
R3 S3 0 0 -1 -1 0 1 10 10/ -1 <0
Simplex Method – Particular cases
• Multiple optimal solutions:
When a NBV has a zero coefficient in coefficients of:
row 0, then we perform one more Row
basic var. Z x1 x2 S1 S2 S3 right side
iteration to identify the other optimal R0 Z 1 -3 -2 0 0 0 0
R1 X1 0 1 0 1 0 0 4
BF solution. R2 S2 0 0 2 0 1 0 12
R3 S3 0 3 2 0 0 1 18
R0 Z 1 0 -2 3 0 0 12
R1 X1 0 1 0 1 0 0 4 -
R2 S2 0 0 2 0 1 0 12 12 / 2 = 6
R3 S3 0 0 2 -3 0 1 6 6/2= 3
R0 Z 1 0 0 0 0 1 18
R1 X1 0 1 0 1 0 0 4 4/1= 4
R2 S2 0 0 0 3 1 -1 6 6/3= 2
R3 X2 0 0 1 -1.5 0 0.5 3 -
R0 Z 1 0 0 0 0 1 18
R1 X1 0 1 0 0 0 0 2
R2 S1 0 0 0 1 0.33 -0.33 2
R3 X2 0 0 1 0 1 0 6
Simplex Method
Other cases
To be continued
Simplex Method
Exercises
Simplex Method - exercises
• 1) A company produces 3 different products: A, B and C. Each product has to go under 3
processes consuming different amounts of time along the way. The time available for
each process is described in the table below.
Number of hours needed to produce each
Process Total number of product
hours available
A B C
I 12000 5 2 4
II 24000 4 5 6
III 18000 3 5 4
Assuming the selling profits for products A, B and C are 2, 3 and 4€ per unit. Determine
how many units of each product should be produced to maximize the profit.
Was there any time left?
Simplex Method - exercises
• 2) A company produces 3 diferente bookshelves: a luxury, a regular and na exportation
model. Consider the maximum demand for each model to be 500, 750 and 400
respectively. The working hours at the carpentry and finishing sections have the working
time limitations below: Section Total Number of hours needed to produce each
number of model
hours luxury regular exportation
(thousands)
• 8) Max: Z = - x2
Subject to:
Bring the following PL problems to standard form and apply the
x1 + x2 + x3 ≤ 100 Simplex to find the optimal solution
x1 - 5 x2 ≤ 40
x3 ≥ -10
Minimization, negative RHS, negative and unbounded variables
and x1 ≥ 0 x2 ≤ 0 x3 unbounded
Simplex Method - exercises
• 9) Min: Z = 4 x1 + 2 x2 • 10) Max: Z = x1 + 2 x2
Subject to: 2 x1 - x2 ≥ 4 Subject to: x1 + x2 ≤ 10
x 1 + x2 ≥ 5 x 1 - 2 x2 ≥ 6
x1, x2 ≥ 0 x1, x2 ≥ 0