You are on page 1of 53

1

LPPs in Standard Form

Algebraic Solutions

Simplex Method

Algebra of Simplex Method

Examples

Manoj Kumar Pandey, OPTIMIZATION


Algebraic Solution of LPPs

To solve an LPP algebraically, we first put it in the


standard form. That is all the variables are nonnegative and
all constraints (other than the non-negativity restrictions)
are equations with nonnegative RHS.

Manoj Kumar Pandey, OPTIMIZATION 2


Standard algebraic form of LPP

Change all constraints to equations with non negative


RHS.

All variables should be non negative.

Manoj Kumar Pandey, OPTIMIZATION 3


Changing inequalities into equations (using SLACK
and SURPLUS variables)

SLACK VARIABLE: A slack variable is used to change a ( )


inequality to equation.

SURPLUS VARIABLE: A surplus variable to change a ()


inequality to equation.

Note : the slack and surplus variables are always non-negative

If the RHS of the equation is negative then multiply both


sides of the equation by -1.

Manoj Kumar Pandey, OPTIMIZATION 4


Example 1:

Write the following LPP in the standard form:


Maximize z = x1 + x2
subject to
x1 + 2x2 6 --- (1)

2x1 + x2 16 --- (2)

x1 , x2 0

Manoj Kumar Pandey, OPTIMIZATION 5


Change all inequalities into equations by using slack or
surplus variables
Slack variable

x1 + 2x2 + s1 = 6

2x1 + x2 s2 = 16

Surplus variable

Hence the standard form of the LPP :


Maximize z = x1 + x2
subject to
x1 + 2x2 + s1 = 6

2x1 + x2 s2 = 16

x1 , x2 , s1 , s2 0

Manoj Kumar Pandey, OPTIMIZATION 6


Example 2

Write the following Linear programming problem in


the standard form:
Min z = 3x1 + x2 x3
Subject to
2x1 x2+x3 6

x1 + 3x2 -7x3 -16

x1 0, x2 0

Manoj Kumar Pandey, OPTIMIZATION 7


Standard Form
x2 0
We will introduce a new variable y2 , defined by
y2 = -x2 , and we will replace x2 by y2 in the LPP

since x2 0 y2 0
Unrestricted variables

The unrestricted variables can be written as a function


of two non negative variables.

Here x3 is unrestricted in sign, we introduce two new variables


x3+ 0 and x3- 0, and define
x3= x3+- x3-

Manoj Kumar Pandey, OPTIMIZATION 8


Objective function : 3x1 - y2 (x3+- x3-)

Constraints:

2x1 x2+x3 6
2x1 + y2 + (x3+- x3-) + s1 = 6
x1 + 3x2 -7x3 -16
-x1 - 3x2 +7x3 16
-x1 + 3y2 +7(x3+- x3-) + s2 = 16
with
x1 0, y2 0, x3+ 0, x3- 0, s1 0, s2 0

Manoj Kumar Pandey, OPTIMIZATION 9


The LPP in the standard form is:

Min. Z = 3x1 - y2 (x3+- x3-)

Subject to

2x1 + y2 + (x3+- x3-) + s1 = 6


-x1 + 3y2 +7(x3+- x3-) + s2 = 16
x1 0, y2 0, x3+ 0, x3- 0,
s1 0, s2 0

Manoj Kumar Pandey, OPTIMIZATION 10


Basic Variables, Basic Feasible Solutions

Consider an LPP (in standard form) with m constraints and n


variables.

We assume m n. We choose n m variables and set them


equal to zero. Thus we will be left with a system of m
equations in m variables. If this square system has a unique
solution, this solution is called a basic solution.

Further if it is feasible, it is called a Basic Feasible Solution


(BFS).

Note that a system may have a maximum of nCm basic solutions

Manoj Kumar Pandey, OPTIMIZATION 11


The n m variables set to zero are called nonbasic and the m
variables which we are solving for are known as basic
variables.

Thus a basic solution is of the form x = (x1, x2, , xn) where


n m components are zero and the remaining m variables
form the unique solution of the square system (formed by the
m constraint equations).

Nondegenerate BFS: If all the m basic variables in a


BFS are strictly positive than it is called nondegenerate
basic feasible solution.

Manoj Kumar Pandey, OPTIMIZATION 12


Any values of variables that satisfy all the
constraints of the model is called a feasible
solution.

Optimum feasible solution is the one that gives the


optimum value while satisfying all the constraints.

The set of all feasible solutions is known as the


feasible region.

Manoj Kumar Pandey, OPTIMIZATION 13


Manoj Kumar Pandey, OPTIMIZATION 14
Manoj Kumar Pandey, OPTIMIZATION 15
(2, 0, 4, 0)

(6/7, 12/7, 0,
0)

Manoj Kumar Pandey, OPTIMIZATION 16


Graphical Solution

Feasible Region (PF)

Manoj Kumar Pandey, OPTIMIZATION 17


PF is a vertex of PF X is
Theorem: A point X
a BFS.

PF : Feasible Region

Manoj Kumar Pandey, OPTIMIZATION 18


Example 2

Without sketching the feasible region find the vertices


for the system, hence find the optimal solution

Max z = 3x1 + x2

Subject to
-x1 + x2 1

2x1 + x2 2
x1 , x2 0

Manoj Kumar Pandey, OPTIMIZATION 19


Here n=4, m=2 , hence there are

nC =6 basic solutions.
m

To find all basic solutions we take any of the two


variables (at a time) as basic variables from the
set {x1, x2 , s1, s2 } to have

( 1/3, 4/3, 0, 0), (1, 0, 2, 0), (-1, 0, 0, 4),

(0, 2, -1, 0), (0, 1, 0, 1), (0, 0, 1, 2).

The system has 6 basic solutions, and out of these,


4 are basic feasible solutions

Manoj Kumar Pandey, OPTIMIZATION 20


Remark: In the absence of degeneracy there exists a one-one
correspondence between the set of basic feasible solutions and the
set of vertices of the feasible region.
Degeneracy makes the simplex algorithm slower.

Example 3 Find all the basic solutions

Min. z = 3x1 + x2

Subject to x1 + x2 8

-x1 + x2 0

x1 , x2 0

Manoj Kumar Pandey, OPTIMIZATION 21


Important Results:
If an optimal solution exists, there is always a corner
point optimal solution.

Every basic feasible solution corresponds to a vertex of


the feasible region.

Degeneracy makes the simplex algorithm slower.

Manoj Kumar Pandey, OPTIMIZATION 22


Transition from Graphical to Algebraic Solution
23

Graphical Method Algebraic Method

Graph all constraints, solution Represent the solution space in


space has infinity of feasible the equation form, the system
solutions has infinity of feasible solution.

Candidates for the optimum Candidates for the optimum


solution are given by a finite solution are the finite number of
number of feasible corner basic feasible solution
points

Using the objective function Using the objective function


determine the optimal solution. determine the optimal solution.

Manoj Kumar Pandey, OPTIMIZATION


Simplex Method
24

In optimization theory, the simplex algorithm, is a popular algorithm


for numerically solving linear programming problems.

The algorithm was created by the American Mathematician


George B. Dantzig in 1947.

The journal Computing in Science and Engineering

Listed as one of the top 10 algorithms of the century.

The method uses the concept of a simplex, which is a polytope (such


as polygon, polyhedron etc.,) with finite number of vertices.

Manoj Kumar Pandey, OPTIMIZATION


How to Solve an LPP of higher dimension ?
 The constraints of a Linear Programming Problem give
rise to a polytope with finite number of vertices.

 If we can determine all the vertices of the polytope, then


we can calculate the value of the objective function at
these points and take the best one as our optimal
solution.

 The Simplex Method is an iterative method which


moves from one vertex to another vertex (in the
direction of optimum improvement) until the optimal
solution is reached

Manoj Kumar Pandey, OPTIMIZATION 25


Manoj Kumar Pandey, OPTIMIZATION 26
Simplex Method
An iterative
Initialization
procedure
(Find initial BFS)

Is the current Stop


BFS optimal?

Move to a better
adjacent BFS

Manoj Kumar Pandey, OPTIMIZATION 27


Initial Assumptions

All constraints are of the form type

All right-hand-side values (bj, j=1, ,m) must


be non-negative

Manoj Kumar Pandey, OPTIMIZATION 28


Algebra of the Simplex Method
29

Let us consider the following LPP

Maximize Z= 3x1+ 5x2


subject to
x1 4
2x2 12
3x1+ 2x2 18

x1, x2 0

Manoj Kumar Pandey, OPTIMIZATION


Standard form :

Maximize Z= 3x1+ 5x2

subject to x1 +s1 =4
2x2 +s2 = 12
3x1+ 2x2 +s3 = 18

x1,x2, s1, s2, s3 0

Manoj Kumar Pandey, OPTIMIZATION 30


Initialization

Find an initial basic feasible solution

If possible, use the origin as the initial BFS

Equivalent to:

Choose original variables to be nonbasic (xi=0, i=1,n) and let


the slack variables be basic (sj=bj, j=1,m)

Manoj Kumar Pandey, OPTIMIZATION 31


Optimality Test

Are any adjacent BFS better than the current one?


Rewrite Z in terms of nonbasic variables and investigate rate
of improvement
Current nonbasic variables: x1 , x2
Corresponding Z: Z = 3x1 + 5x2

Manoj Kumar Pandey, OPTIMIZATION 32


Direction of Movement

Which edge to move on?


Determine the direction of movement by selecting the
entering variable (variable entering the basis)
Choose the direction of steepest ascent
x1: Rate of improvement in Z = 3
x2: Rate of improvement in Z = 5

Entering basic variable = x2

Manoj Kumar Pandey, OPTIMIZATION 33


The nonbasic variable that will become basic is
referred to as entering variable.

The basic variable that will become nonbasic is


referred to as leaving variable.

Criterion for entering variable


Choose that variable as the entering variable which has the
most ve coefficient in the z-row in case it is a maximization
problem (most +ve coefficient in the z-row in case it is a
minimization problem).

Manoj Kumar Pandey, OPTIMIZATION 34


Criterion for leaving variable (Feasibility Condition)

Let bi be the RHS of the ith row.

Let aij be the coefficient of the entering variable xj in the ith row.

The following minimum ratio test decides the leaving variable


Choose xk as the leaving variable where k is given as that row
index i for which the ratio

bi
, aij > 0 is Minimum
aij

Manoj Kumar Pandey, OPTIMIZATION 35


Simplex Method in Tabular form
36

Let us consider the following problem

Maximize Z= 3x1+ 5x2

subject to
x1 4
2x2 12
3x1+ 2x2 18
x1, x2 0

Manoj Kumar Pandey, OPTIMIZATION


Write as system of equations

Z- 3x1 - 5x2 =0
x1 +s1 =4
2x2 +s2 = 12
3x1+ 2x2 +s3 = 18

Manoj Kumar Pandey, OPTIMIZATION 37


Basic
variable
Z x1 x2 s1 s2 s3 Solution

s1

s2

s3

Manoj Kumar Pandey, OPTIMIZATION 38


 Z-row is the objective equation row.

 The remaining 3 rows are the basic variable rows.

 Each row corresponds to a basic variable

Manoj Kumar Pandey, OPTIMIZATION 39


Iteration 1 :

Basic
Z x1 x2 s1 s2 s3 Solution
variable

Z 1 -3 -5 0 0 0 0

s1 0 1 0 1 0 0 4

s2 0 0 2 0 1 0 12

s3 0 3 2 0 0 1 18

Manoj Kumar Pandey, OPTIMIZATION 40


Choose that variable as the entering variable which has the most ve
coefficient in the z-row in case it is a maximization
x2 enters the basis
Basic Min.
Z x1 x2 s1 s2 s3 Solution
variable Ratio
Z 1 -3 -5 0 0 0 0 No Ratio
s1 0 1 0 1 0 0 4 ---------
s2 0 0 2 0 1 0 12 12/2 =6
s3 0 3 2 0 0 1 18 18/9 =9

Minimum Ratio is corresponding to S2


S2 leaves the basis

Manoj Kumar Pandey, OPTIMIZATION 41


The entering variable column is called the pivot column.

The leaving variable row is called the pivot row.

The coefficient in the intersection of the two is referred to


as the pivot element.

Apply elementary row operations to modify the simplex tableau so


that the pivot column has 1 at the pivot element and zero in all
other places.

Manoj Kumar Pandey, OPTIMIZATION 42


Iteration 2 :

Min.
Basic Ratio
Z x1 x2 s1 s2 s3 Solution
variable

Z 1 -3 0 0 5/2 0 30 No Ratio

s1 0 1 0 1 0 0 4 4/1 = 4

x2 0 0 1 0 1/2 0 6 -------

s3 0 3 0 0 -1 1 6 6/3 =2

Stop: If all the entries in the Z-row are 0 ( or 0 )


in Max. (or Min.) then stop else repeat the iteration.

Manoj Kumar Pandey, OPTIMIZATION 43


Basic
Z x1 x2 s1 s2 s3 Solution
variable

Z 1 0 0 0 3/2 1 36

s1 0 0 0 1 1/3 -1/3 2

x2 0 0 1 0 1/2 0 6

x1 0 1 0 0 -1/3 1/3 2

All the entries in the Z-row are 0, hence we have reached


the optimal solution.

Optimal Solution: x1 = 2, x2 = 6, Z=36

Manoj Kumar Pandey, OPTIMIZATION 44


Optimal
Solution
(0, 6) (2, 6)

Feasible (4, 3)
Region

(0, 0) (4, 0)

Manoj Kumar Pandey, OPTIMIZATION 45


Example 2:

Min Z = x1 -2x2 + x3
subject to
x1 + 2x2 -2x3 4
x1 -x3 3
2x1 -x2 +2x3 2
x 1, x 2, x 3 0

Manoj Kumar Pandey, OPTIMIZATION 46


Standard Form

Min Z = x1 -2x2 + x3
subject to
x1 + 2x2 -2x3 + s1 =4
x1 -x3 + s2 =3
2x1 -x2 +2x3 + s3 = 2
x1, x2, x3 , s1, s2, s3 0

Manoj Kumar Pandey, OPTIMIZATION 47


System of equations

Z - x1 + 2x2 - x3 =0
x1 + 2x2 -2x3 + s1 =4
x1 - x3 + s2 =3
2x1 - x2 + 2x3 + s3 = 2

Manoj Kumar Pandey, OPTIMIZATION 48


BV Z x1 x2 x3 S1 S2 S3 Solution Ratio

Z 1 -1 2 -1 0 0 0 0 ---

S1 0 1 2 -2 1 0 0 4 4/2=2

S2 0 1 0 -1 0 1 0 3 -----
S3 0 2 -1 2 0 0 1 2 -----
Z 1 -2 0 1 -1 0 0 -4 ---

x2 0 1/2 1 -1 0 0 2 -----

S2 0 1 0 -1 0 1 0 3 -----
S3 0 5/2 0 1 0 1 4 4/1=1

Manoj Kumar Pandey, OPTIMIZATION 49


BV Z x1 x2 x3 S1 S2 S3 Solution Ratio

Z 1 -9/2 0 0 -3/2 0 -1 -8 ---

x2 0 3 1 0 1 0 1 6 -----

S2 0 7/2 0 0 1 1 7 -----
x3 0 5/2 0 1 0 1 4 -----

The table is Optimal, since all the coefficient in


Z-row are 0 (Minimization Problem).
Optimal solution : x1= 0, x2 = 6, x3 = 4, Z = -8

Manoj Kumar Pandey, OPTIMIZATION 50


Example 3:

Max Z = -x1 +3x2 -3x3


subject to
3x1 -x2 +x3 7
-x1 +2x2 6
-4x1 +3x2 +8x3 10
x 1, x 2, x 3 0

Manoj Kumar Pandey, OPTIMIZATION 51


Points to Remember in Simplex Algorithm

 All the constraints should be type.

 All variables should be 0.

 Coefficients of basic variables in z-row should be zero.

 The coefficients matrix corresponding to initial basic


variables forms an identity matrix.

 The entering variable will be the one which has most


negative (most positive) z-row coefficient in case of max.
(min.) problem.

Manoj Kumar Pandey, OPTIMIZATION 52


Points to Remember ..

 Leaving variable should follow the minimum ratio test.

 When all the z-row coefficients are 0 (or 0) in case of


max. (or min.) problem the optimality is reached and we
will stop the simplex iteration.

Manoj Kumar Pandey, OPTIMIZATION 53

You might also like