simplex method msci331—week 3~4 1. simplex algorithm consider the following lp, solve using...
TRANSCRIPT
Simplex Method
MSci331—Week 3~4
1
Simplex Algorithm
• Consider the following LP, solve using Simplex:
2
1 2
1 2
1 2
1 2
1 2
3 2
. . 2 100
80
40
, 0
MAX Z x x
s t x x
x x
x x
x x
Step 1: Preparing the LP
3
Step 2: Express the LP in a tableau form
Z X1 X2 S1 S2 S3 RHS RatioRow 0 1 -3 -2 0 0 0 0 --Row 1 - 2 1 1 0 0 100Row 2 - 1 1 0 1 0 80Row 3 - 1 0 0 0 1 40
4
Step 3: Obtain the initial basic feasible solution (if available)
Z X1 X2 S1 S2 S3 RHS RatioRow 0 1 -3 -2 0 0 0 0 --Row 1 - 2 1 1 0 0 100Row 2 - 1 1 0 1 0 80Row 3 - 1 0 0 0 1 40
5
a) Set n-m variables equal to 0 These n-m variables the NBV
b) Check if the remaining m variables satisfy the condition of BV
= If yes, the initial feasible basic solution (bfs) is readily a available
= else, carry on some ERO to obtain the initial bfs
Step 4: Apply the Simplex Algorithm
Z X1 X2 S1 S2 S3 RHS RatioRow 0 1 -3 -2 0 0 0 0 --Row 1 - 2 1 1 0 0 100 100/2Row 2 - 1 1 0 1 0 80 80/1Row 3 - 1 0 0 0 1 40 40/1
6
a) Is the initial bfs optimal? (Will bringing a NBV improve the value of Z?)
b) If yes, which variable from the set of NBV to bring into the set of BV? - The entering NBV defines the pivot column
c) Which variable from the set of BV has to become NBV?
- The exiting BV defines the pivot rowPivot cell
Summary of Simplex Algorithm for Papa Louis
m≠0
Set: n-m=0
1
7
BFS (intial)
BFS (1)
BFS (2)
BFS (3)
The optimal solution is x1=20, x2=60 The optimal value is Z=180
The BFS at optimality x1=20, x2=60, s3=20
Geometric Interpretation of Simplex Algorithm
8
Class activity
• Consider the following LP:
9
This is a maximizing LP, in normal form. So an initial BFS exists.
Class activity
10
Class activity
11
Z x1 x2 s1 s2 s3 s4 RHS
1 -3 -3 0 0 0 0 100 -----1 1 1 0 0 0 41 2 0 1 0 0 62 -3 0 0 1 0 2-1 2 0 0 0 1 4
Class activity
12
Z x1 x2 s1 s2 s3 s4 RHS
1 -3 -3 0 0 0 0 100 -----1 1 1 0 0 0 41 2 0 1 0 0 62 -3 0 0 1 0 2-1 2 0 0 0 1 4
4/1
6/1
2/2*
---
Make this coefficient equal 1 and pivot all other rows relative to it
Class activity
13
Z x1 x2 s1 s2 s3 s4 RHS
1 -3 -3 0 0 0 0 100 -----1 1 1 0 0 0 41 2 0 1 0 0 61 -3/2 0 0 1/2 0 1-1 2 0 0 0 1 4
0 -7.5 0 0 3/2 0 103
0 2.5 1 0 -1/2 0 3
0 3.5 0 1 -1/2 0 5
0 1/2 0 0 1/2 1 5
Class activity
14
Z x1 x2 s1 s2 s3 s4 RHS
1 -3 -3 0 0 0 0 100 -----1 1 1 0 0 0 41 2 0 1 0 0 61 -3/2 0 0 1/2 0 1-1 2 0 0 0 1 4
0 -7.5 0 0 3/2 0 103
0 2.5 1 0 -1/2 0 3
0 3.5 0 1 -1/2 0 5
0 1/2 0 0 1/2 1 5
3/2.5*
5/3.5
---
5/0.5
Make this coefficient equal 1 and pivot all other rows relative to it
Class activity
15
Z x1 x2 s1 s2 s3 s4 RHS
1 -----0 -7.5 0 0 3/2 0 103
0 1 2/5 0 -1/5 0 6/5
0 3.5 0 1 -1/2 0 5
0 0 3 0 0 0 112
0 0 -1.4 1 1/5 0 0.8
1 -3/2 0 0 1/2 0 11 0 3/5 0 0.8 0 2.8
0 1/2 0 0 1/2 1 50 0 -1/5 0 0.6 1 4.4
Example: LP model with Minimization Objective
• Solve the following LP model:
• Initial Tableau
1 2
1 2
1 2
1 2
2 3
. .
4
6
, 0
Min z x x
s t
x x
x x
x x
Row Basic Variable Z x1 x2 s1 s2 RHS Ratio
test 0 -1 2 -3 0 0 0 1 s1 0 1 1 1 0 4 2 s2 0 1 -1 0 1 6
1 2
1 2
1 2
1 2
2 3
. .
4
6
, 0
MAX z x x
s t
x x
x x
x x
16
Example: LP model with Minimization Objective
• Iteration 0
• Iteration 1
• Optimality test:
Row Basic Variable Z x1 x2 s1 s2 RHS Ratio
test 0 -1 2 -3 0 0 0 1 s1 0 1 1 1 0 4 4 2 s2 0 1 -1 0 1 6 -
Row Basic Variable Z x1 x2 s1 s2 RHS Ratio
test 0 -1 5 0 3 0 12 1 x2 0 1 1 1 0 4 2 s2 0 2 0 1 1 10
1 112 5 3z x s
17
4040
3535
3030
2525
2020
1515
1010
55
5 10 15 20 25 30 35 40 5 10 15 20 25 30 35 40
> Constraint
1 2
1 2
1 2
1
1 2
Max 2 3
. .
5
3 35
20
, 0
Z x x
s t
x x
x x
x
x x
1 2
1 2
1 2
1 2
1
1 2
Max 2 3
. .
5
3 35
20
3.5
, 0
5 35x
Z x x
s t
x x
x x
x
x
x
x
xx11
xx22
Constraint 1
Constraint 2
Constraint 3
Z
New feasible regionConstraint 418
Equality Constraint
1 2
1 2
1 2
1
1 2
Max 2 3
. .
5
3 35
20
, 0
Z x x
s t
x x
x x
x
x x
1 2
1 2
1 2
1
1 2
Max 2 3
. .
5
3 35
20
, 0
Z x x
s t
x x
x x
x
x x
4040
3535
3030
2525
2020
1515
1010
55
5 10 15 20 25 30 35 40 5 10 15 20 25 30 35 40 xx11
xx22
Constraint 1
Constraint 2
Constraint 3
Z
New feasible region19
The Problem of Finding an Initial Feasible BV
1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
Max 2 3 4
. . 30
2 3 60
2 20
, , 0
Z x x x
s t x x x
x x x
x x x
x x x
An LP Model
Standard Form
1 2 3 1 2
1
2
1
1 2 3
1 2 3
1 2 3
1 2 23
Max 2 3 4 0 0
. . 30
2 3 60
2 20
, , , , 0
Z x x x
s t x x x
x x x
x x x
x x
s e
s
e
s ex
Cannot find an initial basic variable that is feasible.
20
Example: Solve Using the Big M Method
1 2 1
1 2 1
1 2 1
1 2 1
1 2 1
MAX 3
. . 5 25
3 3 4 2 12
0
, , , 0
x x y z
s t x x y z
x x y z
x x y z
x x y z
1 2 1
1 2 1
1 2 1
1
31 2 1
1 2 1 1 3
MAX 3
. . 5 25
3 3 4 2 12
0
, , , , , 0
x x y z
s t x x y z
x x y z
x x y z
x x y
e
e
s
z s
Write in standard form
21
Example: Solve Using the Big M Method
1 2 1
1 2 1
1 2 1
1
31 2 1
1 2 1 1 3
MAX 3
. . 5 25
3 3 4 2 12
0
, , , , , 0
x x y z
s t x x y z
x x y z
x x y z
x x y
e
e
s
z s
1 2 1 1 3 2 3
1 2 1
1 2 1
1 2 1
1 2 1 1 3 2
2
1
3
3
3
MAX 3 0 0
. . 5 25
3 3 4 2 12
0
, , , , , , , 0
x x y z s e Ma Ma
s t x x y z
x x y z
x x y z
x x y z s e a
ae
a
a
s
Adding artificial variables
22
Example: Solve Using the Big M Method
1 2 1 1 3 2 3
1 2 1
1 2 1
1 2 1
1 2 1 1 3 2
2
1
3
3
3
MAX 3 0 0
. . 5 25
3 3 4 2 12
0
, , , , , , , 0
x x y z s e Ma Ma
s t x x y z
x x y z
x x y z
x x y z s e a
ae
a
a
s
Put in tableau form
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3 1 1 1 0 M 0 M 0
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
23
Example: Solve Using the Big M Method
Eliminating a2 from row 0 by operations: new Row 0 = old Row 0 -M*old Row 2
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-3M 1+3M 1+4M 1-2M 0 0 0 M -12M
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3 1 1 1 0 M 0 M 0
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
24
Example: Solve Using the Big M Method
Eliminating a3 from the new row 0 by operations: new Row=old Row-M*old Row 3
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-3M 1+3M 1+4M 1-2M 0 0 0 M -12M
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-4M 1+4M 1+5M 1-M 0 0 M 0 -12M
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
25
Example: Solve Using the Big M Method
The initial basic variables are s1=25, a2=12, and a3=0. Now ready to proceed for the simplex algorithm.
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-4M 1+4M 1+5M 1-M 0 0 M 0 -12M
1s 1 0 1 -1 1 5 1 0 0 0 25
2a 2 0 3 -3 -4 2 0 1 0 0 12
3a 3 0 1 -1 -1 -1 0 0 -1 1 0
The initial Tableau
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-4M 1+4M 1+5M 1-M 0 0 M 0 -12M
1s 1 0 1 -1 1 5 1 0 0 0 25 25
2a 2 0 3 -3 -4 2 0 1 0 0 12 4
3a 3 0 1 -1 -1 -1 0 0 -1 1 0 0
26
Example: Solve Using the Big M Method
Using EROs change the column of x1 into a unity vector.
Iteration 1
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 -3-4M 1+4M 1+5M 1-M 0 0 M 0 -12M
1s 1 0 1 -1 1 5 1 0 0 0 25 25
2a 2 0 3 -3 -4 2 0 1 0 0 12 4
3a 3 0 1 -1 -1 -1 0 0 -1 1 0 0
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 0 -2 -2+M -2-5M 0 0 -3-3M -3+4M -12M
1s 1 0 0 0 2 7 1 0 1 -1 25 3.57
2a 2 0 0 0 -1 5 0 1 3 -3 12 2.4
1x 3 0 1 -1 -1 -1 0 0 -1 1 0 --
27
Example: Solve Using the Big M Method
Using EROs change the column of z into a unity vector.
Iteration 2
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 0 -2 -2+M -2-5M 0 0 -3-3M -3+4M -12M
1s 1 0 0 0 2 7 1 0 1 -1 25 3.57
2a 2 0 0 0 -1 5 0 1 3 -3 12 2.4
1x 3 0 1 -1 -1 -1 0 0 -1 1 0 --
Basic Row/Eq. no. Coefficient of RHS MRT
W 1x 2x 1y z 1s 2a 3e 3a
0 1 0 -2 -12/5 0 0 (2+5M)/5 -9/5 (-21/5)+M 4.8
1s 1 0 0 0 17/5 0 1 -7/5 -16/5 16/5 8.2 2.35 z 2 0 0 0 -1/5 1 0 1/5 3/5 -3/5 2.4 --
1x 3 0 1 -1 -6/5 0 0 1/5 --2/5 2/5 2.4 --
Students to try more iterations. The solution is infeasible. See the attached solution. 28
Special case 1: Alternative Optima
1 2
1 2
1 2
1 2
0.5
. . 2 4
2 3
, 0
Max z x x
s t x x
x x
x x
.
29See Notes on this slide (below) for more information
Special case 1: Alternative Optima1 2
1 2
1 2
1 2
0.5
. . 2 4
2 3
, 0
Max z x x
s t x x
x x
x x
30
Special case 2: Unbounded LPs1 2
1 2
1 2
MAX 2
. . 1
2 2
1, 2 0
z x x
s t x x
x x
x x
01
s1
x1
31See Notes on this slide (below) for more information
Special Case 3: Degeneracy
32
Special Case 5: Degeneracy
Iteration 0
Iteration 1
Iteration 2
33
Special Case 5: Degeneracy Degeneracy reveals from practical standpoint that the model has at least one redundant constraint.
34