The Simplex Method and Sensitivity Analysis
The Simplex Method and Sensitivity Analysis
1
Simplex Method
- Also called simplex technique or simplex algorithm
- It is universal that is any linear model for which the
solution exists can be solved by simplex method
- The simplex method attempts to move from one
corner point of the solution space to a better corner
point until the optimum is found
2
3.1 LP model in equation form (standard
form)
- All variables are non-negative
- The right-hand side of each constraint is
non-negative
- All constraints are expressed as equations (=)
- Objective function may be of maximization or
minimization type
- Unrestricted variables or unconstrained variables
3
3.1.1 Converting Inequalities into Equations
with Non-negative Right-hand side
4
i) Slack or unused variable (inequality <):
- The difference between the Right-Hand Side (R.H.S) and Left-Hand Side (L.H.S) of
the (inequality <) constraint thus yields the unused or slack amount of the resource.
5
ii) Surplus or extra variable (inequality >):
- The difference between the Left-Hand Side (L.H.S) and Right-Hand Side(R.H.S)
of the (inequality >) constraint thus yields the surplus or extra amount of the
resource.
L.H.S - R.H.S = surplus or extra amount
6
Right-hand side of the constraint to be non-negative:
Example:
First method:-
(L.H.S) - 3x1 + 2x2 > -15 (R.H.S)
Convert to equation (=),
(L.H.S) - 3x1 + 2x2 - s1 = -15 (R.H.S)
s1 > 0
Multiply both sides of the equation by -1 to get non-negative right-hand side ,
3x1 - 2x2 + s1 = 15 1
Second method:-
(L.H.S) - 3x1 + 2x2 > -15 (R.H.S)
Multiply both sides of the constraint by -1 to get non-negative right-hand side ,
(L.H.S) 3x1 - 2x2 < 15 (R.H.S)
Convert to equation (=),
3x1 - 2x2 + s1 = 15 2
s1 > 0
7
3.1.2 Dealing with unrestricted or unconstrained variables
8
Example:
Express the following LP problem in the standard form:
Maximize z = 4x1 + 6x2 + 2x3
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7x3 < 8
4x1 - 10x2 + 2x3 > 3
x 1 > 0 , x2 > 0
Solution:
Here x1 and x2 are restricted to be non-negative variables while x3 is unrestricted variable.
Let x3 = y1 – y2 where y1 > 0 and y2 > 0 , then above LP problem can be written as,
Maximize z = 4x1 + 6x2 + 2(y1 – y2)
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7(y1 – y2) < 8
4x1 - 10x2 + 2(y1 – y2) > 3
x1 > 0 , x2 > 0, y1 > 0, y2 > 0
9
or
Maximize z = 4x1 + 6x2 + 2y1 – 2y2
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7y1 + 7 y2 < 8
4x1 - 10x2 + 2y1 –2 y2 > 3
x1 > 0 , x2 > 0, y1 > 0, y2 > 0
10
3.2 Transition from Graphical to Algebraic
Solution
- LP Solution by Graphical method is obtained
by the corner points of the feasible space
satisfying all the constraints.
- For transition from graphical to algebraic
method , the solution space is represented by
m simultaneous linear equations and
13
Algebraic Determination of Corner Points
14
To understand the above points, let us solve.
Example 3.2-1
Consider the following LP with two variables:
15
Some important definitions:-
Solution:
A set of variables xj (j = 1,2,3,4,……n) is called a
solution to the LP problem if it satisfies the constraints.
Feasible Solution:
A set of variables xj (j = 1,2,3,4,……n) is called a
feasible solution to the LP problem if it satisfies the constraints
as well as non-negativity restrictions xj > 0 (j = 1,2,3,4,……n) , si >
0 (i = 1,2,3,4,……m) .
Non-Basic Variables:
Set (n – m) variables equal to zero are called non-basic variables.
Basic Variables:
The values of remaining from n variables (some of them may be
zero) are called basic variables.
16
Basic Solution:
A solution obtained by setting (n – m) variables equal to zero
and solving of remaining from n variables (some of them may
be zero) is called a basic solution . (Together non-basic variables
and basic variables give a basic solution).
Basic Feasible Solution:
A basic solution which is feasible, is said to be a basic feasible
solution.
Non-Degenerate Basic Feasible Solution:
It is a basic feasible solution in which all the basic variables are
positive or non-zero ( value of basic variable > 0) .
Degenerate Basic Feasible Solution:
It is a basic feasible solution in which one or more of the basic
variables are equal to zero ( value of basic variable = 0) . 17
Optimal Solution:
A basic feasible solution is said to be optimal if it optimizes the
objective function.
Convex Set in Linear Programming (LP):
The feasible solution space is said to form a convex set, if for any
two feasible points in the set ,the line segment joining any two
feasible points lies entirely in the set.
Extreme Point (Corner Point):
Every basic feasible solution of a LP is an extreme point of the
convex set of feasible solutions and every extreme point is a basic
feasible solution of the set of the constraints.
18
Convex set
Non-convex set 19
3.3 The Simplex Method
20
3.3.1 Iterative Nature of the Simplex Method
For maximize z:
-Normally , the simplex method starts at the origin (0,0)
where x1 = 0 , x2 = 0 . Both x1 and x2 are non-basic
variables.
- At this starting point the value of the objective
function z = 0 .
- In an objective function z it is to be decided which of
the two non-basic variables above their current zero
values can improve (increase) the value of z.
- In simplex method one non-basic variable is increased
at a time.
- The non-basic variable which has the largest rate of
improvement in z is selected.
21
For minimize z:
- Both x1 and x2 are non-basic variables.
- In an objective function z it is to be decided
which of the two non-basic variables can improve
(decrease) the value of z.
- In simplex method one non-basic variable is
decreased at a time.
- The non-basic variable which has the smallest
rate of improvement in z is selected.
- Either x1 or x2 will be selected in the objective
function z which has the smallest rate of
improvement .
22
Maximize z = 2x1 + 3x2
- The objective function z shows that an increase
in either x1 or x2 or both above their current
zero values will improve(increase) the value of z.
- The rate of improvement in z is 2 for x 1 and 3 for
x2 .
- We therefore select to increase x2 , the variable
with the largest rate of improvement.
23
24
Figure 3.4 Iterative process of the simplex method of Example 3.2-1
25
- The figure 3.4 shows that the value of x2 will be increased
from point A origin until corner point B is reached.
- At point B simplex method will then increase the value of
x1 to reach the improved corner point C, which is the
optimum.
- The path of the simplex method is thus defined
as A B C .
- Each corner point along the path is associated
with an iteration.
- Simplex method moves alongside the edges of the solution
space which means that the method cannot cut across the
solution space, for example going from A to C directly
cannot be done.
26
- We need to make transition from graphical solution
to the algebraic solution by showing how the points
A , B and C are represented by their basic and non-
basic variables .
- The following table summarizes these
representations:
Corner point Basic variables Non-basic (zero) variables
A s 1 , s2 x 1, x 2
B s 1 , x2 x 1 , s2
C x 1, x 2 s 1 , s2
27
- We can notice that there is a change pattern in the
basic and non-basic variables as the solution
moves along the path A B C.
- In simplex method there are entering and leaving
variables.
- Entering variable means that variable which is
going from non-basic variable to basic variable.
- Leaving variable means that variable which is
going from basic variable to non-basic variable.
28
- From A to B x2 is the entering variable because it enters the basic
solution .
- From A to B s2 is the leaving variable because it leaves the basic
solution .
- From B to C x1 is the entering variable because it enters the basic
solution .
- From B to C s1 is the leaving variable because it leaves the basic
solution .
Corner point Basic variables Non-basic (zero) variables
A s 1 , s2 x1, x2
B s 1 , x2 x 1, s 2
C x 1, x2 s 1 , s2
29
3.3.2 Computational Details of the Simplex
Algorithm
- The computational details of a simplex iteration explains rules
for determining the entering and leaving variables as well as
for stopping the computations when the optimum solution has
been reached.
30
Find all the basic solutions to the following
problem. Also find which of the basic solutions
are (i) basic feasible solution (ii) non-degenerate
basic feasible solution (iii) optimal basic feasible
solution.
Maximize z = x1 + 3x2 + 3x3
subject to
x1 + 2x2 + 3x3 = 4 1
x1 , x2 , x3 > 0
31
Solution:
- Here m = 2 ( number of equations) , n = 3
(number of non-negative variables) .
- Total number of corner points or basic solutions are,
C = 3!___ = 3!___ = 3 X 2 X 1_ = 3
2!(3-2)! 2! 1! 2X1X1
- Number of non-basic variables are,
n–m =3–2=1
- When x1 = 0 (non-basic variable), then x2 and x3 are basic
variables.
Put x1 = 0 in equations 1 and 2to
3x2 + 5x3 = 7 2’
Multiply eq 1’ by 3 and eq 2’ by 2 ,
2x2 + 3(2) = 4
2x2 + 6 = 4
2x2 = 4 – 6
x2 = -2
2
x2 = -1
Therefore x1 = 0 , x2 = -1 and x3 =2
34
- When x2 = 0 (non-basic variable), then x1 and x3 are
basic variables.
Put x2 = 0 in equations 1 and 2to
2x1 + 5x3 = 7 2’
35
Multiply eq 1’ by 2 ,
2x1 + 6x3 = 8 1’’
Subtract eq 2’ from eq 1’’,
2x1 + 6x3 = 8 1’’
+ 2x1 + 5x3 = + 7 2’
___________________
x3 = 1
Put x3 = 1 in eq 1’to get value of x1,
x1 + 3x3 = 4 1’
x1 + 3(1) = 4
x1 + 3 = 4
x1 = 4 – 3
x1 = 1
Therefore x1 = 1 , x2 = 0 and x3 = 1
36
- When x3 = 0 (non-basic variable), then x1 and x2 are
basic variables.
Put x3 = 0 in equations 1 and 2 to
2x1 + 3x2 = 7 2’
Multiply eq 1’ by 2 ,
2x1 + 4x2 = 8 1’’
37
Subtract eq 2’ from eq 1’’,
+ 2x1 + 3x2 = + 7 2’
__________________
x2 = 1
Put x2 = 1 in eq 1’to get value of x1,
x1 + 2x2 = 4 1’
x1 + 2(1) = 4
x1 + 2 = 4
x1 = 4 – 2
x1 = 2
Therefore x1 = 2 , x2 = 1 and x3 = 0
38
Serial Non-basic Basic Basic Basic Non-degenerate Objective
number variables variables solution feasible basic feasible value
solution solution z_____
Max Z=2x1+3x2
ST.
2x + x 2 < 4
1
x1 + 2x2 < 5
x1 , x 2 > 0
40
41
Example:
Solve the following LP problem by simplex
method.
Max z = 5x1 - 4x2
subject to
6x1 + 4x2 < 24
x1 - 2x2 <6
-x1 + x2 <1
x2 < 2
x1 , x2 > 0
42
Solution:
1- Convert constraints to equation or standard form.
Max z = 5x1 - 4x2
subject to
6x1 + 4x2 + s1 = 24
x1 - 2x2 + s2 = 6
-x1 + x2 + s3 = 1
x2 + s4 = 2
x1 , x2 , s1 , s2 , s3 , s4 > 0
43
2- Put the coefficient of equation in a table
Basic X1 X2 S1 S2 S3 S4 Sol.
RH
S
S1 6 4 1 0 0 0 24
S2 1 2 0 1 0 0 6
S3 -1 1 0 0 1 0 1
S4 0 1 0 0 0 1 2
z -5 -4 0 0 0 0 0
44
3- Determine Entering variable.
Entering variable - max negative number in the objective
Entering variable
Basic X1 X2 S1 S2 S3 S4 Sol.
RH
S
S1 6 4 1 0 0 0 24
S2 1 2 0 1 0 0 6
S3 -1 1 0 0 1 0 1
S4 0 1 0 0 0 1 2
z -5 -4 0 0 0 0 0
45
4- Find the Leaving variable
Entering variable
46
5- Find the Pivot value , Pivot Element
Pivot Value = 6
=( 1, 4/6, 1/6, 0, 0, 0, 4)
47
6- Gauss-Jordan row operations:
1. Replace the leaving variable in the Basic column with the
entering variable.
2. All other rows , including z:
New row = Current row – {(Pivot column co-efficient) X (New pivot
row)}
- s2 -row:
(1, 2, 0, 1, 0, 0, 6) – (1)(1 , 4/6, 1/6, 0,0,0,4)
= (0, 4/3, -1/6, 1, 0, 0, 2)
Now take a look to Z row if you get a positive and zero values stop work
IF not Repeat all steps from step 3 until you reach positive or zeros values
49
Entering variable
X1 1 2/3 1/6 0 0 0 4 6
S2 0 4/3 -1/6 1 0 0 2 1.5 Leaving variable
S3 0 5/3 1/6 0 1 0 5 3
S4 0 1 0 0 0 1 2 2
z 0 -2/3 5/6 0 0 0 20 No
need
50
Basic X1 X2 S1 S2 S3 S4 Sol.
RHS
X1 1 0 1/4 -1/2 0 0 3
X2 0 1 -1/8 3/4 0 0 3/2
S3 0 0 3/8 -5/4 1 0 5/2
S4 0 0 1/8 -3/4 0 1 ½
z 0 0 3/4 1/2 0 0 21
Now let see Z Row we find all values is positive and zeros
SO Stop work
We reach the optimal solution
X1= 3
X2= 3/2
Z= 21
51
3.3.3 Summary of the Simplex Method
Step 1
- Determine a starting basic feasible solution.
Step 2
- Select an entering variable using the optimality condition . Stop
if there is no entering variable , then the last solution is optimal.
- Else go to step 3.
Step 3
- Select a leaving variable using the feasibility condition.
Step 4
- Determine the new basic solution by using the appropriate
Gauss-Jordan computations.
- Go to step 2.
55