Chapter Five Simplex Method
Chapter Five Simplex Method
CHAPTER FIVE
1
6s-2 Linear Programming
Simplex Method
Simplex: a linear-programming algorithm that can solve
problems having more than two decision variables.
The simplex technique involves generating a series of
solutions in tabular form, called tableaus. By inspecting
the bottom row of each tableau, one can immediately tell
if it represents the optimal solution. Each tableau
corresponds to a corner point of the feasible solution
space. The first tableau corresponds to the origin.
Subsequent tableaus are developed by shifting to an
adjacent corner point in the direction that yields the
highest (smallest) rate of profit (cost). This process
continues as long as a positive (negative) rate of profit
(cost) exists.
2
6s-3 Linear Programming
Simplex Algorithm
The key solution concepts
Solution Concept 1: the simplex method focuses
on corner point of feasible(CPF) solutions.
Solution concept 2: the simplex method is an
iterative algorithm (a systematic solution
procedure that keeps repeating a fixed series of
steps, called, an iteration, until a desired result has
been obtained) with the following structure:
3
6s-4 Linear Programming
Simplex algorithm
Initialization: setup to start iterations, including
finding an initial CPF solution
if no if yes stop
Simplex algorithm
Solution concept 3: whenever possible, the initialization
of the simplex method chooses the origin point (all
decision variables equal zero) to be the initial CPF
solution.
5
6s-6 Linear Programming
Simplex algorithm
Solution concept 5: After the current CPF solution
is identified, the simplex method examines each of
the edges of the feasible region that emanate from
this CPF solution. Each of these edges leads to an
adjacent CPF solution at the other end, but the
simplex method doesn’t even take the time to solve
for the adjacent CPF solution. Instead it simply
identifies the rate of improvement in Z that would
be obtained by moving along the edge. And then
chooses to move along the one with largest
positive rate of improvement. 6
6s-7 Linear Programming
Simplex algorithm
Solution concept 6: A positive rate of
improvement in Z implies that the adjacent
CPF solution is better than the current one,
whereas a negative rate of improvement in Z
implies that the adjacent CPF solution is
worse. Therefore, the optimality test consists
simply of checking whether any of the edges
give a positive rate of improvement in Z. if
none do, then the current CPF solution is
optimal. 7
6s-8 Linear Programming
≥ + slack (s)
= + Artificial (A)
8
6s-9 Linear Programming
A bm
Z Objective function coefficient Z
In different signs value
9
6s-10 Linear Programming
11
6s-12 Linear Programming
12
6s-13 Linear Programming
Simplex method
Example (All constraints are )
Solve the following problem using the simplex method
Maximize
Z = 3X1+ 5X2
Subject to
X1 4
2 X2 12
3X1 +2X2 18
X1 , X2 0
14
6s-15 Linear Programming
Simplex method
Solution
Initialization
1. Standard form
Maximize Z,
Subject to Sometimes it is called
the augmented form of
Z - 3X1- 5X2 =0 the problem because
the original form has
X1 + S1 = 4 been augmented by
some supplementary
2 X2 + S2 = 12
variables needed to
3X1 +2X2 + S3 = 18 apply the simplex
X1 , X2, S1, S2, S3 0 method
15
6s-16 Linear Programming
Definitions
A basic solution is an augmented corner point solution.
A basic solution has the following properties:
1. Each variable is designated as either a nonbasic variable or a
basic variable.
2. The number of basic variables equals the number of functional
constraints. Therefore, the number of nonbasic variables equals
the total number of variables minus the number of functional
constraints.
3. The nonbasic variables are set equal to zero.
4. The values of the basic variables are obtained as simultaneous
solution of the system of equations (functional constraints in
augmented form). The set of basic variables are called “basis”
5. If the basic variables satisfy the nonnegativity constraints, the
basic solution is a Basic Feasible (BF) solution.
16
6s-17 Linear Programming
Initial tableau
Entering
2. Initial tableau variable
Basic X1 X2 S1 S2 S3 RHS
variable
S1 1 0 1 0 0 4
S2 0 2 0 1 0 12
S3 3 2 0 0 1 18
Z -3 -5 0 0 0 0
Simplex tableau
Notes:
The basic feasible solution at the initial tableau
is (0, 0, 4, 12, 18) where:
X1 = 0, X2 = 0, S1 = 4, S2 = 12, S3 = 18, and Z = 0
Where S1, S2, and S3 are basic variables
X1 and X2 are nonbasic variables
The solution at the initial tableau is associated to
the origin point at which all the decision
variables are zero.
18
6s-19 Linear Programming
Optimality test
By investigating the last row of the initial tableau,
we find that there are some negative numbers.
Therefore, the current solution is not optimal
19
6s-20 Linear Programming
Iteration
Step 1: Determine the entering variable by
selecting the variable with the most negative in the
last row.
From the initial tableau, in the last row (Z row),
the coefficient of X1 is -3 and the coefficient of X2
is -5; therefore, the most negative is -5.
consequently, X2 is the entering variable.
X2 is surrounded by a box and it is called the pivot
column
20
6s-21 Linear Programming
Iteration
Step 2: Determining the leaving variable by using the
minimum ratio test as following:
Iteration
Step 3: solving for the new BF solution by using the
eliminatory row operations as following:
1. New pivot row = old pivot row pivot number
Basic X1 X2 S1 S2 S3 RHS
variable
S1
X2 0 1 0 1/2 0 6
S3
Z
Note that X2 becomes in the basic
variables list instead of S2 22
6s-23 Linear Programming
iteration
2. For the other row apply this rule:
New row = old row – the coefficient of this row in the pivot column (new pivot row).
For S1
1 0 1 0 0 4
-
0 (0 1 0 1/2 0 6)
1 0 1 0 0 4
For S3
3 2 0 0 1 18
-
2 (0 1 0 1/2 0 6)
3 0 0 -1 1 6
for Z
-3 -5 0 0 0 0
- Substitute this
-5(0 1 0 1/2 0 6) values in the
-3 0 0 5/2 0 30
table
23
6s-24 Linear Programming
Iteration
This solution is not optimal, since there is a negative numbers in the last row
Basic X1 X2 S1 S2 S3 RHS
variable
S1 1 0 1 0 0 4
X2 0 1 0 1/2 0 6
S3 3 0 0 -1 1 6
Z -3 0 0 5/2 0 30
Iteration
Apply the same rules we will obtain this solution:
Basic X1 X2 S1 S2 S3 RHS
variable
S1 0 0 1 1/3 -1/3 2
X2 0 1 0 1/2 0 6
X1 1 0 0 -1/3 1/3 2
Z 0 0 0 3/2 1 36
This solution is optimal; since there is no negative solution in
the last row: basic variables are X1 = 2, X2 = 6 and S1 = 2; the
nonbasic variables are S2 = S3 = 0
Z = 36 25
6s-26 Linear Programming
Unbounded solution
Degenerated solution
26
6s-27 Linear Programming
Exercise 1
Maximize
15x1+6x2+9x3+2x4
Subject to:
2x1+x2+5x3+0.6x4 < 20
3x1+x2+3x3+0.25x4 < 24
7x1+x4 < 70
Every xj
28
6s-29 Linear Programming
Big - M Method
29
6s-30 Linear Programming
3. Cost coefficients, which are supposed to be placed in the Z-row in the initial
simplex tableau, are transformed by ‘pivotal operation’ considering the
column of artificial variable as ‘pivotal column’ and the row of the artificial
variable as ‘pivotal row’.
4. If there are more than one artificial variables, step 3 is repeated for all the
artificial variables one by one.
30
6s-31 Linear Programming
S.t.
½ X 1 + ¼ X2 ≤ 4
X1 + 3X2 20
X1 + X2 = 10
X1, X2 0
31
6s-32 Linear Programming
Big M method
Solution
Step 1: standard form
Min Z,
s.t.
Z – 2 X1 – 3 X2 - M A1 -M A2 =0
½ X1 + ¼ X2 + S1 =4
X1 + 3X2 - S 2 + A1 = 20
X1 + X2 + A2 = 10
X1, X2 ,S1, S2, A1, A2 0
Where: M is a very large number 32
6s-33 Linear Programming
Big M method
Notes
M, a very large number, is used to ensure that the values of A1 and A2, …, and An will
be zero in the final (optimal) tableau as follows:
1. If the objective function is Minimization, then A1, A2, …, and An must be added to
the RHS of the objective function multiplied by a very large number (M).
Example: if the objective function is Min Z = X1+2X2, then the obj. function should
be Min Z = X1 + X2+ MA1 + MA2+ …+ MAn
OR
Z – X1 - X2- MA1 - MA2- …- MAn = 0
N.B.: When the Z is transformed to a zero equation, the signs are changed 33
6s-34 Linear Programming
Big M method
Step 2: Initial tableau
Basic X1 X2 S1 S2 A1 A2 RHS
variables
2 3 0 0 M M
S1 ½ ¼ 1 0 0 0 4
A1 1 3 0 -1 1 0 20
A2 1 1 0 0 0 1 10
Z -2 -3 0 0 -M -M 0
Note that one of the simplex rules is violated, which is the basic variables A1,
and A2 have a non zero value in the z row; therefore, this violation must be
corrected before proceeding in the simplex algorithm as follows.
34
6s-35 Linear Programming
Big M method
To correct this violation before starting the simplex
algorithm, the elementary row operations are used
as follows:
New (Z row) = old (z row) ± M (A1 row) ± M (A2 row)
In our case, it will be positive since M is negative in the Z
row, as following:
Old (Z row): -2 -3 0 0 -M -M 0
M (A1 row): M 3M 0 -M M o 20M
M (A2 row): M M 0 0 0 M 10M
New (Z row):2M-2 4M-3 0 -M 0 0 30M
35
It becomes zero
6s-36 Linear Programming
Big M method
The initial tableau will be:
Basic X1 X2 S1 S2 A1 A2 RHS
variables
2 3 0 0 M M
S1 1/2 1/4 1 0 0 0 4
A1 1 3 0 -1 1 0 20
A2 1 1 0 0 0 1 10
Z 2M-2 4M-3 0 -M 0 0 30M
• Since there is a positive value in the last row, this solution is not optimal
• The entering variable is X2 (it has the most positive value in the last row)
• The leaving variable is A1 (it has the smallest ratio)
36
6s-37 Linear Programming
Big M method
First iteration
Basic X1 X2 S1 S2 A1 A2 RHS
variables
2 3 0 0 M M
• Since there is a positive value in the last row, this solution is not optimal
• The entering variable is X1 (it has the most positive value in the last row)
• The leaving variable is A2 (it has the smallest ratio)
37
6s-38 Linear Programming
Big M method
Second iteration
Basic X1 X2 S1 S2 A1 A2 RHS
variables
S1 0 0 1 -1/8 1/8 -5/8 1/4
This solution is optimal, since there is no positive value in the last row. The
optimal solution is:
X1 = 5, X2 = 5, S1 = ¼
A1 = A2 = 0 and Z = 25 38
6s-39 Linear Programming
Example
Consider the following problem
39
6s-40 Linear Programming
Example…
40
6s-41 Linear Programming
Transformation of cost
coefficients
Considering the objective function and the first
constraint
Z 3x1 5x2 Ma1 Ma2 0 E1
x1 x2 x3 a1 2 E Pivotal
2
Row
Pivotal
Column
41
6s-42 Linear Programming
Transformation of cost
coefficients…
Z 3 M x1 5 M
Mx3 0 a1 Ma2 2M E
3
x2 a2 18 E
4
3 x1 2 x2
Pivotal Column
Pivotal Row
By the pivotal operation E3 M E4 the cost coefficients are modified as
42
6s-43 Linear Programming
43
6s-44 Linear Programming
Simplex Tableau…
contd.
Successive simplex tableaus are as
follows:
44
6s-45 Linear Programming
Simplex
Tableau…
45
6s-46 Linear Programming
Simplex
Tableau…
46
6s-47 Linear Programming
47
6s-48 Linear Programming
Special cases
In the final tableau, if one or more artificial variables
(A1, A2, …) still basic and has a nonzero value, then
the problem has an infeasible solution
If there is a zero under one or more non basic
variables in the final tableau (optimal solution
tableau), then there is a multiple optimal solution.
When determining the leaving variable of any
tableau, if there is no positive ratio (all the entries in
the pivot column are negative and zeroes), then the
solution is unbounded.
48
6s-49 Linear Programming