Simplex Slides
Simplex Slides
Simplex Slides
3. For each row k (other than row i), add −akj × row i to row k.
The element in row k, column ` becomes −akj × ai` + ak` .
ai` ai`
... 1 ... aij
... ... 1 ... aij
...
... ... ... ... ... →
...
... ... ... ...
akj ai`
. . . akj . . . ak` . . . . . . 0 . . . ak` − aij
...
EMIS 3360: OR Models The Simplex Method 3
Pivoting Example 1
Suppose we want to solve the following the LP with the Simplex method:
maximize x + 2y
s.t. x + y ≤4
x − 2y ≤2
−2x + y ≤2
x, y ≥0
maximize x + 2y
s.t. x + y + s1 =4
x − 2y + s2 =2
−2x + y + s3 =2
x, y, s1 , s2 , s3 ≥0
EMIS 3360: OR Models The Simplex Method 4
Pivoting Example 1
BFS 1:
Basic variables: BV = {s1 , s2 , s3 }
Non-basic variables: N B = {x, y}
Solution: s1 = 4, s2 = 2, s3 = 2, x = y = 0
Objective function value: x + 2y = 0 + 0 = 0
EMIS 3360: OR Models The Simplex Method 5
Pivoting Example 1
Pivoting Example 1
3 1 3y s3
0 2 1 0 2 5 2 + s1 + 2 = 5
0 − 32 1
3 3y s3
0 1 2 ≡ − 2 + s2 + 2 = 3
y s3
1 − 12 0 0 − 12 −1 x − 2 − 2 = −1
BFS 2:
Pivoting Example 1
0 3 1 −1 0 2 3y + s1 − s2 = 2
1 2
−2 0 1 0 ≡ x − 2y + s2 = 2
0 −3 0 2 1 6 − 3y + 2s2 + s3 = 6
BFS 3:
Basic variables: BV = {x, s1 , s3 }
Non-basic variables: N B = {y, s2 }
Solution: x = 2, s1 = 2, s3 = 6, y = s2 = 0
Objective function value: x + 2y = 2 + 0 = 2
EMIS 3360: OR Models The Simplex Method 8
Pivoting Example 1
3 0 1 0 −1 2 3x + s1 − s3 = 2
−3 0 6
0 1 2 ≡ −3x + s2 + 2s3 = 6
−2 1 0 0 1 2 −2x + y + s3 = 2
BFS 4:
Basic variables: BV = {y, s1 , s2 }
Non-basic variables: N B = {x, s3 }
Solution: y = 2, s1 = 2, s2 = 6, x = s3 = 0
Objective function value: x + 2y = 0 + 4 = 4
EMIS 3360: OR Models The Simplex Method 9
Row-Zero Form of an LP
Standard form:
maximize x + 2y
s.t. x + y + s1 =4
x − 2y + s2 =2
−2x + y + s3 =2
x, y, s1 , s2 , s3 ≥0
Row-Zero form:
maximize z
s.t. z − x − 2y =0
x + y + s1 =4
x − 2y + s2 =2
−2x + y + s3 =2
x, y, s1 , s2 , s3 ≥0
EMIS 3360: OR Models The Simplex Method 10
Row-Zero form:
maximize z
s.t. z − x − 2y =0
x + y + s1 =4
x − 2y + s2 =2
− 2x + y + s3 =2
x, y, s1 , s2 , s3 ≥0
Row-Zero form:
maximize z
s.t. z − x − 2y =0
x + y + s1 =4
x − 2y + s2 =2
− 2x + y + s3 =2
x, y, s1 , s2 , s3 ≥0
Augmented Matrix:
1 −1 −2 0 0 0 0
0 1 1 1 0 0 4
0 1 −2 0 1 0 2
0 −2 1 0 0 1 2
EMIS 3360: OR Models The Simplex Method 13
1 −5 0 0 0 2 4 z − 5x + 2s3 = 4
0 3 0 1 0 −1 2 3x + s1 − s3 = 2
≡
0 −3 0 0 1 2 6 −3x + s2 + 2s3 = 6
0 −2 1 0 0 1 2 −2x + y + s3 = 2
EMIS 3360: OR Models The Simplex Method 16
z x y s1 s2 s3
1 −5 0 0 0 2 4 (z)
0 3 0 1 0 −1 2 (s1 )
0 −3 0 0 1 2 6 (s2 )
0 −2 1 0 0 1 2 (y)
5 1 22
1 −5 0 0 0 2 4 1 0 0 3
0 3 3
0 3 0 1 0 −1 2 0 1 0 1
0 − 13 2
3 3
→
0 −3 0 0 1 2 6 0 0 0 1 1 1 8
2 1 10
0 −2 1 0 0 1 2 0 0 1 3
0 3 3
5 1 22
1 0 0 3
0 3 3 z + 35 s1 + 13 s3 = 22
3
0 1 0 1
0 − 31 2 x + 13 s1 − 13 s3 = 2
3 3 3
0 0 0
≡
1 1 1 8
s1 + s2 + s3 = 8
2 1 10
0 0 1 3
0 3 3
y + 23 s1 + 13 s3 = 10
3
EMIS 3360: OR Models The Simplex Method 20
max z
s.t. z + 53 s1 + 13 s3 = 22
3
x + 13 s1 − 13 s3 = 2
3
s1 + s2 + s3 = 8
y + 23 s1 + 13 s3 = 10
3
x, y, s1 , s2 , s3 ≥ 0
The BFS z = 22
3 , x = 2
3, y =
10
3, s2 = 8, s1 = s3 = 0 is
optimal. Why?