Simplex Method
Simplex Method
Chapter -3
Simplex Method
z= objective Function
x1, x2,….. xn-1, xn = ‘n’ decision variables
b1, b2,….. bm-1, bm = Right hand side values of ‘m’ constraints
‘n’ decision variables and ‘m’ constraints LPP
2
Standard Form of Linear Programming Problem
3
Slack Variables
◼ Example:
◼ Suppose 4 kg/ unit of raw material ‘A’ is consumed for manufacturing
of a product x1 and 3 kg/ unit of raw material ‘A’ is consumed for
manufacturing of a product x2. The total available raw material ‘A’ is
20 Kg. the above can be written as (Mathematically)
4x1 + 3x2 ≤ 20
◼ Suppose company optimal product mix is x1= 3 , x2 = 2, then the
total consumption of raw material A is 18. Hence, the unused qty of
raw material ‘A’ is 2kg…
◼ The equation above using the slack variable can be written as
4x1 + 3x2 + s1 = 20
Slack Variables
◼ Example:
◼ Referring to the diet problem discussed early. That the total feed
requirement is at least 800 kg. The feed comprises of Corn (x1) and
soybean (x2) the above can be written as (Mathematically)
x1 + x2 ≥ 800
◼ Suppose company optimal feed mix is x1= 500 kg , x2 = 350 kg, then
the total feed is 850 kg. Hence, the over stated or excess feed is 50
kg…
◼ The equation above using the surplus variable can be written as
x1 + x2 - S1 = 800
S1= 50 kg
Surplus Variables
subject to:
6x1 + 4x2 + s1 = 24
x1 + 2x2 + s2 = 6
- x1 + x2 + s3 = 1
x2 + s4= 2
9
Example: Standard Form of Diet Problem Model
subject to:
x1 + x2 - S1 = 800
.21x1 - .30x2 + s1 = 0
.03x1 - .01x2 – S2 = 0
10
Example: Standard Form of LPP Model
Max w (-z) = -6x1 – 3(x2+- x2-) + 0s1 + 0S1 Minimize Z = 6x1 + 3x2
subject to:
subject to: 2x1 + 4x2 16
4x1 + 3x2 ≤ 24
2x1 + 4(x2+- x2-) - S1 = 16
4x1 + 3(x2+- x2-) + s1 = 24 x1, 0
x2 is unrestricted in sign
x1, x2+ , x2- , s1, S1 0
11
Concept of Basic Solution and Basic Feasible Solution
Std form of the problem
Max z = 2x1 + 3x2 + 0s1 + 0s2 Maximize z = 2x1 + 3x2
subject to: subject to:
2x1 + x2 + s1 = 4 2x1 + x2 ≤ 4
x1 + 2x2 + s2 = 5
x1 + 2x2 ≤ 5
x1, x2 , s1, s2 0 x1, x2 0
Number of variables = 4
Number of equation = 2
So, to get the solution we need to put How Many variables at the zero level?
4C2 = 6
12
Concept of Basic Solution and Basic Feasible Solution
Number of variables = 4 Max z = 2x1 + 3x2 + 0s1 + 0s2
Number of equation = 2 subject to:
So, to get the solution we need to put any 2x1 + x2 + s1 = 4
two variable (var – eq) at the zero level. x1 + 2x2 + s2 = 5
The variables at the zero level, are non-basic x1, x2 , s1, s2 0
The variables at the non-zero level, are basic
17
The Simplex Method
❖ Steps involved:
1. Locate an extreme point of the feasible region (Normally
simplex method starts from the origin point).
2. Examine each boundary edge intersecting at this point to
see whether movement along any edge increases the value
of the objective function.
3. If the value of the objective function increases along any
edge, move along this edge to the adjacent extreme point. If
several edges indicate improvement, the edge providing the
greatest rate of increase is selected.
4. Repeat steps 2 and 3 until movement along any edge no
longer increases the value of the objective function.
18
The Simplex Method – Iterative Nature
x2
❖ Steps involved:
1. Start at ‘A’ Maximize z = 2x1 + 3x2
5
Sol (A) x1=0, x2=0, s1=4, s2 =5, z =0 4
2. From A, we can move to B or D. 3
B
Sol (B) x1=0, x2=2.5, s1=1.5, s2 =0, z =7.5 2 C
1.Start at ‘A’
Sol (A) x1=0, x2=0, s1=24, s2 =6, s3=1, s4 =2, z =0
20
Computational details of the Simplex Method
z - 5x1 - 4x2 - 0s1 - 0s2 - 0s3 - 0s4 =0
x2
subject to:
E D
2
6x1 + 4x2 + s1 = 24 C
x1 + 2x2 + s2 = 6 1 F
- x1 + x2 + s3 = 1
A B
x2 + s4= 2
x1, x2, s1, s2, s3, s4 0 1 2 3 4 x1
1.Start at ‘A’ : Sol (A) x1=0, x2=0, s1=24, s2 =6, s3=1, s4 =2, z =0
Solution ‘A’ represented in tabular form as below:
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 6 4 1 0 0 0 24
s2 0 1 2 0 1 0 0 6
s3 0 -1 1 0 0 1 0 1
s4 0 0 1 0 0 0 1 2
21
Computational details of the Simplex Method
Initial solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 6 4 1 0 0 0 24
s2 0 1 2 0 1 0 0 6
s3 0 -1 1 0 0 1 0 1
s4 0 0 1 0 0 0 1 2
Solution is feasible: If all the values under solution column are +ve
Solution is optimal:
For maximization case: If all the elements in z row are 0 or +ve
For minimization case: If all the elements in z row are 0 or -ve
The initial solution above is feasible as all the values under solution column are +ve.
The initial solution above is NOT optimal as some of the elements in z row are negative
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 66 4 1 0 0 0 24 24/6=4
s2 0 1 2 0 1 0 0 6 6/1= 6
s3 0 -1 1 0 0 1 0 1 1/-1
s4 0 0 1 0 0 0 1 2 1/0
For developing the next iteration first find out most negative number (z=max) in the z row.
Most negative number is -5, highlight that column, the corresponding variable i.e. x1
which is non-basic now, will enter the solution or become the basic variable.
So, entering variable is x1, the column corresponding to x1 var. is known as key column
Second find out the basic variable, which will leave the solution, means become non-
basic from basic and for this
Divide each element of solution by the corresponding element of key column. (Ignore
the ratio with 0 and –ve as denominator)
Highlight the row which gives minimum +ve ratio, The variable corresponding to this
row, known as key row, and leaves the sol and becomes non-basic from basic.
The COMMON ELEMENT OF KEY ROW AND KEY COLUMN IS KEY ELEMENT
23
Computational details of the Simplex Method
Key Element Key column Key row
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 6 4 1 0 0 0 24 24/6=4
s2 0 1 2 0 1 0 0 6 6/1= 6
s3 0 -1 1 0 0 1 0 1 1/-1
s4 0 0 1 0 0 0 1 2 1/0
Basic z x1 x2 s1 s2 s3 s4 solution
z
x1
s2
s3
s4
24
Computational details of the Simplex Method
Initial solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 6 4 1 0 0 0 24
s2 0 1 2 0 1 0 0 6
s3 0 -1 1 0 0 1 0 1
s4 0 0 1 0 0 0 1 2
Basic z x1 x2 s1 s2 s3 s4 solution
z
x1 0 1 2/3 1/6 0 0 0 4
s2
s3
s4
25
Computational details of the Simplex Method
Initial solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 -5 -4 0 0 0 0 0
s1 0 6 4 1 0 0 0 24
s2 0 1 2 0 1 0 0 6
s3 0 -1 1 0 0 1 0 1
s4 0 0 1 0 0 0 1 2
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4
s2 0 0 4/3 - 1/6 1 0 0 2
s3 0 0 5/3 1/6 0 1 0 5
s4 0 0 1 0 0 0 1 2
26
Computational details of the Simplex Method
Second solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4
s2 0 0 4/3 - 1/6 1 0 0 2
s3 0 0 5/3 1/6 0 1 0 5
s4 0 0 1 0 0 0 1 2
Solution: basic variables: x1=4, s2=2, s3=5, s4=2, Objective function value z=20
Non - basic variables: s1=0, x2=0
Solution: x1=4, s2=2, s3=5, s4=2, s1=0, x2=0 Objective function value z=20
This is corresponding to Point ‘B’ (refer the graphical solution)
x2
E D
2
C
1 F
A B
1 2 3 4 x1 27
Computational details of the Simplex Method
Second solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4 4/(2/3)=6
s2 0 0 4/3 - 1/6 1 0 0 2 2/(4/3)=1.5
s3 0 0 5/3 1/6 0 1 0 5 5/(5/3)=3
s4 0 0 1 0 0 0 1 2 2/1=2
The second solution above is feasible as all the values under solution column are +ve.
The second solution above is NOT optimal as some of the elements in z row are negative
Since solution is feasible but non-optimal, so Develop the next iteration
First find out the entering variable: as the z row has only one –ve element so variable
corresponding to that is entering variable and column corresponding is key column
Next find out the outgoing variable: the minimum ratio rule, the minimum ratio is 1.5,
So the variable s2 is outgoing variable (means becoming non-basic from basic) and the
Corresponding row is the key row.
The COMMON ELEMENT OF KEY ROW AND KEY COLUMN IS KEY ELEMENT
28
Computational details of the Simplex Method
Second solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4
s2 0 0 4/3 - 1/6 1 0 0 2
s3 0 0 5/3 1/6 0 1 0 5
s4 0 0 1 0 0 0 1 2
The
Howsecond solution the
to generate above is feasible
next as all the values under solution column are +ve.
solution?
The
1. second
Changesolution
the s2above is NOT
variable optimal
under ascolumn
basic some of to
thex2
elements in z row are negative
2. Make
Since theisfresh
solution table
feasible but by incorporating
non-optimal, the above
so Develop change
the next as below
iteration
Basic z x1 x2 s1 s2 s3 s4 solution
z
x1
x2
s3
s4
29
Computational details of the Simplex Method
Second solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4
s2 0 0 4/3 - 1/6 1 0 0 2
s3 0 0 5/3 1/6 0 1 0 5
s4 0 0 1 0 0 0 1 2
Basic z x1 x2 s1 s2 s3 s4 solution
z
x1
x2 0 0 1 -1/8 3/4 0 0 3/2
s3
s4
30
Computational details of the Simplex Method
Second solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 - 2/3 5/6 0 0 0 20
x1 0 1 2/3 1/6 0 0 0 4
s2 0 0 4/3 - 1/6 1 0 0 2
s3 0 0 5/3 1/6 0 1 0 5
s4 0 0 1 0 0 0 1 2
How to generate the next solution?
4. Calculate and Write down rest of the elements in new table by using the formula below:
corresponding elementi in key row X correspodning element in key column
New element = old element − key element
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 0 3/4 1/2 0 0 21
x1 0 1 0 1/4 - 1/2 0 0 3
x2 0 0 1 - 1/8 3/4 0 0 3/2
s3 0 0 0 3/8 -5/4 1 0 5/2
s4 0 0 0 1/8 - 3/4 0 1 1/2
31
Computational details of the Simplex Method
Third solution
Basic z x1 x2 s1 s2 s3 s4 solution
z 1 0 0 3/4 1/2 0 0 21
x1 0 1 0 1/4 - 1/2 0 0 3
x2 0 0 1 - 1/8 3/4 0 0 3/2
s3 0 0 0 3/8 -5/4 1 0 5/2
s4 0 0 0 1/8 - 3/4 0 1 1/2
The third solution above is feasible as all the values under solution column are +ve.
The third solution above is OPTIMAL as all elements in z row are 0 or +ve
So, solution is feasible and optimal
Maximize z = 5x1 + 4x2
x2
Solution: E D
2
x1=3, x2 = 3/2, s1=0, s2=0, s3=5/2, s4=1/2,
C
Objective function value z=21
This is corresponding to Point ‘C’ 1 F
(refer the graphical solution) A B
1 2 3 4 x1
32
Insight into the solution of Reddy Mikks Problem
Max z = 5x1 +4x2 +0s1 +0s2 +0s3 +0s4 Solution:
x1=3, x2 = 3/2, s1=0, s2=0, s3=5/2, s4=1/2,
subject to: Objective function value z=21
6x1 + 4x2 + s1 = 24 (Raw material M1)
x1 + 2x2 + s2 = 6 (Raw material M2) s1=0, s2=0 means that Raw materials
- x1 + x2 + s3 = 1 (Market Limit) M1 and M2will be fully consumed
x2 + s4= 2 (Demand Limit) when x1=3, and x2=1.5, this means
Raw materials M1 and M2 are Scarce
x1, x2, s1, s2, s3, s4 0
Where:
s3=5/2,s4=1/2 means that market and demand
x1 = tons produced daily of ext paint Limits are not fully consumed.
x2 = tons produced daily of int paint this means
s1, s2 , s3, s4 are slack variables market limit and demand is abundant
Data
33
Example: Simplex Method (Minimization)
Standard Form
Min w = x1 - 3x2 - 2x3
Min w = x1 - 3x2 - 2x3 + 0s1 + 0s2 + 0s3
subject to:
w - x1 + 3x2 + 2x3 - 0s1 - 0s2 - 0s3 =0
3x1 - x2 + 2x3 ≤ 7
subject to:
- 2x1 + 4x2 ≤ 12
- 4x1 + 3x2 + 8x3 ≤ 10 3x1 - x2 + 2x3 + s1 =7
- 2x1 + 4x2 + s2 = 12
x1, x2, x3 0
- 4x1 + 3x2 + 8x3 + s3 = 10
x1, x2, x3, s1, s2, s3 0
No. of variables = 6
No. of constraints = 3
How many non-basic variable (zero level) = 3
Initial solutions, x1=0, x2 =0, x3 = 0, s1 = 7, s2 = 12, s3 = 10, w=0
34
Example: Simplex Method (Minimization)
Standard Form
Initial solution is feasible
Min w = x1 - 3x2 - 2x3 + 0s1 + 0s2 + 0s3 Initial solution is non-optimal
w - x1 + 3x2 + 2x3 - 0s1 - 0s2 - 0s3 =0
subject to:
3x1 - x2 + 2x3 + s1 =7
- 2x1 + 4x2 + s2 = 12
- 4x1 + 3x2 + 8x3 + s3 = 10
x1, x2, x3, s1, s2, s3 0
Initial Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 -1 3 2 0 0 0 0
s1 0 3 -1 2 1 0 0 7
s2 0 -2 4 0 0 1 0 12
s3 0 -4 3 8 0 0 1 10
35
Example: Simplex Method (Minimization)
Standard Form
Initial solution is feasible
Min w = x1 - 3x2 - 2x3 + 0s1 + 0s2 + 0s3 Initial solution is non-optimal
w - x1 + 3x2 + 2x3 - 0s1 - 0s2 - 0s3 =0
subject to:
Key variable is x2
3x1 - x2 + 2x3 + s1 =7 Key column is corresponding to x2
- 2x1 + 4x2 + s2 = 12
- 4x1 + 3x2 + 8x3 + s3 = 10
x1, x2, x3, s1, s2, s3 0
Initial Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 -1 3 2 0 0 0 0
s1 0 3 -1 2 1 0 0 7
s2 0 -2 4 0 0 1 0 12
s3 0 -4 3 8 0 0 1 10
36
Example: Simplex Method (Minimization)
Standard Form Initial solution is feasible
Initial solution is non-optimal
Min w = x1 - 3x2 - 2x3 + 0s1 + 0s2 + 0s3
w - x1 + 3x2 + 2x3 - 0s1 - 0s2 - 0s3 =0 Key variable is x2
Key column is corresponding to x2
subject to:
Key row?
3x1 - x2 + 2x3 + s1 =7
Min ratio corresponding to s2
- 2x1 + 4x2 + s2 = 12
So key row is s2
- 4x1 + 3x2 + 8x3 + s3 = 10
x1, x2, x3, s1, s2, s3 0 Key Element? = 4
Initial Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 -1 3 2 0 0 0 0
s1 0 3 -1 2 1 0 0 7 NA
s2 0 -2 4 0 0 1 0 12 12/4=3
s3 0 -4 3 8 0 0 1 10 10/3=3.3
37
Example: Simplex Method (Minimization)
Second Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 1/2 0 2 0 -3/4 0 -9
s1 0 5/2 0 2 1 1/4 0 10
x2 0 -1/2 1 0 0 1/4 0 3
s3 0 -5/2 0 8 0 -3/4 1 1
Third Solution Fourth solution
is feasible and
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 9/8 0 0 0 -9/16 -1/4 -37/4 optimal
s1 0 25/8 0 0 1 7/16 -1/4 39/4
x2 0 -1/2 1 0 0 1/4 0 3
x3 0 -5/16 0 1 0 -3/32 1/8 1/8
Fourth Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 0 0 0 -9/25 -18/25 -4/25 -319/25
x1 0 1 0 0 8/25 7/50 -2/25 78/25
x2 0 0 1 0 4/25 8/25 -1/25 114/25
x3 0 0 0 1 1/10 -43/800 1/10 11/10 38
Example: Simplex Method (Minimization)
Fourth Solution
Basic w x1 x2 x3 s1 s2 s3 solution
w 1 0 0 0 -9/25 -18/25 -4/25 -319/25 Fourth solution
x1 0 1 0 0 8/25 7/50 -2/25 78/25 is feasible and
x2 0 0 1 0 4/25 8/25 -1/25 114/25 optimal
x3 0 0 0 1 1/10 -43/800 1/10 11/10
Solution:
x1=78/25,
x2 = 114/25
x3 = 11/10
Objective function value w= -319/25
40
Example: Simplex Method (Minimization)
Standard Form
Min w = x1 - 3x2 - 2x3
Min w = x1 - 3x2 - 2x3 + 0s1 + 0s2 + 0s3
subject to:
w - x1 + 3x2 + 2x3 - 0s1 - 0s2 - 0s3 =0
3x1 - x2 + 2x3 ≤ 7
subject to:
- 2x1 + 4x2 ≤ 12
- 4x1 + 3x2 + 8x3 ≤ 10 3x1 - x2 + 2x3 + s1 =7
- 2x1 + 4x2 + s2 = 12
x1, x2, x3 0
- 4x1 + 3x2 + 8x3 + s3 = 10
x1, x2, x3, s1, s2, s3 0
No. of variables = 6
No. of constraints = 3
How many variables to put at zero level to get solution = 3
Initial solutions, x1=0, x2 =0, x3 = 0, s1 = 7, s2 = 12, s3 = 10, z=0
Example:
Max z= 16x1+15x2+20x3-18x4
Subject to
2x1 + x2 + 3x3 ≤ 3000 [1]
3x1 + 4x2 + 5x3 – 60x4 ≤ 2400 [2]
x4 ≤ 32 [3]
x2 ≥ 200 [4]
x1 + x2 + x3 ≥ 800 [5]
x1 – x2 – x3 =0 [6]
xj ≥ 0 for all J
42
Simplex method when some or all the constraints are
NOT “≤” constraints
Example: in Standard Form
No. of variables = 9
No. of constraints = 6
How many variables to put at zero level to get solution = 3
Initial solutions, ??
Most of the time it is tough to find initial
43 immediate feasible solution
Simplex method when some or all the constraints are
NOT “≤” constraints
44
Simplex method when some or all the constraints
are NOT “≤” constraints
Example:
Max z= 16x1+15x2+20x3-18x4
Subject to
2x1 + x2 + 3x3 ≤ 3000 [1]
3x1 + 4x2 + 5x3 – 60x4 ≤ 2400 [2]
x4 ≤ 32 [3]
x2 ≥ 200 [4]
x1 + x2 + x3 ≥ 800 [5]
x1 – x2 – x3 =0 [6]
xj ≥ 0 for all J
45
Simplex method when some or all the constraints are
NOT “≤” constraints
We assign a very
Example: in Standard Form (First Step)
large negative
objective function
Max z= 16x1+15x2+20x3-18x4+0s1+0s2+0s3+0S1+0S2
coefficient , -M , (
z- 6x1-15x2-20x3+18x4-0s1-0s2-0s3-0S1-0S2 = 0
Subject to +M for minimization
problem) to each
2x1 + x2 + 3x3 +s1 = 3000 [1] artificial variable
3x1 + 4x2 + 5x3 – 60x4 +s2 = 2400 [2]
x4 +s3 = 32 [3]
x2 -S1 = 200 [4] We add artificial :
x1 + x2 + x3 -S2 = 800 [5] R4, R5, R6, respectively to
x1 – x2 – x3 =0 [6] the fourth, fifth, and sixth
xj , sj, Sj ≥ 0 for all J equations.
46
Simplex method when some or all the constraints are
NOT “≤” constraints
Example: Standard Form (after adding artificial variables to constraints of type = or ≥ type
and –M to the objective function
Max z= 16x1+15x2+20x3-18x4+0s1+0s2+0s3+0S1+0S2-MR1-MR2-MR3
z-16x1-15x2-20x3+18x4-0s1-0s2-0s3-0S1-0S2+MR1+MR2+MR3= 0
Subject to
2x1 + x2 + 3x3 +s1 = 3000 [1]
3x1 + 4x2 + 5x3 – 60x4 +s2 = 2400 [2]
x4 +s3 = 32 [3]
x2 -S1 + R1 = 200 [4]
x1 + x2 + x3 -S2 + R2 = 800 [5]
x1 – x2 – x3 + R3 =0 [6]
xj , sj, Sj , Rj ≥ 0 for all J
No. of variables = 12
No. of constraints = 6
How many variables to put at zero level to get solution = 6
Initial solutions:
x1=0, x2 =0, x3 = 0, x4 = 0, S1 = 0, S2 = 0
s1 = 3000, s2 = 2400, s3 = 32, R1 = 200, R2 = 800, R3 = 0,
z=-1000M 47
Simplex method when some or all the constraints are
NOT “≤” constraints
This Method is known as BIG M Method or the PENALTY Method
This way we penalize the Objective function. The purpose of adding artificial
variable is to get the immediate feasible solution ONLY.
If the artificial variables still appear in the Optimal solution, this means the
problem is infeasible.
48
Solving For the optimal solution of [Maximization]
when there are artificial variables
Example
Maximize z = 2x1+ 5x2
Subject to
x1 ≥4
x1 + 4x2 ≤ 32
3x1+ 2x2 = 24
49
Solving For the optimal solution of [Maximization]
when there are artificial variables
Solution
Maximize z = 2x1+ 5x2 ◼ By adding the appropriate slack, surplus,
and artificial variables, we obtain the
Subject to following in standard form:
x1 ≥4 Maximize z = 2x1+ 5x2+0S1+0s2-MR1-MR2
x1 + 4x2 ≤ 32
3x1+ 2x2 = 24 z -2x1-5x2-0S1-0s2+MR1+MR2 = 0
Subject to
x1, x2 ≥ 0 for all J x1 -S1 +R1 =4
x1 + 4x2 +s2 = 32
3x1+ 2x2 +R2 = 24
x1, x2, S1, s2, R1, R2 ≥ 0
No. of variables = 6
No. of constraints = 3
How many variables to put at zero level to get solution = 3
Initial solutions:
x1=0, x2 =0, S1 = 0,
R1 = 4, s2 = 32, R3 = 24, z=-28M 50
Maximize z = 2x1+ 5x2+0S1+0s2-MR1-MR2
Solving For the optimal
z -2x1-5x2-0S1-0s2+MR1+MR2 = 0
solution of
[Maximization] when Subject to
x1 -S1 +R1 =4
there are artificial variables x1 + 4x2 +s2 = 32
3x1+ 2x2 +R2 = 24
x1, x2, S1, s2, R1, R2 ≥ 0
The initial table (wrong) :
Basic z x1 x2 S1 s2 R1 R2 RHS
z 1 -2 -5 0 0 M M -28
R1 0 1 0 -1 0 1 0 4 R1, s2, R2 are
basic
s2 0 1 4 0 1 0 0 32 variables.
R2 0 3 2 0 0 0 1 24
Subject to
x1 -S1 +R1 =4 [1]
x1 + 4x2 +s2 = 32 [2]
3x1+ 2x2 +R2 = 24 [3]
x1, x2, S1, s2, ≥ 0 52
Solving For the optimal Maximize z = (2+4M)x1+ (5+2M)x2-MS1+0s2-28M
solution of [Maximization]z - (2+4M)x1-(5+2M)x2+MS1-0s2 = 28M
when there are artificial
variables Subject to
x1 -S1 +R1 =4 [1]
x1 + 4x2 +s2 = 32 [2]
3x1+ 2x2 +R2 = 24 [3]
x1, x2, S1, s2, ≥ 0
Summary
57
Solving For the optimal solution of [Minimization]
when there are artificial variables
Solution
Minimize w= 4x1 + x2
Subject to ◼ By adding the appropriate slack, surplus,
3x1+ x2 = 3 and artificial variables, we obtain the
4x1 + 3x2 ≥ 6 following in standard form:
x1+ 2x2 ≤ 4 Minimize w = 4x1 + x2 + 0s2 + 0S1+MR1+MR2
x1, x2 ≥ 0
w -4x1-x2+0S1+0s2-MR1-MR2 = 0
Subject to
3x1+ x2 + R1 =3
4x1 + 3x2 – S1 + R2 =6
x1+ 2x2 +s2= 4
x1, x2, S1, s2, R1, R2 ≥ 0
No. of variables = 6
No. of constraints = 3
How many variables to put at zero level to get solution = 3
Initial solutions:
x1=0, x2 =0, S1 = 0,
R1 = 3, s2 = 4, R2 = 6, w=9M 58
Solving For the optimal solution of [Minimization] when there
are artificial variables
Minimize w = 4x1 + x2 + 0s2 + 0S1+MR1+MR2
w -4x1-x2+0S1+0s2-MR1-MR2 = 0 So before jumping to First table
Subject to first replace R1 and R2 in OF
3x1+ x2 + R1 =3 By substituting
4x1 + 3x2 – S1 + R2 =6 the value of R1 and R2
x1+ 2x2 +s2= 4 From the corresponding
x1, x2, S1, s2, R1, R2 ≥ 0 constraints
From eq. 1: R1= 3 - 3x1 – x2
From eq. 2: R2= 6-4x1-3x2+S1 & Substitute the value of R1 and R2 in Objective
function
Minimize w = (4-7M)x1+ (1-4M)x2+MS1+0s2+9M
w - (4-7M)x1-(1-4M)x2-MS1-0s2 = 9M
Subject to
3x1+ x2 + R1 =3 [1]
4x1 + 3x2 – S1 + R2 =6 [2]
x1+ 2x2 +s2= 4 [3]
x1, x2, S1, s2, R1, R2 ≥ 0 59
Solving For the optimal Minimize w = (4-7M)x1+ (1-4M)x2+MS1+0s2+9M
solution of [Minimization] w - (4-7M)x1-(1-4M)x2-MS1-0s2 = 9M
when there are artificial
variables Subject to
3x1+ x2 + R1 =3 [1]
4x1 + 3x2 – S1 + R2 =6 [2]
x1+ 2x2 +s2= 4 [3]
x1, x2, S1, s2, R1, R2 ≥ 0
Basic w x1 x2 S1 s2 R1 R2 RHS
w 1 7M-4 4M-1 -M 0 0 0 9M
R1, s2, R2
R1 0 3 1 0 0 1 0 3 are basic
variables.
R2 0 4 3 -1 0 0 1 6
s2 0 1 2 0 1 0 0 4
Summary
64
Simplex method when some or all the
constraints are NOT “≤” constraints
Two Phase Method
65
Preview
◼ When a basic feasible solution is not readily available, the
two-phase method may be used as an alternative to the
big M method.
◼ In the two-phase method, we add artificial variables to the
same constraints as we did in big M method.
◼ Then we find a bfs to the original LP by solving the Phase I
◼ In the Phase I , the objective function is to
minimize the sum of all artificial variables.
67
Solving For the optimal solution of [Minimization] when
there are artificial variables by two phase method
Minimize R = R1+R2 or
Minimize R = R1+R2+0x1+0x2+0S1+0s2
So before jumping to First table
Subject to first replace R1 and R2 in OF
3x1+ x2 + R1 = 3 [1] By substituting
4x1 + 3x2 – S1 + R2 = 6 [2] the value of R1 and R2
x1+ 2x2 +s2= 4 [3] From the corresponding
x1, x2, S1, s2, R1, R2 ≥ 0 constraints
Basic R x1 x2 S1 s2 R1 R2 RHS
R 1 7 4 -1 0 0 0 9
R1, s2, R2
R1 0 3 1 0 0 1 0 3 are basic
variables.
R2 0 4 3 -1 0 0 1 6
s2 0 1 2 0 1 0 0 4
Subject to
x1+ 1/5 S1 = 3/5
x2 – 3/5 S1 = 6/5
S1 + s2 =1
72
x1, x2, S1, s2, ≥ 0
Solving For the optimal solution of [Minimization] when
there are artificial variables by two phase method
Minimize w= 4x1 + x2
So before jumping to First table
Subject to first replace x1 and x2 in OF
x1+ 1/5 S1 = 3/5 [1] By substituting
x2 – 3/5 S1 = 6/5 [2] the value of x1 and x2
S1 + s2 = 1 [3] From the corresponding constraints
x1, x2, S1, s2, ≥ 0
From eq. 1: x1= 3/5 – 1/5 S1
From eq. 2: x2= 6/5 +3/5 S1 & Substitute the value of x1 and x2 in Objective function
Subject to
x1+ 1/5 S1 = 3/5
x2 – 3/5 S1 = 6/5
S1 + s2 =1
x1, x2, S1, s2, ≥ 0
73
Minimize w = -1/5S1+18/5 + 0s2
w +1/5S1- 0s2= 18/5
Solving For the optimal solution of
[Minimization] when there are Subject to
artificial variables by two phase x1+ 1/5 S1 = 3/5
method x2 – 3/5 S1 = 6/5
S1 + s2 =1
x1, x2, S1, s2, ≥ 0
x2 0 0 1 -3/5 0 6/5
s2 0 0 0 1 1 1
74
Solving For the optimal solution of [Minimization] when there are artificial
variables by two phase method
x2 0 0 1 -3/5 0 6/5
s2 0 0 0 1 1 1
76
Simplex Algorithm – Special cases
1. Degeneracy
2. Alternative optima
3. Unbounded solution
4. Non-existing (infeasible) solution
77
Simplex Algorithm – Degeneracy
78
Simplex Algorithm – Degeneracy
Example:
Maximize z = 3x1 + 9x2
Subject to
x1 + 4x2 ≤ 8
x1 + 2x2 ≤ 4
x1, x2 ≥ 0
79
Simplex Algorithm – Degeneracy
Maximize z = 3x1 + 9x2
Subject to
x1 + 4x2 ≤ 8
x1 + 2x2 ≤ 4
x1, x2 ≥ 0
81
Simplex Algorithm – Degeneracy
Entering Variable
Basic z x1 x2 s1 s2 RHS
z 1 -3/4 0 9/4 0 18 Leaving Variable
x2 0 1/4 1 1/4 0 2 2/(1/4)=8
s2 0 1/2 0 -1/2 1 0 0/(1/2)=0
Basic z x1 x2 s1 s2 RHS
z 1 -3/4 0 9/4 0 18 Leaving Variable
x2 0 1/4 1 1/4 0 2 2/(1/4)=8
s2 0 1/2 0 -1/2 1 0 0/(1/2)=0
Third table
Basic z x1 x2 s1 s2 RHS
z 1 0 0 3/2 3/2 18 Optimal and Feasible solution
x2 0 0 1 1/2 -1/2 2
x1 0 1 0 -1 2 0
85
Simplex Algorithm – Alternate Optima
Maximize z = 2x1 + 4x2
Subject to
x1 + 2x2 ≤ 5
x1 + x2 ≤ 4
x1, x2 ≥ 0
Entering Variable
87
Simplex Algorithm – Alternate Optima
Basic z x1 x2 s1 s2 RHS
z 1 -2 -4 0 0 0
s1 0 1 2 1 0 5 5/2=2.5
s2 0 1 1 0 1 4 4/1=4
Basic z x1 x2 s1 s2 RHS
1. Sol. Optimal and feasible
z 1 0 0 2 0 10 2. x2=1, x1=3 (BV), z=10
x2 0 0 1 1 -1 1 3. s1=0, s2=0 (NBV)
x1 0 1 0 -1 2 3
88
Simplex Algorithm – Unbounded Solutions
Unbounded Solutions
89
Simplex Algorithm – Unbounded Solutions
Maximize z = 2x1 + x2
Subject to
- x1 - x2 ≤ 10
-2x1 ≤ 40
x1, x2 ≥ 0
Basic z x1 x2 s1 s2 RHS
No Leaving
z 1 -2 -1 0 0 0 Variable
s1 0 -1 -1 1 0 10 10/-1=NA
s2 0 -2 0 0 1 40 40/-2= NA
91
Simplex Algorithm – Infeasible
Infeasible solution
92
Simplex Algorithm – Infeasible
x1, x2 > 0
93
Example: Infeasible Problem
◼ There are no points that satisfy both constraints, so there
is no feasible region (and no feasible solution).
x2
Max 3x1 + 2x2 10
3x1 + 4x2 > 12
s.t. 2x1 + x2 < 2 8
3x1 + 4x2 > 12
6
x1, x2 > 0 2x1 + x2 < 2
4
x1
2 4 6 8 10
94
Simplex Algorithm – Infeasible
Max 3x1 + 2x2
x1, x2 > 0
Basic z x1 x2 s1 S2 R1 RHS
z 1 -3-3M -2-4M 0 M 0 -12M
s1 0 2 1 1 0 0 2
R1 0 3 4 0 -1 1 12
96
Simplex Algorithm – Infeasible
Basic z x1 x2 s1 S2 R1 RHS
z 1 -3-3M -2-4M 0 M 0 -12M
s1 0 2 1 1 0 0 2
R1 0 3 4 0 -1 1 12
Basic z x1 x2 s1 S2 R1 RHS
z 1 5M+1 0 4M+2 M 0 4-4M
X2 0 2 1 1 0 0 2
R1 0 -5 0 -4 -1 1 4
97
Sensitivity Analysis
98
The Role of Sensitivity Analysis of the
Optimal Solution
99
The Role of Sensitivity Analysis of the
Optimal Solution
100
Sensitivity Analysis of Change in Objective
Function Coefficients
◼ Range of Optimality
◼ The optimal solution will remain unchanged as long as
◼ An objective function coefficient lies within its range of
optimality
◼ There are no changes in any other input parameters.
101
The Role of Sensitivity Analysis of the
Optimal Solution
102
Observe that OF line passes
Through the point C (Red Line). x2
If we draw lines in such a way
That every line passes through
Point C ( blue and black dotted 9
Line) and point C also remains
Optimum. E
8
Machine 1
7
5
Objective function line
4
This is possible only, if the OF
Line is between BF and DE 3
And passes through C, which B
will Always give optimum 2 optimum 3.2, 1.6, z=128
solution c Machine 2
1
A D F x1
0 0 1 2 3 4 5 6 7 8
103
To determine the ranges for OF
coefficients
x2
z = c1x1+c2x2 [1]
5
Objective function line
4
3
B
The ratio c1/c2 should vary 2 optimum 3.2, 1.6, z=128
Between 1/3 (slope of M/C 2) c Machine 2
and 2/1 (slope of M/C 1 eq) 1
1 c1 2 A D F
0 0 1 2 3 4 5 6 7 8
x1
3 c2 1 104
The ratio c1/c2 should vary
Between 1/3 (slope of M/C 2)
and 2/1 (slope of M/C 1 eq)
1 c1 2
3 c2 1
Q1: if c2 remains fixed i.e. 20 units, what is the range of c1 without affecting the
optimal solution?
A1:
1 c1 2 20
c1 40
3 20 1 3
So long as c1 is between 6.67 and 40, the optimum solution remains unaffected.
Q2: if c1 remains fixed i.e. 30 units, what is the range of c2 without affecting the
optimal solution?
A2:
1 30 2
90 c2 15
3 c2 1
So long as c2 is between 90 and 15, the optimum solution remains unaffected.
105
Sensitivity Analysis of Change in Resource
Availability
106
If the daily capacity of M1 is
Changed from 8 to 9 hrs.
x2
what will be the change
in the OF?
9
The new optimum point moves
to point G and OF 142.
8 E
Machine 1: 2x1+x2 <=8
7
Machine 1: 2x1+x2 <=9
A D F x1
0
0 1 2 3 4 5 6 7 8
If the daily capacity of M1 is
Changed from 8 to 9 hrs.
what will be the change
in the OF?
“dual price” or
“Shadow price”
The dual price $14/hr remains
Valid for changes in M1 capacity x2
so long as M1 constraints
is parallel to itself and cuts the
Line segment at any point 9
Between point B and F
8
Q1: what should be the capacity E
Machine 1: 2x1+x2 <=8
Of M1, if the constraint M1 7
Passes through point B (0,2.67) Machine 1: 2x1+x2 <=9
6
2x0+1x2.67 = 2.67 hrs
5
Q2: what should be the capacity
Of M1, if the constraint M1
4
Passes through point F (8,0) Optimum (C) 3.2, 1.6, z=128
Optimum (G) 3.8, 1.4, z=142
2x8+1x0=16 hrs 3
B
Conclusion is that 2
The dual price $14/hr remains G
Valid in the range 1
c Machine 2
2.67 ≤ M1 capacity ≤ 16 0 A D F x1
0 1 2 3 4 5 6 7 8
If the daily capacity of M2 is x2
Changed from 8 to 9 hrs.
what will be the change
in the OF?
9
The new optimum point moves
to point G and OF 130. 8
E
7
Machine 1
4
Optimum (C) 3.2, 1.6, z=128
3
Optimum (G) 3, 2, z=130
B
2 G Machine 2: x1+3x2 <=8
c
1
A D F x1
0
0 1 2 3 4 5 6 7 8 9
If the daily capacity of M2 is
Changed from 8 to 9 hrs.
what will be the change
in the OF?
“dual price” or
“Shadow price”
x2
The dual price $2/hr remains
Valid for changes in M2 capacity
so long as M2 constraints
is parallel to itself and cuts the
9
Line segment at any point
Between point D and E
8
E
Q1: what should be the capacity
7
Of M2, if the constraint M2 Machine 1
Passes through point E (0,8)
6
A D F x1
4 ≤ M2 capacity ≤ 24 0
0 1 2 3 4 5 6 7 8 9
Conclusion is that Conclusion is that
The dual price $14/hr remains The dual price $2/hr remains
Valid in the range Valid in the range
Q2. IF the capacity of machine 1 is increased to 12 hrs, what will the total increase in OF
A2. $14 x (12-8) = $56, and the total OF = 128+56 =184
Q3. suppose the capacity of machine 1 is increased to 20
A3. As the upper limit for M1 = 16, we can not make any conclusion. Need for more calculations
Q4. IF the capacity of M1, and M2 are increased at additional cost of $10,
is it advisable to increase the capacities?
A2. Only M1 as the dual price is higher than cost. Not advisable for machine 2
114