Simplex Method
Simplex Method
MOTIVATION OF SIMPLEX
SIMPLEX METHOD METHOD
Simplex method is the most popular method used Solution of a LPP, if exists, lies at one of the
for the solution of Linear Programming Problems vertices of the feasible region.
(LPP). All the basic solutions can be investigated one-by-
Objectives one to pick up the optimal solution.
To discuss the motivation of simplex method For 10 equations with 15 variables there exists
To discuss Simplex algorithm 15C10= 3003 basic feasible solutions!
To demonstrate the construction of simplex tableau Too large number to investigate one-by-one.
This can be overcome by simplex method
In 3D, a feasible region (i.e., volume) is bounded by Simplex: a linear-programming algorithm that can
several surfaces solve problems having more than two decision
variables.
Each vertex (a basic feasible solution) of this
The simplex technique involves generating a
volume is connected to the three other adjacent series of solutions in tabular form, called tableaus.
vertices by a straight line to each, being intersection By inspecting the bottom row of each tableau, one
of two surfaces. can immediately tell if it represents the optimal
solution. Each tableau corresponds to a corner
Simplex algorithm helps to move from one vertex to point of the feasible solution space. The first
another adjacent vertex which is closest to the tableau corresponds to the origin. Subsequent
optimal solution among all other adjacent vertices. tableaus are developed by shifting to an adjacent
corner point in the direction that yields the highest
Thus, it follows the shortest route to reach the (smallest) rate of profit (cost). This process
optimal solution from the starting point. continues as long as a positive (negative) rate of
profit (cost) exists.
1
20-Feb-19
2
20-Feb-19
3
20-Feb-19
4
20-Feb-19
SIMPLEX METHOD IN
SIMPLEX METHOD
TABULAR FORM
Step 3: Solve for the new BF solution by using Example (All constraints are )
elementary row operations (multiply or divide a row by a
nonzero constant; add or subtract a multiple of one row Solve the following problem using the simplex method
to another row) to construct a new simplex tableau, and Maximize
then return to the optimality test. The specific
elementary row operations are: Z = 3X1+ 5X2
1. Divide the pivot row by the “pivot number” (the number Subject to
in the intersection of the pivot row and pivot column) X1 4
2. For each other row that has a negative coefficient in the
pivot column, add to this row the product of the absolute 2 X2 12
value of this coefficient and the new pivot row. 3X1 +2X2 18
3. For each other row that has a positive coefficient in the
pivot column, subtract from this row the product of the
X1 , X2 0
absolute value of this coefficient and the new pivot row.
5
20-Feb-19
Entering
2. Initial tableau variable Notes:
Basic X1 X2 S1 S2 S3 RHS The basic feasible solution at the initial tableau is
variable (0, 0, 4, 12, 18) where:
S1 1 0 1 0 0 4 X1 = 0, X2 = 0, S1 = 4, S2 = 12, S3 = 18, and Z = 0
Where S1, S2, and S3 are basic variables
S2 0 2 0 1 0 12
X1 and X2 are nonbasic variables
S3 3 2 0 0 1 18
The solution at the initial tableau is associated to
Z -3 -5 0 0 0 0 the origin point at which all the decision variables
are zero.
Leaving Pivot row
Pivot column
variable Pivot
number
By investigating the last row of the initial tableau, Step 1: Determine the entering variable by
we find that there are some negative numbers. selecting the variable with the most negative in the
Therefore, the current solution is not optimal 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
6
20-Feb-19
ITERATION ITERATION
ITERATION ITERATION
2. For the other row apply this rule: This solution is not optimal, since there is a negative numbers in the last row
New row = old row – the coefficient of this row in the pivot column (new pivot row).
For S1
Basic X1 X2 S1 S2 S3 RHS
1 0 1 0 0 4
- variable
0 (0 1 0 1/2 0 6)
1 0 1 0 0 4 S1 1 0 1 0 0 4
For S3
3 2 0 0 1 18
X2 0 1 0 1/2 0 6
-
2 (0 1 0 1/2 0 6)
S3 3 0 0 -1 1 6
3 0 0 -1 1 6
for Z Z -3 0 0 5/2 0 30
-3 -5 0 0 0 0 Substitute this
- values in the
-5(0 1 0 1/2 0 6) The most negative
-3 0 0 5/2 0 30 table The smallest ratio
value; therefore, X1 is 6/3 =2; therefore,
is the entering S3 is the leaving
variable variable
7
20-Feb-19
Apply the same rules we will obtain this solution: Slack Variables :
Slack variable represents an unused quaintly of resources ; it is added
to less than or equal (<) to type constraints in order to get an equality
Basic X1 X2 S1 S2 S3 RHS constraint.
variable Surplus Variables :
A surplus variable represents the amount by which solution values
S1 0 0 1 1/3 -1/3 2 exceed a resource. These variables are also called ‘Negative Slack
Variables’ . Surplus variables like slack variables carry a zero coefficient
X2 0 1 0 1/2 0 6 in the objective function. it is added to greater than or equal to (>) type
constraints in order to get an equality constraint.
X1 1 0 0 -1/3 1/3 2 Artificial Variables :
Artificial variables are added to those constraints with equality (=) and
Z 0 0 0 3/2 1 36 greater than or equal to ( > ) sign. An Artificial variable is added to the
constraints to get an initial solution to an LP problem. Artificial variables
have no meaning in a physical sense and are not only used as a tool for
This solution is optimal; since there is no negative solution in generating an initial solution to an LP problem.
the last row: basic variables are X1 = 2, X2 = 6 and S1 = 2; the
nonbasic variables are S2 = S3 = 0
Z = 36
As Initial Program variable Used as starting point. Can’t be used since unit It is initially used but
matrix condition is not later on eliminated.
satisfied
In Optimal Table Used to help for – It indicates the
interpreting idle & key Infeasible Solution
resources.
8
20-Feb-19
1. In any Simplex tableau, the intersection of any basic variable with itself is
always one and the rest of the column is zeroes.
2. In any simplex tableau, the objective function row (Z row) is always in Simplex method incase of Artificial variables
terms of the nonbasic variables. This means that under any basic variable
(in any tableau) there is a zero in the Z row. For the non basic there is no Solve the following linear programming problem by
condition ( it can take any value in this row).
3. If there is a zero under one or more nonbasic variables in the last tableau using the simplex method:
(optimal solution tableau), then there is a multiple optimal solution.
4. When determining the leaving variable of any tableau, if there is no Min Z =2 X1 + 3 X2
positive ratio (all the entries in the pivot column are negative and zeroes),
then the solution is unbounded. S.t.
5. If there is a tie (more than one variables have the same most negative or ½ X1 + ¼ X2 ≤ 4
positive) in determining the entering variable, choose any variable to be
the entering one. X1 + 3X2 20
6. If there is a tie in determining the leaving variable, choose any one to be X1 + X2 = 10
the leaving variable. In this case a zero will appear in RHS column;
therefore, a “cycle” will occur, this means that the value of the objective X1, X2 0
function will be the same for several iterations.
7. A Solution that has a basic variable with zero value is called a “degenerate
solution”.
8. If there is no Artificial variables in the problem, there is no room for
“infeasible solution”
Notes
Solution
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:
Step 1: standard form 1. If the objective function is Minimization, then A1, A2, …, and An must be
Min Z, added to the RHS of the objective function multiplied by a very large
number (M).
s.t. Example: if the objective function is Min Z = X1+2X2, then the obj. function
should be Min Z = X1 + X2+ MA1 + MA2+ …+ MAn
Z – 2 X1 – 3 X2 - M A1 -M A2 =0 OR
Z – X1 - X2- MA1 - MA2- …- MAn = 0
½ X1 + ¼ X2 + S1 =4
2. If the objective function is Maximization, then A1, A2, …, and An must be
X1 + 3X2 - S 2 + A1 = 20 subtracted from the RHS of the objective function multiplied by a very
large number (M).
X1 + X2 + A2 = 10 Example: if the objective function is Max Z = X1+2X2, then the obj. function
should be Max Z = X1 + X2- MA1 - MA2- …- MAn
X1, X2 ,S1, S2, A1, A2 0 OR
Z - X1 - X2+ MA1 + MA2+ …+ MAn = 0
Where: M is a very large number
N.B.: When the Z is transformed to a zero equation, the signs are changed
9
20-Feb-19
Step 2: Initial tableau To correct this violation before starting the simplex
algorithm, the elementary row operations are used as
Basic X1 X2 S1 S2 A1 A2 RHS follows:
variables 2 3 0 0 M M New (Z row) = old (z row) ± M (A1 row) ± M (A2 row)
S1 ½ ¼ 1 0 0 0 4 In our case, it will be positive since M is negative in the Z
A1 1 3 0 -1 1 0 20 row, as following:
A2 1 1 0 0 0 1 10 Old (Z row): -2 -3 0 0 -M -M 0
M (A1 row): M 3M 0 -M M o 20M
Z -2 -3 0 0 -M -M 0
M (A2 row): M M 0 0 0 M 10M
New (Z row):2M-2 4M-3 0 -M 0 0 30M
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. It becomes zero
• Since there is a positive value in the last row, this solution is not optimal • 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 entering variable is X1 (it has the most positive value in the last row)
• The leaving variable is A1 (it has the smallest ratio) • The leaving variable is A2 (it has the smallest ratio)
10
20-Feb-19
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
11
20-Feb-19
STEP 2: OBTAIN A BASIC SOLUTION TO THE PROBLEM. IT IS CLEAR FROM THE TABLEAU THAT X2 WILL
WE DO THIS BY PUTTING THE DECISION VARIABLES ENTER AND A2 WILL LEAVE THE BASIS. HENCE 2
X1=X2=S1=S2=0, IS THE KEY ELEMENT IN PIVOTAL COLUMN.
SO THAT A1= 80 AND A2=60.
THESE ARE THE INITIAL VALUES OF ARTIFICIAL VARIABLES.
NOW,THE NEW ROW OPERATIONS ARE AS
FOLLOWS:
STEP 3: FORM THE INITIAL TABLEAU AS SHOWN. R2(NEW) = R2(OLD)/2
R1(NEW) = R1(OLD) - 1*R2(NEW)
Cj 600 500 0 0 M
Cj 600 500 0 0 M M
Min.Ratio
Min.Ratio Basic
Basic Basic (XB/Pivota
Basic (XB/Pivotal CB Variab X1 X2 S1 S2 A1 l Col.)
CB Variab X1 X2 S1 S2 A1 A2 Col.)
Soln(XB)
Soln(XB) le (B)
le (B)
M A1 50 3 2 0 -1 1 2 1 100/3
M A1 80 2 1 -1 0 1 0 80 500 X2 30 1 2 1 0 - 1/2 0 60
M A2 60 1 2 0 -1 0 1 60
Zj 3M Zj 3M/2+250 500 M M/2-250 M
3M M M M M
Cj - Zj 600-3M 500-3M M M 0 0 Cj - Zj 350-3M/2 0 M 250-M/2 0
12
20-Feb-19
SIMPLEX ALGORITHM –
SPECIAL CASES
49 50
DEGENERACY ( NO
IMPROVEMENT IN OBJECTIVE)
Degeneracy: It is situation when the This is in itself not a problem, but making
solution of the problem degenerates. simplex iterations form a degenerate
Degenerate Solution: A Solution of the solution, give rise to cycling, meaning that
problem is said to be degenerate solution if after a certain number of iterations without
value or values of basic variable(s) become improvement in objective value the method
zero may turn back to the point where it started.
It occurs due to redundant constraints.
51
13
20-Feb-19
14
20-Feb-19
ALTERNATIVE OPTIMAL
15
20-Feb-19
Entering
Variable
Optimal solution is 10 when x2=5/2, x1=0. By looking at f-row coefficient of the nonbasic
variable. Leaving Variable
16
20-Feb-19
67 68
17
20-Feb-19
Example Solution
Max 2x1+ x2
Max 2x1+ x2
Let S1and S2 be the slack variables
Subject to x1 – x2 +s1 =10
x1 – x2 ≤10
2x1 ≤ 40 2x1+0x2 + s2 =40
x1, x2≥0
x1, x2,s1,s2 ≥0
Initial Solution: x1 = 0, x2=0,
f=0, s1 =10, s2 =40
71 72
18
20-Feb-19
Objective
function
Basis X1 X2 S1 S2 RHS Ratio
Unbounded
X1 1 0 0 ½ 20 - Solution
Space
X2 0 1 -1 1/2 10 - 2x1 ≤ 40
f 0 0 -3 3/2 50
Optimal Point
2x1+x2 ≤ 2
3x1+4x2 ≥ 12
x1, x2=0
19
20-Feb-19
SOLUTION (GRAPHICAL):
INEQUALITIES CONSTRAINTS
ILLUSTRATION
IN EQUATION FORM
20
20-Feb-19
21
20-Feb-19
ARTIFICIAL OBJECTIVE
FUNCTION
F = A1 + A2
A1 Putting the values of A1 and A2
Use Equation no 4 to find the value of A1 F = ( 3 – 3X1- X2) + (6 – 4X1- 3X2 + S1)
3x1+ x2 + A1= 3 =9 - 7x1-4 x2 + S1
A1 = 3 - 3x1- x2 Minimize f = 4x1+ x2
A2 F=9 - 7x1-4 x2 + S1
Use Equation no 5 to find the value of A2 Subject to:
3x1+ x2 + A1 = 3 …………. (4)
4x1+ 3x2 – S1 + A2= 6
4x1+ 3x2 – S1 + A2= 6…………. (5)
A2= 6 - 4x1- 3x2 + S1 x1+ 2x2 + S2 = 4 …………. (6)
x1, x2, S1 , S2 , A1 + A2 ≥0
22
20-Feb-19
1
New Pivot Row = X Old Pivot Row
Pivot No.
The solution of artificial objective function
New Pivot 1
is said to be optimal when artificial X [3 1 0 0 1 0 3]
Row = 3
objective functions coefficients become
non-positive or zero
[1 1/3 0 0 1/3 0 1]
23
20-Feb-19
CALCULATION TABLEAU I
New Row = Old Row – Pivot Column Coefficient x New Pivot Row
New A2 Row = [4 3 -1 0 0 1 6]
- (4)[1 1/3 0 0 1/3 0 1] Basics X1 X2 S1 S2 A1 A2 RHS Ratio
= [0 5/3 -1 0 -4/3 1 2] X1 1 1/3 0 0 1/3 0 1 1÷1/3=3
New S2 Row =[1 2 0 1 0 0 4] 2 ÷5/3=1.2
A2 0 5/3 -1 0 -4/3 1 2
- (1) [1 1/3 0 0 1/3 0 1] (Min)
= [0 5/3 0 1 -1/3 0 3]
S2 0 5/3 0 1 -1/3 0 3 3/5 ÷ 3=1.8
New f Row = [-4 -1 0 0 0 0 0]
- (-4) [1 1/3 0 0 1/3 0 1]
f 0 1/3 0 0 4/3 0 4
= [0 1/3 0 0 4/3 0 4] F 0 5/3 -1 0 -7/3 0 2
New F Row = [7 4 -1 0 0 0 9] ↑
- (7) [1 1/3 0 0 1/3 0 1]
= [0 5/3 -1 0 -7/3 0 2]
Still there is one positive coefficient so we need to make
further tableau
CALCULATION CALCULATION
New Row = Old Row – Pivot Column Coefficient x New Pivot Row
1 New X1 Row =
New Pivot Row = X Old Pivot Row
Pivot No.
[1 1/3 0 0 1/3 0 1]
New Pivot 1
X [0 5/3 -1 0 -4/3 1 2] -(1/3)[0 1 -3/5 0 -4/5 3/5 6/5]
Row = 5/3
= [1 0 1/5 0 3/5 -1/5 3/5]
[0 1 -3/5 0 -4/5 3/5 6/5] New S2 Row =
[0 5/3 0 1 -1/3 0 3]
-(5/3)[0 1 -3/5 0 -4/5 3/5 6/5]
= [0 0 1 1 1 -1 1]
24
20-Feb-19
CALCULATION TABLEAU II
New f Row =
[0 1/3 0 0 4/3 0 4] Basics X1 X2 S1 S2 A1 A2 RHS
-(1/3)[0 1 -3/5 0 -4/5 3/5 6/5] X1 1 0 1/5 0 3/5 -1/5 3/5
= [0 0 1/5 0 8/5 -1/5 18/5] X2 0 1 -3/5 0 -4/5 3/5 6/5
New F Row S2 0 0 1 1 1 -1 1
f 0 0 1/5 0 8/5 -1/5 18/5
[0 5/3 -1 0 -7/3 0 2]
-(5/3)[0 1 -3/5 0 -4/5 3/5 6/5] F 0 0 0 0 -1 -1 0
= [0 0 0 0 -1 -1 0] Now there is no positive value in the artificial function so
this is the end of Phase I
PHASE II CALCULATION
25
20-Feb-19
CALCULATION CALCULATION
New Row = Old Row – Pivot Column Coefficient x New Pivot Row
New f Row =
New X1 Row =
[0 0 1/5 0 18/5]
[1 0 1/5 0 3/5]
-(1/5) [0 0 1 1 1]
-(1/5) [0 0 1 1 1]
= [0 0 0 -1/5 17/5]
= [1 0 0 -1/5 2/5]
New X2 Row =
[0 1 -3/5 0 6/5]
-(-3/5)[0 0 1 1 1]
= [0 1 0 3/5 9/5]
X1 = 2/5
X2 = 9/5
Basics X1 X2 S1 S2 RHS
X1 1 0 0 -1/5 2/5 f = 17/5
X2 0 0 0 3/5 9/5 Cross checking of maximization point
S1 0 0 1 1 1 put values of X1 and X2 from above solution into
f 0 0 0 -1/5 17/5 original objective function
f=4x1+ x2
Now there is no positive value in the objective function =4 (2/5) + (9/5)
so this is the optimal point =17/5
26
20-Feb-19
27