Example Simplex Algorithm Run
Example Simplex Algorithm Run
x1 +x2 3
x1 +3x2 1
+x2 3
x1 +x2 =z
We assume:
2
Slack variables
We re-write into a system of equations by introducing non-negative
slack variables:
x1 +x2 +x3 = 3
x1 +3x2 +x4 = 1
+x2 +x5 = 3
x1 +x2 =z
3
Tableau
Re-write to put the non-zero values on the left-hand side:
x3 =3 x1 x2
x4 = 1 +x1 3x2
x5 =3 x2
z = 0 +x1 +x2
4
Tableau
Re-write to put the non-zero values on the left-hand side:
x3 =3 x1 x2
x4 = 1 +x1 3x2
x5 =3 x2
z = 0 +x1 +x2
4
Entering variable
x2 is called the entering variable (we’ll see why in a minute)
5
Entering variable
x2 is called the entering variable (we’ll see why in a minute)
3 x2 0 =) x2 3 (1)
1 3x2 0 =) x2 1/3 (2)
3 x2 0 =) x2 3 (3)
5
The leaving variable
Look at the strictest constraint now:
7
Pivots
x4 was the leaving variable.
x1 (8/3)/(4/3) = 2 (4)
x1 (1/3)/( 1/3) = 1 (5)
x1 (8/3)/(1/3) = 8 (6)
8
Note
9
Simplex Algorithm In General
10
Schematic of a pivot
values of basic
variables in
current solution
Basic
variables
p1 +
xi = p2 -
candidate
p3 + leaving
variables
xj = p4 -
p5 +
z= obj +
objective value candidate
of current entering
solution variable
11
Special cases
12
What if there are multiple choices for the entering
variable?
Choose according to some pivot rule:
~c T (~xnew ~xold )
||~xnew ~xold ||
I Bland’s rule — choose the entering variable with the lowest index
(and the corresponding leaving variable with the lowest index as
well). [Important theoretically, but not used much in practice.]
13
How do we know this process will terminate?
14
How do we know it’s optimal?
z = 24 5x1 3x3
15
Initialization
We made one implicit assumption in the discussion above: that
initially setting the non-slack variables to 0 would give us a feasible
solution.
x3 = 3 x1 x2
x4 = 1 +x1 3x2
x5 = 3 x2
z = 0 +x1 +x2
16
Auxiliary Problem
Suppose we have LP:
n
X
maximize cj xj
j=1
n
X
s.t. aij xj bi i = 1, . . . , m
j=1
xj 0 j = 1, . . . , n
maximize x0
n
X
s.t. aij xj x0 bi i = 1, . . . , m
j=1
xj 0 j = 0, . . . , n
17
maximize x0
n
X
s.t. aij xj x0 bi i = 1, . . . , m
j=1
xj 0 j = 0, . . . , n
Setting xj = 0 for j 1 and x0 really big will give us a feasible solution to this
problem.
The original problem had a solution () its auxiliary problem has an optimal
solution of objective = 0.
Write the tableau for this problem as usual (introducing slack variables) — but
it still won’t be feasible.
18
Auxiliary Tableau
The original b vector All +1 coeff. b/c
(which includes some original equations
negative entries) all had -1x0
w1 =
+A +1x0
w2 =
The slack -B +1x0
variables w3 =
+C +1x0
w4 = -D +1x0
+1x0
w5 = +E
z= -x0
This will add B to every constant term =) all the constant terms become
positive (since B was the most negative).
19
Initialization Summary
3. Solve the auxiliary problem from this starting point using the
normal simplex method.
4. If original problem was feasible, will find solution with x0 = 0
for auxiliary problem.
5. Drop the x0 equation and the variables x0 from the other
equations (ok since they are 0).
6. Put back the original objective function.
7. Continue to apply simplex method.
20
Summary
21