Sei sulla pagina 1di 47

Solution Algorithm for LP

B. The Simplex Method

George B. Dantzig devised the simplex method of


solution in 1947. This has become a significant step in
bringing linear programming into wider use.
8/19/2019 1
2 8/19/2019
Feasible
region

CPF are O, A, P, and D


CPIF are C,and B
3 8/19/2019
Recall the procedures done in the
graphical method

• Firts the feasible region is Identified and then


• we keep increasing the Z value untill
nofurther increment is possible without
leaving the feasible region.

Much the same way, in the albegraic method


we start the solution and keep improving it without
rendering one of the constriants is violated. This is
the motivation for the simplex method.
8/19/2019 4
Algebra of the Simplex Method

The simplex method solve LP model by


exploting the three properties of feasible
extreme points.

8/19/2019 5
There are three important properties of
feasible extreme point in an LP problem
Property 1. If there is only one optimal solution to a linear
programming model, then it must be a feasible extreme
point. If there are multiple optimal solutions, then at
least two must be adjacent feasible extreme points.
Property 2. If a feasible extreme point is better (measured
with respect to X0) than all its adjacent feasible points,
then it is better than all other feasible extreme points
(i.e., it is a global optimum).
Property 3. there are only a finite number of feasible
extreme points. i.e.
Any method that checks only corner points will terminate
eventually.
8/19/2019 6
LP- Motivation of Simplex Method

Let us consider the previous problem


Maximize z = 2x1 + x2
Subject to 3x1 + x2 ≤ 300
x1 + x2 ≤ 200
x1, x2 ≥ 0

8/19/2019 7
First the LP model has to be converted
into the standard form as follows

z = 2x1 + x2 + 0x3 + 0x4 This is the OF


S.T 3x1 + x2 ≤ 300 3x1 + x2 + x3 = 300
x1 + x2 ≤ 200 x1 + x2 + x4 = 200
x1, x2, x3 , x4 ≥ 0
Here there are two equations and four
unknowns.
X1 and x2 are decission variables
x3 , and x4 are slack variables.
8/19/2019 8
LP- Simplex Method Some terminologies
For a LP model with n numbers of total variables
and m numbers of slack variables:

• Basic Solutions: A basic solution is a solution


obtained by setting (n- m) variables to zero.
• The m varibles whose solution is sought by setting
the remaining (n-m) variables to zero are called the
basic varaibles.
• The (n-m) variables which are set to zero are
called the non-basic variables.

8/19/2019 9
Motivation of Simplex Method

• Since out of n variables, any of the (n – m) variables


may be set to zero, the number of basic solutions will
correspond to the number of ways in which m
variables can be selected out of n variables i.e.,

nCm  n! 3x1 + x2 + x3 = 300


m!(nm)! x1 + x2 + x4 = 200

For the problem being considered, with n=4 and m=2 the
number of basic solutions will be 6.

8/19/2019 10
Motivation of Simplex Method
3x1 + x2 + x3 = 300
x1 + x2 + x4 = 200
In the example the basic solutions are
X1 X2 X3 X4 Point on feasible
graph
0 0 300 200 O Y
0 300 0 -100 C N
0 200 100 0 A Y
50 150 0 0 P Y
200 0 -300 0 B N
100
8/19/2019
0 0 100 D Y 11
CPF are O, A, P, and D
CPIF are C,and B

X1 X2 X3 X4 Point on graph feasible


0 0 300 200 O Y
0 300 0 -100 C N
0 200 100 0 A Y
50 150 0 0 P Y
200 0 -300 0 B N
8/19/2019 100 0 0 100 D Y 12
Motivation of Simplex Method

• All the basic solutions need not ( and, in


general, will not) be feasible solutions.

• A basic solution which is also feasible is


called Basic Feasible Solution.

• All the corner points of the feasible space


are basic feasible solutions.

8/19/2019 13
Motivation of Simplex Method

• As the size of a LP problem increases, the


number of basic solutions also increases.
• The possible number of basic feasible
solution can be too large to be
enumerated completely.
• The goal would be, starting with an initial
basic feasible solution, to generate better
and better basic feasible solution until the
optimal basic feasible solution is obtained.

8/19/2019 14
Algebraic approach (Simplex algorithm):
Maximize z = 2x1 + x2 + 0x3 + 0x4

S.T 3x1 + x2 + x3 = 300


x1 + x2 + x4 = 200
x1, x2, x3 , x4 ≥ 0

To solve the problem algebraically, we must be


able to sequentially generate a set of basic
feasible solution.
8/19/2019 15
Steps in applying the algebraic method
1. Determine an initial basic feasible solution:
• The best way to obtain an initial basic
feasible solution would be to put all the
decision variables to zero.
• In the example, choose the slack variables x3
and x4 to be basic and x1 and x2 to be non
basic. (i.e., set x1 = 0 and x2= 0).

x3  3x1 + x2 + x3 = 300


: 
basis
8/19/2019
x4 x1 + x2 + x4 = 200
16
LP- Simplex Method

• Solve the m= 2 equation for m basic variables.


3x1 + x2 + x3 = 300 X3 = 300

x1 + x2 + x4 = 200 X4 = 200

Point ´O` on the graph

x3  300
Initial basic feasible solution is
x   200
8/19/2019 Z= 0  4   17
LP- Simplex Method
2. The next step is to generate another basic
feasible solution from the intitial basic feasible
solution such that there is an improvement in
the objective function value , Z (iteration).
• The new solution is obtained as follows:
 ONE presently non-basic variable (x1 or x2) must
be selected to enter the current basis, thus
becoming basic.
 ONE presently basic variable (x3 or x4) must be
selected to leave the current basis, thus
8/19/2019
becoming non-basic. 18
LP- Simplex Method
z = 2x1 + x2 + 0x3 + 0x4
• Either x1 or x2 can enter the basis.
• The question now is, out of x1 and x2 which
variable should enter the basis?
• Since the problem is maximization of the
objective function (OF), we must look for the
variable which will increase the OF value the
fastest.
• Becuase the coefficient of x1 in the OF is higher
than that of x2, x1 increases the OF value faster
than x2 does. Hence x1 should enter the basis
( Optimality Condition).
8/19/2019 19
LP- Simplex Method
• As the value of the newly selected basic
variable x1, is increased ( x2 still being zero),
the other two variables, x3 and x4 ( which are
currently in the basis) keep reducing.
• One of these will reach its lower limit (zero)
earier than the other (feasibility condition).
X3 = 300 – 3x1 3x1 + x2 + x3 = 300
X4 = 200 – x1 x1 + x2 + x4 = 200
• X3 = 0 when x1 = 100 X3 reachs first zero
8/19/2019 • X4 = 0 when x1 = 200 than x4 20
LP- Simplex Method
Solution
•The new basis is
x1  x1  100
x  x   100
 4  4  
Z= 200
It is Point D in the graph.

• The new basic solution is obtained by Guass-Jordan


elimination method.
• The process continues until the maximum value of
the function is arrived at.

8/19/2019 21
LP- Simplex Method
The LP problem now can be solved algebraically
following the three steps of the algorithm outlined
below.
1. Initialization step: - Start at a feasible extreme
point.
2. Iterative step: - Move to a better adjacent
feasible extreme point.
3. Stopping Rule: - Stop iteration when the
current feasible extreme point is better than all
its adjacent extreme points.
8/19/2019 22
The overall procedure of a simplex method
can be done using a Table called the simplex
table/Tableau.
Let us consider the previous problem
Maximize z = 2x1 + x2
Subject to 3x1 + x2 ≤ 300
x1 + x2 ≤ 200
x1, x2 ≥ 0

8/19/2019 23
First the problem has to be converted into
the standard form

z = 2x1 + x2 + 0x3 + 0x4


S.T 3x1 + x2 + x3 = 300
x1 + x2 + x4 = 200
x1, x2, x3 , x4 ≥ 0

The solution is obtained by creating a table with


coefficients of variables.
8/19/2019 24
z - 2x1 - x2 - 0x3 - 0x4 =0 row 0
3x1 + x2 + x3 = 300 row 1
x1 + x2 + x4 = 200 row 2
Initialization (preparing the simplex tableau- 1)

Basis Row Z X1 X2 X3 X4 bi

Z 0 1 -2 -1 0 0 0

X3 1 0 3 1 1 0 300

X4
8/19/2019
2 0 1 1 0 1 200 25
Example (contd.)
• Once we construct the simplex table and
intializing the solution.
• We ask the question that, is the solution
optimal? Actually this is the question we
need to ask at each iteration.
• This is decided based on the coefficient in
the Z row. If there is atleast one coefficient
with negative value it means that the Z
value can be improved further.
• In this particular example the current
solution is not optimal. Why?
8/19/2019 26
Example (contd.)
Decision to be made at each iteration:
• whether the curent solution is optimal?
 The solution is optimal only if all the coefficients in
the Z- row are non- negative.
• If the solution is not optimal:
 which is the enetering variable?
 The variable with highest negative
coefficient in Z row is the entering variable.
 which is the departing variable?
 the variable with the minimum bi/aij (calculated
8/19/2019only if both b and a are +ve.) 27
i ij
z - 2x1 - x2 - 0x3 - 0x4 =0
Entering variable 3x1 + x2 + x3 = 300
Initialization x1 + x2 + x4 = 200

Basis Row Z X1 X2 X3 X4 bi bi/aij


Departing variable

Z 0 Pivot column
1 -2 -1 0 0 0 -

X3 1 0 3 1 1 0 300 100

X4 2 0 1 1 0 1 200 200

8/19/2019 Pivot Pivot row 28


Table for the next Iteration
• Change the basis by replacing the departing
variable with the entering variable.
• Divide the pivotal row throughout by the
pivot value.
• Get all other numbers in the new table by
using the Guass-Jordan elimination as
follows: R*C
Enew  Eold 
P
Where R is number in the pivotal column, C is the
number in the pivotal row and P is the pivot value
8/19/2019 29
z - 2x1 - x2 - 0x3 - 0x4 =0
3x1 + x2 + x3 = 300
x1 + x2 + x4 = 200
Entering variable
Iteration 1 (Tableau-2)

Basis Row Z X1 X2 X3 X4 bi bi/aij


Departing variable

Z 0 1 0 -1/3 2/3 0 200 -

X1 1 0 1 1/3 1/3 0 100 300

8/19/2019
X4 2 0 0 2/3 -1/3 1 100 150 30
z - 2x1 - x2 - 0x3 - 0x4 =0
3x1 + x2 + x3 = 300
x1 + x2 + x4 = 200
Iteration 2 (Tableau-3)

Basis Row Z X1 X2 X3 X4 bi

Z 0 1 0 0 1/2 1/2 250

X1 1 0 1 0 1/2 -1/2 50

X2 2 0 0 1 -1/2 3/2 150


8/19/2019 31
To check the correctness of all the
calculations in the simplex Method

 All the basic variables have a coefficient of zero


in the Z-row.
 Coefficients of basic variables constitute a unit
matrix.
x1 x2 x3 In the example just shown
X1 1 0 0 x1 x2
X2 0 1 0 x1 1 0
X3 0 0 1 x2 0 1

8/19/2019 32
Special cases

8/19/2019 33
8/19/2019 choose any one arbitrarily. 34
Cases for a tie
• Departing variable: If the ratio is the same
between two rows, and is also the minimum
among the ratios for all rows, there is a tie for the
departing variable. Here also, any one variable can
be arbitrarily selected as the departing variable.
This results in a degenerate solution.
• Degeneracy reveals that there is at least one
redundant constrain.
• Unfortunately, on some examples, degeneracy
may lead to cycling, i.e. a sequence of pivots that
goes through the same tableaus and repeats itself
indefinitely. (“cycling”)
This may indicate that the problem may not be formulated
correctely and requires to reformulate it again.
8/19/2019 35
Case of Multiple solutions
• Multiple solutions are alternate solutions to a
problem yielding the same optimum value of
the OF.
• Existence of multiple solution is indicated by
the presence of a zero in the z-row under a
non-basic variable in the final simplex tableau
giving optimal solution.
• The alternate solution is obtained by choosing
this non-basic variable as the entering variable,
and finding a new solution in the next iteration.

36 8/19/2019
Duality

8/19/2019 37
8/19/2019 38
8/19/2019 39
8/19/2019 40
8/19/2019 41
8/19/2019 42
8/19/2019 43
8/19/2019 44
8/19/2019 45
8/19/2019 46
Further readings?

• Sensitivity analysis and application of


various LP software packed (excel solver
and GAMS).

8/19/2019 47

Potrebbero piacerti anche