Operational Research Notes by Abhishek
Operational Research Notes by Abhishek
COM
Operational
Research Notes
m
1. All the constraints are equations with non-negative right-hand side.
2. All the variables are non-negative
.co
Converting Inequalities into Equations with Non-negative Right-Hand Side
For example the inequality 6x1 + 4x2 <= 24 is converted into 6x1 + 4x2 + S1 = 24 by adding a
un
slack variable S1 where S1>=0.
If the right hand side of an inequality is negative then it can be made non-negative by
multiplying both sides by -1.
For example the inequality with negative RHS -x1 + x2 >= -25 is converted into x1 - x2 + S1 =
to
If xi (>=0) is the workforce size in period i, then Xi+1 (>=0) the workforce size in period i + 1
can be expressed as xi+1 = xi + yi+1.
The variable yi+1 must be unrestricted in sign to allow xi+1 to increase or decrease relative to xi.
The simplex method computation requires all the variables to be non-negative. We can
always account for this requirement by using the substitution,
Simplex Method
m
.co
Introduction
The Simplex Method is a systematic procedure for generating and testing candidate vertex
solutions to a linear program. It starts at an arbitrary corner of the solution set.
iya
At each iteration, it selects the variable that will create the biggest change towards the
minimum (or maximum) solution and that variable replaces one of its compatriots that is
most severely restricting it, so moving the Simplex Method to another corner of the solution
set and more closer to the final solution. In addition, the Simplex Method can also determine
un
if there is no solution actually exists.
Note that Simplex Algorithm is a greedy algorithm since it selects the best choice at each
iteration without needing any information from previous or future iterations.
lsD
(i) A solution may occur where no non-basic variable will decrease the cost, in which
ria
(iii) No solution may actually exist and the Simplex Method must abort.
Entering a variable will be in line with the variable negative coefficient of the objective
Tu
The entering variable in the objective equation will correspond to the variable with the most
negative coefficient. This rule is known as optimality condition.
Normally, the simplex method starts at the origin (point A) where Xl = X2 = O. At this
starting point, the value of objective function is 0.
The simplex method works alongside the edges of the solution space which means that the
method cannot cut across the solution space.
Objective Function: The function that is either being minimized or maximized. For example,
it may represent the cost that you are trying to minimize.
Optimal Solution: A vector x, which is both feasible (satisfying the constraints) and optimal
(obtaining the largest or smallest objective value).
m
Constraints: A set of equalities and inequalities that the feasible solution must satisfy.
.co
Feasible Solution: A solution vector, x, which satisfies the constraints.
iya
the m columns of A corresponding to the basic variables form a nonsingular basis and the
value of each “non-basic” variable is 0.
un
The constraint matrix A has m rows (constraints) and n columns (variables).
Artificial Variable: A variable added to a linear program in phase 1 to aid finding a feasible
solution.
Tu
Unbounded Solution: For some linear programs it is possible to make the objective
arbitrarily small (without bound). Such an LP is said to have an unbounded solution.
Gauss-Jordan row operations: It identifies the entering variable column as the pivot
column and the leaving variable row as the pivot row. The intersection of the pivot column
and the pivot row is called the pivot element.
m
Entering variable in minimization problem, entering variable will correspond to the
variable with the most positive coefficient in the objective equation.
.co
Leaving variable in maximization and minimization, is the variable with minimum (non-
negative) ratio of the right-hand side of the equations (solution column) to the corresponding
constraint coefficients under the entering variable.
iya
Optimality condition for maximization: The entering variable in a maximization problem is
the non-basic variable having the most negative coefficient in the z-row. The optimum is
reached at the iteration where all the z-row coefficients of the non basic variables are non
negative.
un
Optimality condition for minimization: The entering variable in a minimization problem is
the non-basic variable having the most positive coefficient in the z-row. The optimum is
reached at the iteration where all the z-row coefficients of the non basic variables are
lsD
negative.
Feasibility condition: For both the maximization and the minimization problems, the leaving
variable is the basic variable associated with the smallest non negative ratio.
ria
to
Tu
m
4) Determination of pivot element.
a) The most negative indicator in the z row of the tableau determines the pivot column.
b) The pivot row is selected from among the slack equations by using the smallest-
.co
quotient rule.
c) The intersection of the pivot column and the pivot row determines the pivot element.
5) Determine whether there is a negative variable in the z row.
iya
6) If there is a negative number in the z row, determine the new basic solution by using the
appropriate Gauss-Jordan computations then go back to Step 4.
7) If there isn’t a negative number is the z row, then the maximum has been reached.
un
Example: Maximize z = 5x1 + 4x2
lsD
Subject to
x1 + 2x2 <= 6
ria
-x1 + x2 <= 1
x2 <= 2
x1 , x2 >= 0
to
Tu
Step 1: Insert the slack variables, and find the slack equations.
x1 + 2x2 + s2 <= 6
-x1 + x2 + s3 <= 1
x2 + s4 <= 2
Note: variables s1, s2, s3 and s4 are the slacks associated with the respective constraints.
Step 2: Rewrite the objective function to match the format of the slack equations.
m
Step 3: Write the initial simplex tableau.
.co
Basic variables: (S1, S2, S3, S4)
Basic Z X1 X2 S1 S2 S3 S4 Solutio
n
iya
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
un
The tableau defines the current corner point by specifying its basic variables and their values,
as well as the corresponding value of the objective function, z.
lsD
In maximization, entering variable will correspond to the variable with the most negative
coefficient in the objective equation.
The leaving variable is the variable with minimum (non-negative) ratio of the right-hand side
to
of the equations (Solution column) to the corresponding constraint coefficients under the
entering variable.
Tu
Pivot column – x1
Pivot row – s1
Pivot element – 6
There are negative variables in the z row hence we have to calculate new pivot row as well as
all other rows using Gauss-Jordan computation.
m
First replace the leaving variable in the Basic column with the entering variable.
.co
New pivot row = Current pivot row / Pivot element
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]
= [0 , 1 , 2/3 , 1/6 , 0 , 0 , 0 , 4]
lsD
= (0 0 4/3 -1/6 1 0 0 2)
= (0 0 1 0 0 0 1 2)
The new basic solution is (x1 s2 s3 s4), and the new tableau becomes
Basic Z X1 X2 S1 S2 S3 S4 Solutio
n
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
m
There are again negative variables in the z row hence we have to calculate new pivot row as
.co
well as all other rows using Gauss-Jordan computation.
iya
S3 5/3 5 3
S4 1 2 2
Pivot column – x2
un
Pivot row – s2
= (0 1 0 1/4 -1/2 0 0 3)
The new basic solution is (x1 x2 s3 s4), and the new tableau becomes
m
Basic Z X1 X2 S1 S2 S3 S4 Solutio
n
Z 1 0 0 3/4 1/2 0 0 21
.co
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
iya
Now, none of the z-row coefficients associated with the non-basic variables are negative.
Hence, this tableau is optimal with x1 = 3 , x2 = 1.5 and z = 21.
un
Example: Maximize z=3x1+4x2+x3 subject to
x1 +2 x2 + x3 <= 6
lsD
3x1 + x2 + x3 <= 9
x1 , x2 , x3 >=0
ria
x1 + 2x2 + x3 + s1 = 6
to
2x1 + 2x3 + s2 = 4
3x1 + x2 + x3 + s3 = 9
Tu
x1 , x2 , x3 , s1 , s2 , s3 >=0
Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 -3 -4 -1 0 0 0 0
S1 0 1 2 1 1 0 0 6
S2 0 2 0 2 0 1 0 4
S3 0 3 1 1 0 0 1 9
m
Leaving variable (pivot row) : s1
Pivot element: 2
.co
First replace the leaving variable in the Basic column with the entering variable.
iya
New pivot row = Current pivot row / Pivot element
New Row = (Current row) – [(its pivot column coefficient) * (New pivot row)]
un
First replace s1 with x2 in basic column.
lsD
= [0 , 1 , 2 , 1 , 1 , 0 , 0 , 6] / 2
= (1 -1 0 1 2 0 0 12)
to
= (0 2 0 2 0 1 0 4)
The new basic solution is (x2 S2 S3), and the new tableau becomes
Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 -1 0 1 2 0 0 12
X2 0 1/2 1 ½ 1/2 0 0 2
S2 0 2 0 2 0 1 0 4
S3 0 5/2 0 ½ -1/2 0 1 6
m
There are again negative variables in the z row hence we have to calculate new pivot row as
.co
well as all other rows using Gauss-Jordan computation
Pivot element: 2
iya
un
First replace s2 with x1 in basic column.
= [0 , 2 , 0 , 2 , 0 , 1 , 0 , 4] / 2
lsD
= [0 , 1 , 0 , 1 , 0 , 1/2 , 0 , 2]
= (1 0 0 2 2 1/2 0 14)
= (0 0 0 -2 -1/2 -5/4 1 1)
The new basic solution is (x2, x1, s3), and the new tableau becomes
Basic Z X1 X2 X3 S1 S2 S3 Solutio
n
Z 1 0 0 2 2 1/2 0 14
X2 0 -3/2 1 -3/2 -3/2 -1 0 -2
X1 0 1 0 1 0 1/2 0 2
S3 0 0 0 -2 -1/2 -5/4 1 1
m
Now, none of the z-row coefficients associated with the non-basic variables are negative.
Hence, this tableau is optimal with x1 = 2 , x2 = 2 , x3 = 0 and z = 14.
.co
ARTIFICIAL STARTING SOLUTION
iya
The LPs in which all the constraints are (<=) with non negative right-hand sides offer a
convenient all-slack starting basic feasible solution whereas models involving (=) and/or (>=)
constraints do not.
un
The procedure for starting "ill-behaved" LPs with (=) and (>=) constraints is to use artificial
variables that play the role of slacks at the first iteration and then dispose of them at a later
iteration.
lsD
1. M-method
2. Two-phase method
ria
M-method
to
If equation i does not have a slack (or a variable that can play the role of a slack), an artificial
variable, Ri , is added to form a starting solution. However artificial variables are not part of
Tu
the original LP model, hence they are assigned a very high penalty in the objective function,
thus they are forced to equal 0 in the optimum solution. This will always be the case if the
problem has a feasible solution.
The desired goal is achieved by penalising these variables in objective function using penalty
rule.
m
Example: Minimize z = 4x1 + x2 subject to
.co
3x1 + x2 = 3
x1 + 2x2 <= 4
iya
x1 , x2 >= 0
un
Adding s1 as surplus and s2 as slack variable,
3x1 + x2 = 3
x1 + 2x2 + s2 = 4
x1 , x2 , s1 , s2 >= 0
The third equation has its slack variable, s2, but the first and second equations do not. Thus,
ria
we are adding the artificial variables R1 and R2 in the first and second equation respectively
and penalizing them in the objective function with MR1 + MR2 (positive M because we are
minimizing).
to
3x1 + x2 + R1 = 3
x1 + 2x2 + s2 = 4
x1 , x2 , s1 , s2 , R1 , R2 >= 0
TutorialsDuniya.com
Download FREE Computer Science Notes, Programs, Projects,
Books PDF for any university student of BCA, MCA, B.Sc,
B.Tech CSE, M.Sc, M.Tech at https://www.tutorialsduniya.com
Basic variables: R1 , R2 , s2
From the computer’s standpoint, M must assume a sufficiently large numeric value.
m
It depends on the data of the original LP. It must be sufficiently large relative to the original
objective coefficients so it will act as a penalty that forces the artificial variables to zero level
in the optimal solution.
.co
In the present example, the objective coefficients of X1 and X2 are 4 and 1, respectively. It
thus appears reasonable to set M = 100.
Z X1 X2 S1 iya
Using M = 100, the starting simplex tableau is given as follows:
Basic R1 R2 S2 Solutio
n
un
Z 1 -4 -1 0 -100 -100 0 0
R1 0 3 1 0 1 0 0 3
R2 0 4 3 -1 0 1 0 6
S2 0 1 2 0 0 0 1 4
lsD
Before proceeding with the simplex method computations, we need to make the z-row
consistent with the rest of the tableau. In the tableau, X1 = X2 = X3 = 0, which yields the
starting basic solution R1 = 3, R2 = 6 and X4 = 4, this solution yields, z = 100 X 3 + 100 X 6
ria
= 900. This inconsistency is because R1 and R2 have non zero coefficients in the z-row.
We can eliminate this inconsistency by substituting out R1 and R2 in the z-row using the
appropriate constraint equations.
to
New z row = [1 -4 -1 0 -100 -100 0 0] - [(0 -300 -100 0 -100 0 0 -300) + (0 -400 -300 100 0 -
100 0 -600)]
Now z = 900, which is consistent with the values of the starting basic feasible solution i.e. RI
= 3, R2 = 6, and X4 = 4.
We have to minimize the objective function, hence variable with most positive coefficient in
z row i.e.x1 and variable with min ratio i.e. R1 are selected as entering and leaving variables
respectively.
m
Pivot element: 3
.co
First replace R1 with x1 in basic column.
iya
= [0 , 3 , 1 , 0 , 1 , 0 , 0 , 3] / 3
= [0 , 1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]
= (0 0 5/3 -1 -4/3 1 0 2)
ria
= (0 0 5/3 0 -1/3 0 1 3)
to
Tu
The new basic solution is (x1 R2 S2), and the new tableau becomes
Basic Z X1 X2 S1 R1 R2 S2 Solutio
n
Z 1 0 167 -100 -232 0 0 204
X1 0 1 1/3 0 1/3 0 0 1
R2 0 0 5/3 -1 -4/3 1 0 2
S2 0 0 5/3 0 -1/3 0 1 3
There are positive variables in the z row hence we have to calculate new pivot row as well as
all other rows using Gauss-Jordan computation
m
First replace R2 with x2 in basic column.
.co
New x2 (pivot row) = current x2 row / (5/3)
iya
= (1 0 167 -100 -232 0 0 204) - (167) x [0 , 0 , 1 , -3/5 , -4/5 , 3/5 , 0 , 6/5]
= (1 0 0 0 -98 -100 0 4)
un
New x1 row = Current x1-row - (1/3) * New x2-row
= (0 0 0 1 1 -1 1 1)
to
The new basic solution is (x2, x1, s3), and the new tableau becomes
Basic Z X1 X2 S1 R1 R2 S2 Solutio
n
Tu
Z 1 0 0 0 -98 -100 0 4
X1 0 1 0 1/5 3/5 -1/5 0 3/5
X2 0 0 1 -3/5 -4/5 3/5 0 6/5
S2 0 0 0 1 1 -1 1 1
m
In phase 1,
.co
First put the problem in equation form and add the necessary artificial variables to the
constraints.
Next, find a basic solution of the resulting equations that always minimizes the sum of the
iya
artificial variables, regardless of whether the LP is of maximization or minimization.
If the minimum value of the sum is positive, the LP problem has no feasible solution,
otherwise proceed to Phase 2.
un
In phase 2,
We use the feasible solution from Phase 1 as a starting basic feasible solution for the original
lsD
problem.
3x1 + x2 = 3
x1 + 2x2 <= 4
to
x1 , x2 >= 0
Tu
3x1 + x2 = 3
x1 + 2x2 + s2 = 4
x1 , x2 , s1 , s2 >= 0
The third equation has its slack variable, s2, but the first and second equations do not. Thus,
we are adding the artificial variables R1 and R2 in the first and second equation respectively.
Phase 1,
Minimize r - R1 - R2 = 0
3x1 + x2 + R1 = 3
m
4x1 + 3x2 –s1 + R2 = 6
.co
x1 + 2x2 + s2 = 4
x1 , x2 , s1 , s2 , R1 , R2 >= 0
Basic variables: R1 , R2 , s2
iya
Using M = 100, the starting simplex tableau is given as follows:
un
Basic X1 X2 S1 R1 R2 S2 Solutio
n
R 0 0 0 -1 -1 0 0
lsD
R1 3 1 0 1 0 0 3
R2 4 3 -1 0 1 0 6
S2 1 2 0 0 0 1 4
ria
= [0 0 0 -1 -1 0 0] + [7 4 -1 1 1 0 9]
= [7 4 -1 0 0 0 9]
to
Pivot element: 3
= [3 , 1 , 0 , 1 , 0 , 0 , 3] / 3
= [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]
= (0 5/3 -1 -7/3 0 0 2)
m
= (4 3 -1 0 1 0 6) - (4) * [1 , 1/3 , 0 , 1/3 , 0 , 0 , 1]
= (0 5/3 -1 -4/3 1 0 2)
.co
New S2 row = Current s2 row - (1) * New x1 row
iya
= (0 5/3 0 -1/3 0 1 3)
The new basic solution is (x1 R2 S2), and the new tableau becomes
un
Basic X1 X2 S1 R1 R2 S2 Solutio
n
r 0 5/3 -1 -7/3 0 0 2
X1 1 1/3 0 1/3 0 0 1
lsD
R2 0 5/3 -1 -4/3 1 0 2
S2 0 5/3 0 -1/3 0 1 3
There are positive variables in the z row hence we have to calculate new pivot row as well as
ria
= (0 0 0 -1 -1 0 0)
m
= (1 0 1/5 3/5 -1/5 0 3/5)
.co
= (0 5/3 0 -1/3 0 1 3) - (5/3) * [0 , 1 , -3/2 , -4/5 , 3/5 , 0 , 6/5]
= (0 0 1 1 -1 1 1)
Basic X1 X2 S1 R1
iya
The new basic solution is (x1 R2 S2), and the new tableau becomes
R2 S2 Solutio
n
un
r 0 0 0 -1 -1 0 0
X1 1 0 1/5 3/5 -1/5 0 3/5
X2 0 1 -3/5 -4/5 3/5 0 6/5
S2 0 0 1 1 -1 1 1
lsD
Phase 2,
Basic X1 X2 S1 S2 Solutio
n
Z -4 -1 0 0 0
to
X1 1 0 1/5 0 3/5
X2 0 1 -3/5 0 6/5
S2 0 0 1 1 1
Tu
Now in z row, x1 and x2 have non zero values, hence we multiplied x1 row and x2 row by 4
and 1 respectively and added them to z row to make x1 and x2 coefficient as 0.
= (0 0 1/5 0 18/5)
Pivot element: 1
m
New S1 (pivot row) = current S1 row / (1)
= [0 , 0 , 1 , 1 , 1] / (1)
.co
= [0 , 0 , 1 , 1 , 1]
iya
= (0 0 1/5 0 18/5) - (0) x [0 , 0 , 1 , 1 , 1]
= (0 0 0 -1/5 17/5)
= (1 0 0 -1/5 2/5)
lsD
= (0 1 0 3/5 9/5)
ria
The new basic solution is (x1 x2 S1), and the new tableau becomes
Basic X1 X2 S1 S2 Solutio
to
n
Z 0 0 0 -1/5 17/5
X1 1 0 0 -1/5 2/5
Tu
X2 0 1 0 3/5 9/5
S2 0 0 1 1 1
Duality
For every linear programming problem there is a corresponding linear programming problem
called the dual.
m
1. A dual variable is defined for each primal (constraint) equation.
2. A dual constraint is defined for each primal variable.
3. The constraint (column) coefficients of a primal variable define the left-hand side
.co
coefficients of the dual constraint and its objective coefficients define the right-hand
side.
4. The objective coefficients of the dual equal the right-hand side of the primal
constraint equations.
iya
un
Construction of the Dual from the Primal
Primal
variables
lsD
X1 X2 ... Xj ... xn
Dual C1 C2 ... Cj ... cn RHS
variables
Y1 A11 A12 ... A1j ... A1n B1
ria
nt
The sense of optimization in the dual is always opposite to that of the primal. If the original
problem is a maximum then its dual is a minimum and if the original problem is a minimum
then its dual is a maximum. In either case the final tableau of the dual will contain both the
solution to the dual and the solution to the original problem.
m
Variables Constraints
>=0 >=
.co
<=0 <=
Unrestricted =
iya
Example: Write the dual for the following primal problem:
X1 + 2X2 + x3 <= 10
un
2X1 - X2 + 3X3 = 8
X1 + 2X2 + X3 + X4 = 10
Since there are 2 equations in primal problem hence there will be 2 dual variables.
Dual Problem
Tu
Y1 + Y2 >= 5
2Y1 – Y2 >= 12
Y1 + 3Y2 >= 4
Y1 >= 0
Y1, Y2 unrestricted
X1 + 2X2 >= 3
X1, X2 >= 0
m
Primal in equation form, Minimize Z = 15X1 + 12x2 subject to
.co
X1 + 2X2 - X3 = 3
2x1 - 4X2 + X4 = 5
iya
X1, X2. X3, X4 >= 0
Since there are 2 equations in primal problem hence there will be 2 dual variables.
2Y1 + Y2 <= 15
-Y1 <= 0
Y2 <= 0
Y1, Y2 unrestricted
to
Tu
PRIMAL-DUAL RELATIONSHIPS
m
A column vector, P, of size n is an (n * 1) matrix.
.co
A= (a11 , a12 , ... a1n)
iya
(am1 , am2 , ... amn)
P= (P1)
(P2)
un
(Pn)
lsD
The simplex tableau computation uses only three elementary matrix operations:
The operation is defined only if the size of the row vector V equals the number of rows of
matrix A.
ria
= (242 308)
to
The operation is defined only if the number of columns of matrix A equals the size of column
vector P.
= (242 ; 308)
3. Scalar * Matrix
The scalar (or constant) quantity c, the multiplication operation (c * A) will result in a matrix
of the same size as A whose (i, j)th element equals c * aij.
In the starting tableau, the constraint coefficients under the starting variables form an identity
matrix (all main-diagonal elements equals 1 and all off-diagonal elements equals 0).
m
Optimal Dual Solution
.co
The dual of a dual is itself the primal, which means that the dual solution can also be used to
yield the optimal primal solution automatically.
Method 1: iya
un
Optimal value of dual variable yi = Optimal primal z-coefficient of starting variable xi +
Original objective coefficient of xi
lsD
Method 2:
Optimal values of dual variables = (Row vector of original objective coefficients of optimal
primal basic variables) * (Optimal primal inverse)
ria
Note: The elements of the row vector must appear in the same order in which the basic
variables are listed in the Basic column of the simplex tableau.
to
X1 + 2X2 + x3 <= 10
Tu
2X1 - X2 + 3X3 = 8
X1 , x2 , x3 >= 0
X1 + 2x2 + x3 + x4 = 10
2x1 – x2 + 3x3 + R = 8
X1 , x2 , x3 , x4 , R >= 0
m
Y1 + 2y2 >= 5
2Y1 - y2 >= 12
.co
Y1 + 3y2 >= 4
Y1 >= 0
iya
Y2 >= -M (y2 is unrestricted)
Method 1: The starting primal variables X4 and R uniquely correspond to the dual variables
Y1 and Y2 respectively. Thus, we determine the optimum dual solution as follows:
un
Starting primal basic X4 R
lsD
variables
z-equation coefficients 29/5 -2/5 + M
Original objective coefficient 0 -M
Dual variables Y1 Y2
ria
Basic X1 X2 X3 X4 R Solution
Z 0 0 3/5 29/5 -2/5 + M 274/5
X2 0 1 -1/5 2/5 -1/5 12/5
X1 1 0 7/5 1/5 2/5 26/5
TutorialsDuniya.com
Download FREE Computer Science Notes, Programs, Projects,
Books PDF for any university student of BCA, MCA, B.Sc,
B.Tech CSE, M.Sc, M.Tech at https://www.tutorialsduniya.com
Note: The optimal primal variables are listed in the tableau in row order as X2 and then XI.
This means that the elements of the original objective coefficients for the two variables must
appear in the same order.
= (12 , 5)
m
The optimal dual values are computed as,
.co
= (12 , 5) * (2/5 -1/5 , 1/5 2/5)
= (29/5, -2/5)
iya
Relationship between the primal and dual objective values
Note: The above relationship does not specify which problem is primal and which is dual.
lsD
Any iteration of the entire simplex tableau can be generated from the original data of the
problem, inverse associated with the iteration, and the dual problem.
Using the layout of the simplex tableau, we can divide the computations into two types:
to
2. Objective z-row
Formula 2: Objective z-row Computations: In any simplex iteration, the objective equation
coefficient of xi is computed as follows:
m
Example: Consider the LP, Maximize z = 5X1 + 12x2 + 4x3 subject to
X1 + 2X2 + x3 <= 10
.co
2X1 - X2 + 3X3 = 8
X1 , x2 , x3 >= 0
Basic X1 X2 X3
iya X4 R Solution
un
Z 0 0 3/5 29/5 -2/5 + M 274/5
X2 0 1 -1/5 2/5 -1/5 12/5
X1 1 0 7/5 1/5 2/5 26/5
lsD
Using formula 1, we can compute all the left and right hand side columns of the optimal
ria
tableau as follows,
= (0 1)
= (1 0)
= (-1/5 7/5)
= (2/5 1/5)
= (-1/5 2/5)
= (12/5 26/5)
m
The optimal values of the dual variables,(Y1. Y2) = (29/5 , -2/5), were already computed
using two different methods. These values are used in Formula 2 to determine the associated
z coefficients of the optimum tableau,
.co
Z coefficient of x1 = y1 + 2y2 – 5 = 29/5 + 2 * (-2/5) – 5 = 0
iya
Z coefficient of x3 = y1 + 3y2 -4 = 29/5 + 3 * (-2/5) – 4 = 3/5
Transportation Model
Introduction
The transportation problem is a special type of linear programming problem where the
objective is to minimize the cost of distributing a product from a number of sources to a
m
number of destinations.
Because of its special structure the usual simplex method is not suitable for solving these
.co
transportation problems. So, these problems require a special method of solution.
In a transportation problem, origin is the location from which shipments are dispatched and
destination is the location to which shipments are transported.
The unit transportation cost is the cost of transporting 1 unit of consignment from origin to a
iya
destination.
In the most general form, a transportation problem has a number of origins and a number of
destinations. A certain amount of a particular consignment is available in each origin and
each destination has a certain requirement.
un
Transportation problem refers to the amount of consignment to be transported from various
origins to different destinations so that the total transportation cost is minimized without
violating the availability constraints and the requirement constraints.
lsD
The decision variables Xij of a transportation problem indicate the amount to be transported
from the ith origin to the jth destination. Two subscripts are necessary to describe these
decision variables. A transportation problem can be formulated as a linear programming
problem using decision variables with two subscripts.
ria
For example, in case the total production of 4 factories is 1000 units and total requirements of
4 warehouses is also 1000 units, the transportation problem is said to be a balanced
transportation problem.
Tu
Dummy Origin/Destination
A dummy origin or destination is an imaginary origin or destination with zero cost introduced
to make an unbalanced transportation problem balanced.
m
If the total supply is more than the total demand we introduce an additional column which
will indicate the surplus supply with transportation cost zero.
If the total demand is more than the total supply, an additional row is introduced in the table
.co
which represents unsatisfied demand with transportation cost zero.
Transportation Algorithm
iya
The algorithm of solving a transportation problem is as follows:
un
1. Determine a starting basic feasible solution, and go to step 2.
2. Use the optimality condition of the simplex method to determine the entering variable
from among all the non basic variables. If the optimality condition is satisfied, stop.
lsD
Otherwise, go to step 3.
3. Use the feasibility condition of the simplex method to determine the leaving variable
from among all the current basic variables, and find the new basic solution. Return to
step 2.
ria
redundant. Thus, the model has m + n - 1 independent constraint equations, which means that
the starting basic solution consists of m + n - 1 basic variable.
A transport problem is said to be a degenerate transport problem if it has a basic feasible
solution with number of non-zero basic variables less than m + n - 1.
We can determine the starting basic feasible solution by the following 3 methods:
1. Northwest-corner method
2. Least-cost method
3. Vogel approximation method
Northwest-corner method
The algorithm for solving the transportation problem using northwest corner method is as
follows:
1. Make maximum possible allocation to the North-West Corner Cell in the First Row
m
and adjust the associated amounts of supply and demand by subtracting the allocated
amount.
2. If the supply of that row is greater than 0, move to the next cell of the same row
.co
otherwise move to the cell of the next row and cross out the row or column with 0
supply or demand to indicate that no further assignments can be made in that row or
column.
iya
3. Follow above steps till all the requirements are exhausted, i.e., the entire demand and
supply is exhausted.
un
Example 1: Cost table is as follows,
C1 C2 C3 Supply
R1 0 2 1 6
lsD
R2 2 1 5 7
R3 2 4 3 7
Demand 5 5 10
ria
Now, the demand of column C1 is exhausted but row R1 can still supply. So, we move to the
next cell (C2) in the same row and allocate maximum possible supply i.e.1.
to
Now, the supply of row R1 is exhausted but column C2 still demands supply. So, we move to
the next cell (R2) in the same column and allocate maximum possible supply i.e.4.
Tu
Now, the demand of column C2 is exhausted but row R2 can still supply. So, we move to the
next cell (C3) in the same row and allocate maximum possible supply i.e.3.
Now, the supply of row R2 is exhausted but column C3 still demands supply. So, we move to
the next cell (R3) in the same column and allocate maximum possible supply i.e.7.
C1 C2 C3 Supply
R1 5 1 0
R2 4 3 0
R3 7 0
Demand 0 0 0
m
Cost = 5*0 +1*2 + 4*1 + 3*5 + 7*3
= 0 + 2 + 4 + 15 + 21
.co
= 42
R1
R2
R3
C1
1
0
3
C2
2
4
1
iya C3
6
2
5
Supply
7
12
11
un
Demand 10 10 10
Now, the supply of row R1 is exhausted but column C1 still demands supply. So, we move to
the next cell (R2) in the same column and allocate maximum possible supply i.e.3.
Now, the demand of column C1 is exhausted but row R2 can still supply. So, we move to the
next cell (C2) in the same row and allocate maximum possible supply i.e.9.
ria
Now, the supply of row R2 is exhausted but column C2 still demands supply. So, we move to
the next cell (R3) in the same column and allocate maximum possible supply i.e.1.
Now, the demand of column C2 is exhausted but row R3 can still supply. So, we move to the
to
next cell (C3) in the same row and allocate maximum possible supply i.e.10.
C1 C2 C3 Supply
R1 7 0
R2 3 9 0
R3 1 10 0
Demand 0 0 0
= 7 + 0 + 36 + 1 + 50
= 94
Least-cost method
m
The algorithm for solving the transportation problem using least cost method is as follows:
.co
1. Make maximum possible Allocation to the Least Cost Cell and the satisfied row or
column is crossed out, if any, and the amounts of supply and demand are adjusted
iya
accordingly.
2. Make allocation to the uncrossed-out Lowest Cost Cell depending upon the remaining
demand/supply.
3. Follow above step till all the requirements are exhausted, i.e., the entire demand and
un
supply is exhausted.
lsD
C1 C2 C3 Supply
R1 0 2 1 6
R2 2 1 5 7
R3 2 4 3 7
ria
Demand 5 5 10
We first make maximum possible allocation i.e.5 to the least cost cell.
to
Now, the demand of column C1 is exhausted and hence we crossed out that column and find
the least cost cell from the remaining uncrossed cells i.e.R1C3 and allocated maximum
possible supply i.e.1.
Tu
Now, the supply of row R1 is exhausted and hence we crossed out that row and find the least
cost cell from the remaining uncrossed cells i.e.R2C2 and allocated maximum possible
supply i.e.5.
Now, both the supply of row R2 as well as the demand of column C2 is exhausted at the same
time. So, we can either cross out row R2 or column C2. Let us cross out column C2 and find
the least cost cell from the remaining uncrossed cells i.e.R3C3 and allocated maximum
possible supply i.e.7.
Now, the supply of row R3 is also exhausted and hence we crossed out that row and find the
least cost cell from the remaining uncrossed cells i.e.R2C3 and allocated maximum possible
supply i.e.2.
m
C1 C2 C3 Supply
R1 5 1 0
R2 5 2 0
.co
R3 7 0
Demand 0 0 0
iya
Cost = 5*0 + 1*1 + 5*1 + 2*5 + 7*3
= 0 + 1 + 5 + 10 + 21
= 37
un
Example2: Cost table is as follows,
lsD
C1 C2 C3 Supply
R1 1 2 6 7
R2 0 4 2 12
R3 3 1 5 11
Demand 10 10 10
ria
We first make maximum possible allocation i.e.10 to the least cost cell (R2C1).
Now, the demand of column C1 is exhausted and hence we crossed out that column and find
the least cost cell from the remaining uncrossed cells i.e.R3C2 and allocated maximum
to
Now, the demand of column C2 is exhausted and hence we crossed out that column and find
Tu
the least cost cell from the remaining uncrossed cells i.e.R2C3 and allocated maximum
possible supply i.e.2.
As only one row is left uncrossed, we allocated maximum possible supply i.e.1 to column C3
and then supply 7 to column C1 in the same row.
C1 C2 C3 Supply
R1 7 0
R2 10 2 0
R3 10 1 0
Demand 0 0 0
m
Cost = 7*6 + 10*0 + 2*2 + 10*1 + 1*5
= 42 + 0 + 4 + 10 + 5
.co
= 61
iya
The algorithm for solving the transportation problem using vogel approximation method is as
follows:
un
1. For each row/column, determine a penalty measure by subtracting the smallest unit
cost element in the row/column from the next smallest unit cost element in the same
lsD
row/column. Now, identify the row or column with the largest penalty.
2. Allocate as much as possible to the cell with least unit cost in the selected row or
column.
3. Cross out the satisfied row or column and adjust the supply and demand. If both a row
ria
and a column are satisfied simultaneously then only 1 of the two is crossed out and
the remaining row/column is assigned zero supply/demand.
4. Follow above step and if 1 row/column with positive supply/demand remains
to
uncrossed out then determine the basic variables in the row/column by the least-cost
method.
Tu
In this method, we first determine the penalty for each row [1, 1, 1] as well as for each
column [2, 1, 2]. We find columns C1 and C3 with largest penalty i.e.2. So we can select any
column. Let us select C1 column.
We allocated 5 to cell with least unit cost i.e. R1C1, in column C1. Now, the demand of
column C1 is exhausted and hence we crossed out that column.
m
We again calculated the penalty for row as [1, 1, 1] and for column as [0, 1, 2] and we find
that column C3 has the largest penalty.
.co
So, we allocated 1 to cell with least unit cost i.e. R1C3, in column C3. Now, the supply of
row R1 is exhausted and hence we crossed out that row.
We again calculated the penalty for row as [0, 1, 1] and for column as [0, 3, 2] and we find
that column C2 has the largest penalty.
iya
So, we allocated 5 to cell with least unit cost i.e. R2C2, in column C2. Now, the supply of
column C2 is exhausted and hence we crossed out that column.
un
Next, we again calculated the penalty for row as [0, 5, 3] and for column as [0, 0, 2] and we
find that row R2 has the largest penalty.
lsD
So, we allocated 2 to cell with least unit cost i.e. R2C3, in row R2. Now, the supply of row
R2 is exhausted and hence we crossed out that column.
C1 C2 C3 Supply
Tu
R1 5 1 0
R2 5 2 0
R3 7 0
Demand 0 0 0
= 0 + 5 + 1 + 10 + 21
= 37
m
In this method, we first determine the penalty for each row [1, 2, 2] as well as for each
column [1, 1, 3]. We find that column C3 has the largest penalty.
.co
We allocated 10 to cell with least unit cost i.e. R2C3, in column C3. Now, the demand of
column C3 is exhausted and hence we crossed out that column.
We again calculated the penalty for row as [1, 4, 2] and for column as [1, 1, 0] and we find
iya
that row R2 has the largest penalty.
So, we allocated 2 to cell with least unit cost i.e. R2C1, in row R2. Now, the supply of row
R2 is exhausted and hence we crossed out that row.
un
We again calculated the penalty for row as [1, 0, 2] and for column as [2, 1, 0] and we find
row R3 and column C1 with largest penalty i.e.2. So we can select any one. Let us select C1
column.
lsD
So, we allocated 7 to cell with least unit cost i.e. R1C1, in column C1. Now, the supply of
row R1 is exhausted and hence we crossed out that row.
Next, we again calculated the penalty for row as [0, 0, 2] and for column as [3, 1, 0] and we
find that column C1 has the largest penalty.
ria
So, we allocated 1 to cell with least unit cost i.e. R3C1, in column C1. Now, the supply of
column C1 is exhausted and hence we crossed out that column.
C1 C2 C3 Supply
R1 7 0 0
R2 2 10 0
R3 1 10 0
Demand 0 0 0
TutorialsDuniya.com
Download FREE Computer Science Notes, Programs, Projects,
Books PDF for any university student of BCA, MCA, B.Sc,
B.Tech CSE, M.Sc, M.Tech at https://www.tutorialsduniya.com
= 7 + 0 + 20 + 3 + 10
= 40
m
To solve the transportation problem, we first determine the starting basic solution using any
.co
of the 3 methods as discussed earlier then we determine the optimal solution using the
transportation algorithm.
The basic nature of this algorithm is iterative as we have to repeat the steps of the algorithm
till we reach the optimal solution.
iya
We use the condition of simplex optimality and feasibility to determine the entering and
leaving variable respectively.
un
The determination of the entering variable is done by computing the non basic coefficients in
the z-row by using the method of multipliers.
lsD
According to this method, we associate the multipliers ui and vj with row i and column j of
the transportation algorithm.
For each basic variable xij these multipliers satisfy the equation ui + vj = cij.
ria
This equation can be used to determine the value of ui and vj and the basis of this equation is
that basic variable has zero value in the z row.
to
The method of multiplier solves these equations by arbitrarily setting any ui=0 and then
calculating values of the remaining variables.
Tu
We used ui and vj to evaluate the non basic variables by computing ui + vj – cij for each non
basic xij.
Next we determine the entering variable as the most positive coefficient in the z row.
Now to determine the leaving variable, let θ units be shipped from the entering variable’s
route.
We calculate the maximum value of θ by first constructing a closed loop that starts and ends
at the entering variable cell. This loop should not consist of any diagonal segment i.e. only
m
horizontal and vertical segments to be connected. Next, we assign θ amount to the entering
variable cell and alternatively added and subtracted θ amount at successive corners of the
loop to balance the supply and demand limits.
.co
Example1: Cost table is as follows,
R1
R2
C1
0
2
C2
2
1
iya C3
1
5
Supply
6
9
un
R3 2 4 3 5
Demand 5 5 10
lsD
C1 C2 C3 Supply
ria
R1 5 1 0
R2 4 5 0
R3 5 0
to
Demand 0 0 0
Let’s consider u1=0 and calculate the values of the remaining variables.
Tu
Now we will use the above calculated values of ui and vj to evaluate the non basic variables
by computing ui + vj – cij for each non basic xij as follows,
X13 = 0 + 6 – 1 = 5
m
X21 = -1 + 0 – 2 = -3
.co
X31 = -3 + 0 – 2 = -5
X32 = -3 + 2 – 4 = -5
iya
Now the value of x13 is most positive and hence the entering variable is X13.
Next to determine the leaving variable, let amount be shipped from X13 then
un
X12 is 1 - θ >= 0
X22 is 4 + θ >= 0
lsD
X23 is 5 - θ >= 0
C1 C2 C3 Supply
R1 5 1 0
Tu
R2 5 4 0
R3 5 0
Demand 0 0 0
Let’s again consider u1=0 and calculate the values of the remaining variables.
m
Now we will use the above calculated values of ui and vj to evaluate the non basic variables
.co
by computing ui + vj – cij for each non basic xij as follows,
iya
Non basic variables,
X12 = 0 - 3 - 2 = -5
un
X21 = 4 + 0 – 2 = 2
X31 = 2 + 0 – 2 = 0
lsD
X32 = 2 - 3 – 4 = -5
Now the value of x21 is most positive and hence the entering variable is X21.
ria
Next to determine the leaving variable, let amount be shipped from X21 then
X11 is 5 - θ >= 0
to
X13 is 1 + θ >= 0
X23 is 4 - θ >= 0
Tu
C1 C2 C3 Supply
R1 1 5 0
R2 4 5 0
R3 5 0
Demand 0 0 0
m
Let’s again consider u1=0 and calculate the values of the remaining variables.
.co
Basic variables Ui + Vj = Cij Solution
X11 U1 + V1 = 0 U1 = 0, V1 = 0
X13 U1 + V3 = 1 U1 = 0, V3 = 1
iya
X21 U2 + V1 = 2 U2 = 2, V1 = 0
X22 U2 + V2 = 1 U2 = 2, V2 = -1
X33 U3 + V3 = 3 U3 = 2, V3 = 1
un
Now we will use the above calculated values of ui and vj to evaluate the non basic variables
by computing ui + vj – cij for each non basic xij as follows,
lsD
X12 = 0 - 1 - 2 = -3
ria
X23 = 4 + 1 – 5 = -2
X31 = 2 + 0 – 2 = 0
X32 = 2 - 1 – 4 = -3
to
Now, none of the non basic variable is positive hence we terminate our iterations and
Tu
Cost = 1 * 0 + 4 * 2 + 5 * 1 + 5 * 1 + 5 * 3
= 33
Hungarian Method
The Hungarian method is an algorithm that finds an optimal assignment for a given cost
matrix.
Theorem: If a number is added to or subtracted from all the entries of any 1 row or column of
a cost matrix then the optimal assignment for the resulting cost matrix is also an optimal
assignment for the original cost matrix.
m
The following algorithm implements the above theorem to a given n*n cost matrix to find the
.co
optimal assignment.
1. Subtract the smallest entry in each row from all the entries of its row in the original
cost matrix.
3. Now we draw lines through appropriate rows and columns so that all the zero entries
un
of the cost matrix are covered with minimum number of such lines.
4. Test for optimality: If the minimum number of covering lines is n then we have
reached to the optimal solution and we can terminate here and if minimum number of
lsD
covering lines is less than n, we have to further follow the below steps.
5. Now we determine the smallest entry that is not covered by any line and subtracts this
minimum entry from each uncovered row and adds it to each covered column. Return
to step 3.
ria
This is a 3*3 matrix and first we calculated the smallest entry in each row as 250 in R1, 350
in R2, 200 in R3 and subtracted these entries from respective rows. The new matrix becomes
0 150 100
50 250 0
0 200 50
Now we calculated the smallest entry in each column as 0 in C1, 150 in C2, 0 in C3 and
subtracted these entries from respective columns. The new matrix becomes
m
0 0 100
.co
50 100 0
0 50 50
iya
Now we cover all the zeroes of the matrix by crossing R1, R2 and C1. Since the minimum
number of lines is 3 which is equals to n i.e.3, the optimal is reached and no further steps to
be followed.
Since the total cost for this assignment is 0, it must be an optimal assignment with R1C2,
un
R2C3 and R3C1.
Now the same assignment is made to the original cost matrix and the cost is calculated.
lsD
90 75 75 80
to
35 85 55 65
125 95 90 105
Tu
45 110 95 115
This is a 4*4 matrix and first we calculated the smallest entry in each row as 75 in R1, 35 in
R2, 90 in R3, 45 in R4 and subtracted these entries from the respective rows. The new matrix
becomes
15 0 0 5
0 50 20 30
35 5 0 15
0 65 50 70
Now we calculated the smallest entry in each column as 0 in C1, 0 in C2, 0 in C3, 5 in C4
m
and subtracted these entries from the respective columns. The new matrix becomes
.co
15 0 0 0
0 50 20 25
35 5 0 10
iya
0 65 50 65
Now we cover all the zeroes of the matrix by crossing R1, C1 and C3. Since the minimum
number of lines is 3 which is less than n i.e.4, hence we have to follow further steps to reach
un
the optimal solution.
Now the smallest entry that is not covered by any line is 5. So we subtracted 5 from each
uncovered row. The matrix becomes,
lsD
15 0 0 0
-5 45 15 20
30 0 -5 5
ria
-5 60 45 60
20 0 5 0
Tu
0 45 20 20
35 0 0 5
0 60 50 60
Now we again cover all the zeroes of the matrix by crossing R1, R3 and C1. Since the
minimum number of lines is 3 which is less than n i.e.4, hence we have to again follow
further steps to reach the optimal solution.
Now the smallest entry that is not covered by any line is 20. So we subtracted 20 from each
uncovered row. The matrix becomes,
20 0 5 0
-20 25 0 0
35 0 0 5
m
-20 40 30 40
.co
40 0 5 0
iya
0 45 20 20
55 0 0 5
0 60 50 60
un
Now we again cover all the zeroes of the matrix by crossing R1, R2, R3 and R4. Since the
minimum number of lines is 4 which is equals to n i.e.4, hence the optimal is reached and no
further steps to be followed.
lsD
Since the total cost for this assignment is 0, it must be an optimal assignment with R1C4,
R2C3, R3C2 and R4C1.
Now the same assignment is made to the original cost matrix and the cost is calculated.
ria
Cost = 80 + 55 + 95 + 45
= 275
to
Tu
Markov Chains
Introduction
Let Xt be a random variable that characterizes the state of the system at time t = 1, 2, ... The
collection of these random variables forms a stochastic process. The number of states in a
m
stochastic process may be finite or infinite.
.co
A stochastic process (collection of random variables) is a Markov process if the occurrence of
a future state depends only on the state immediately preceding it.
It is based on the principle of “memorylessness” which means that the next state of the
iya
process depends only on the previous state and not the sequence of states.
Given the chronological times t0, t1, ..., tn, collection of random variables {Xtn} = { x1, x2,...,
xn}is said to be a markov process if it possesses the following property:
un
P { Xtn = xn|Xtn-1 = xn-1, ..., Xt0 = x0 } = P { Xtn = xn|Xtn-1 = xn-1 }
In a Markov process with n exhaustive and mutually exclusive states, the probabilities at time
lsD
t = 0, 1, 2, ..., T. This is known as one-step transition probability of moving from state i at t-1
to state j at t.
From above definition, we have ∑ pij = 1, i = 1,2,…,n and pij >= 0, (i,j) = 1,2,...,n.
ria
We can also represent the above one-step transition probabilities using the following matrix
notation:
to
The matrix P defines the Markov chain and has the property that all its transition probabilities
Pij are fixed and independent over time.
The states of a Markov chain can be classified based on the transition probability pij of P.
m
2. Transient state: A state j is transient if it can reach another state but cannot return to
itself from another state.
.co
3. Recurrent state: A state j is recurrent if the probability of one state being revisited
from other states is 1.
4. Periodic state: A state j is periodic with period t>1 if a return is possible only in t, 2t,
iya
3t, ..., nt steps.
If a state is recurrent then it cannot be transient state but if a state is not transient then it is not
un
necessary that it is recurrent.
A closed Markov chain is an ergodic chain if all its states are recurrent and aperiodic.
ria
to
Tu
TutorialsDuniya.com
Download FREE Computer Science Notes, Programs, Projects,
Books PDF for any university student of BCA, MCA, B.Sc,
B.Tech CSE, M.Sc, M.Tech at https://www.tutorialsduniya.com