Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lesson 1 Linear Programming

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 77

Operational Research also known as Management Science ( in

British at the times of World War II when a team of British scientists


set out to make decisions regarding the best utilization of war
materials ) .

Management Science is a Problem-solving and Decision making science.


- is used whenever there is a problem of optimization.
Optimization may be Minimizing or maximizing.
Management Science is used to solve problem in different areas.
Industry :
Production, blending, product mix, inventory control, demand
forecast, transportation, scheduling and sequencing projects
Planning :
Planning for maximum growth of per capita income in short time,
Remove poverty and hunger as quickly as possible
Data Communication/Telecommunication :
Cabling, routing
Different techniques used in OR

 Linear Programming  Decision Analysis


 Transportation problems  Integer Programming
 Assignment Problems  Game Theory
 Network models  Forecasting
 Queuing Theory  Goal Programming
 Inventory models  Dynamic Programming
References

 Operations Research -Hamdy A. Taha (7th edition)


 Principles of operations research for Management –
Frank S. Budnick,Dennis Mcleavey,Richard Mojena
 Quantitative Techniques – Prof. KRMT Karunaratna
 Operations Research – Prem Kumar Gupta/ D.S. Hira
 Operational Research/Management Science (Theory and
applications) (Sinhala Medium)- Sarath S. Naotunna
 Operational Research – Sudath Manjula
Linear Programming
…….Linear Programming

Linear Programming can be considered as the most prominent OR technique in


Management Science.
LP is applies to optimization models in which the objective and constraints
functions are linear. LP is used in a wide range of applications, including
industry, agriculture, economics, transportations, health systems, behavioral and
social sciences.
…….Linear Programming
It is used two methods mainly to solve Linear Programming
problems.
They are
1. Graphical Method
2. Simplex Method

In LP models there may be problems involves with


1. Two variable problems
2. More than two variables
…….Linear Programming

Graphical method can be used to solve only two variables problems but simplex
method can be used to solve problems with any number of variables.

Whatever method is used it has to follow the following steps.


1. Identify the decision variables.
2. Construct the
(a) Objective function and (b) Constraint functions.
3. Find the feasible solutions.
4. Finally find the optimum solution. (Best solution)
Example
A company produces two types of products A and B. The
following table provides the information about raw materials
required and profit contribution by each product.

Requirement of raw materials Maximum Daily


(Kg) per unit of product availability of raw
Product A Product B materials (kg)

Raw material M1 6 4 24

Raw material M2 1 2 6

Profit per unit ( Rs.) 5 4


Find the number of each type of products to be produced which
would gives maximum profit.
Solution
Lets take it produces x1 number of type A and x2 number of type B.

Here x1 and x2 are called decision variables.


How to find objective function.

Here objective is to maximize the profit. Profit obtained by type A is Rs. 5x 1


and that is by type B is Rs. 4x2. Get total profit is z. Then
Maximize z= 5x1+ 4x2. (objective function)
How to find constraint functions.
It is needed 6x1 kg of raw material M1 to produce type A products and 4x2 kg of
raw material M1 to produce type B products. But avaibility of raw material M1 is 24
kg. Therefore 6x1+ 4x2 must be less than 24 kg.

6x1+ 4x2  24 (Constraint function 1)

It is needed 1x1 kg of raw material M2 to produce type A products and 2x2 kg of


raw material M2 to produce type B products. But avaibility of raw material M2 is 6
kg. Therefore x1+ 2x2 must be less than 6 kg.

x1+ 4x2  6 (Constraint function 2)

Number of products in each type must not be negasitive.

X1 , x2  0 (non-negativity Constraint)
Maximize z = 5x1 + 4x2

Subject to 6x1 +4 x2  24

x1 + 2x2  6

x1 , x2  0
…….Linear Programming

Graphical method can be used to solve only two variables problems but simplex
method can be used solve problems with any number of variables.

Examples
Graphical Method
Determine the feasible space for each of the following independent
constraints, given that x1, x2 >=0.
How to determine feasible solutions by determining feasible space (region)
a. -3x1+x2 ≤ 6 d. x1-x2 ≤ 0

b. x1- 2x2 ≥ 5 e. -x1 + x2 ≥ 0


c. 2x1-3x2 ≤ 12
…….Linear Programming

Graphical method can be used to solve only two variables problems but simplex
method can be used solve problems with any number of variables.

Examples
Graphical Method
Determine the feasible space for each of the following independent
constraints, given that x1, x2 >=0.
How to determine feasible solutions by determining feasible space (region)
a. -3x1+x2 ≤ 6 d. x1-x2 ≤ 0

b. x1- 2x2 ≥ 5 e. -x1 + x2 ≥ 0


c. 2x1-3x2 ≤ 12
Maximize z = 5x1 + 4x2

Subject to 6x1 +4 x2  24
x1 + 2x2  6
x1 , x2  0

6
z=
5x
1 +4 6x1 +4x2  24
x2

3 C
B

x1 + 2x2  6
O A
0,0 4 6
Corner point X1 X2 z = 5x1+ 4x2
O 0 0 0
A 4 0 20
B 3 1.5 21
C 0 3 12

Therefore z is maximum at x1=3 and x2=1.5


The maximum is 21.
Solve following linear programming model using graphical method.

Minimize z = 3x1 + 8x2

Subject to x1 + x2  9
x1 - 2x2  0
x1 + 2x2  28
3x1 - x2  0
x1 , x2  0

Steps:

• Draw the boundary lines of constraints and mark regions for


each.
• Detect the feasible region.
• Find the coordinates of corner points of feasible region.
• Calculate the objective function value for each of above corner
points.
• For the maximizing problem the solution is at where z is highest
and that for minimizing problem is at where z is lowest.
Solve following linear programming model using graphical method.

Minimize z = 3x1 + 8x2

Subject to x1 + x2  9
x1 - 2x2  0
x1 + 2x2  28
3x1 - x2  0
x1 , x2  0
3x1 - x2  0

14 x1 + 2x2  28 z=
3x
1 +8
x2
9 x +x 9 C
1 2

x1 - 2x2  0

D
B

A
0,0 9 28
Simplex Method

The graphical method in solving LP model cannot be applied when the number
of variables involved in the problem is more than three or rather two.
Even with three variables the graphical solution becomes more tedious as it
involves intersection of planes. The simplex method , developed by Prof. B.
Dantzig can be used to solve any LP problem.

Example 1.
A firm manufactures two products A and B on which the profit earned per unit
are Rs. 5 and Rs. 4 respectively. Each product is processed on two machines
M1 and M2. Product A requires six hours of processing time on machine M1
and one hour on M2, while B requires four hours on M1 and two hours on M2.
Machine M1 is available for not more than 24 hours while Machine M2 is
available for not more than 6 hours during one week. Find the number of units
of products A and B to be manufactured to get maximum profit.
Simplex Method of solving LP models
Example:
Maximize Z=5x1+4x2
6x1+4x2 <=24
x1+2x2 <=6
x1,x2 >=0
STEP 1

Express the problem in standard form.


Express all of the constraints as equalities by adding new variables. it is said to
be the standard form. Add new variables to objective function with zero
coefficients.
Maximize Z=5x1+4x2+0s1+0s2
6x1+4x2 +s1=24
x1+2x2 +s2=6
x1, x2, s1 , s2>=0
Here s1 and s2 are called Slack variables or slacks.
Slack variables represent unused amounts of resources.
STEP 2

Construct a table for initial basic feasible solutions.

Start with a initial feasible solution assuming all the decision variables
are zero.
Then x1=0 and x2=0 and s1=24 and s2=6.
This means neither of the items are produced.
Resources available are unused.
This situation is represented by a initial simplex table. (or tableau). It
is called basic feasible solution (ibfs).

x1=0 and x2=0 are decision variables.


But at ibfs they are called non-basic variables because they
are not in solution and s1=24 and s2=6 they are basic variables.
Calculate ratios
…….Step 2
dividing b values by
P.C. values
Cj 5 4 0 0
Select lowest out of
Cb Basis X1 X2 S1 S2 b positive ratios.

0 S1 6 4 1 0 24 24/6=4
0 S2 1 2 0 1 6 6/1=6
Zj 0 0 0 0 0
Cj-Zj 5 4 0 0

pivot column
Since all values in Cj-Zj row values are not negative or zero this solution is not
optimal. Then select the column with highest value in last row.
Then S1 row is the pivot row. Pivot element is 6.
Entering non-basic variable is X1 and departing basic variable is S1
Divide all values in pivot row by pivot element, 6 and fill same
row of new table.
5 X1 1 2/3 1/6 0 4
Calculate ratios
Next table (table2)
dividing b values by
P.C. values
Cj 5 4 0 0
Select lowest out of
Cb Basis X1 X2 S1 S2 b positive ratios.

5 X1 1 2/3 1/6 0 4 24/6=4


0 S2 0 4/3 -1/6 1 2 6/1=6
Zj 5 10/3 5/6 0 20
Cj-Zj 0 2/3 -5/6 0
How to calculate other row (2nd row).
Subtract the new pivot row from old values of the other row. P. row must be multiplied by the
value such that equalizing the pivot column value of the old row. Here multiplied by 1.

Previous other row : S2 1 2 0 1 6

- X1 1 2/3 1/6 0 4

New other row : X2 0 4/3 -1/6 1 2


..Table 2 Calculate ratios
dividing b values by
P.C. values
Cj 5 4 0 0
Select lowest out of
Cb Basis X1 X2 S1 S2 b positive ratios.

5 X1 1 2/3 1/6 0 4 4/(2/3)=6


0 S2 0 4/3 -1/6 1 2 2/(4/3)=3/2
Zj 5 10/3 5/6 0 20
Cj-Zj 0 2/3 -5/6 0

pivot column
Since all values in Cj-Zj row values are not negative or zero this solution is not
optimal. Then select the column with highest value in last row.
Then S2 row is the pivot row. Pivot element is 4/3.
Entering non-basic variable is X2 and departing basic variable is S2
Divide all values in p.row by p.element, 4/3 and fill same row of
new table.
4 X2 0 1 -1/8 3/4 3/2
Cj 5 4 0 0

Cb Basis X1 X2 S1 S2 b

5 X1 1 0 1/4 -1/2 3

4 X2 0 1 -1/8 3/4 3/2


Zj 5 4 3/4 1/2 21
Cj-Zj 0 0 -3/4 -1/2
How to calculate other row (1st row).
Subtract the new pivot row from old values of the other row. P. row must be multiplied by the
value such that equalizing the pivot column value of the old row. Here multiplied by 2/3.

Previous other row : X1 1 2/3 1/6 0 4

- X2 0 2/3 -1/12 1/2 1

New other row : S2 1 0 1/4 -1/2 3


Table 3

Cj 5 4 0 0

Cb Basis X1 X2 S1 S2 b

5 X1 1 0 1/4 -1/2 3

4 X2 0 1 -1/8 3/4 3/2


Zj 5 4 3/4 1/2 21
Cj-Zj 0 0 -3/4 -1/2

Since all values in Cj-Zj row values are negative or zero this solution is optimal.

Solution : X1 = 3 X2 = 1.5 Z=21

Solution : S1 = 0 S2 = 0 No unused resources.


Simplex Method of solving LP models
Example 2:
Maximize Z=2x1+5x2+6x3
2x1+3x2 +2x3 <=24
4x1+2x2 +4x3 <=36
2x1+3x2 +2x3 <=50
x1, x2, x3 >=0

STEP 1
Express the problem in standard form.
Express all of the constraints as equalities by adding new variables.
Add new variables to objective function with zero coefficients.
Maximize Z=2x1+5x2+6x3+0S1+0S2+0S3
2x1+3x2 +2x3 +S1=24
4x1+2x2 +4x3 +S2=36
2x1+3x2 +2x3 +S3=50
x1, x2, x3 S1, S2, S3 >=0
Here S1, S2 and S3 are Slack variables .
Slack variables represent unused amounts of resources.
STEP 2

Construct a table for initial basic feasible solutions.

Substitute x1=0, x2=0 and x3=0 in equations of standard form.

This means neither of the items are produced. profit is zero.


Then by the equations S1=24 , S2=36 and S3=50.
In this situation all resources available are totally unused.

x1, x2 and x3 are called non-basic variables because they are not in
solution.
S1, S2 and S3 they are basic variables.
…….Step 2 Calculate ratios
dividing b values by
Cj 2 5 P.C. values
6 0 0 0
Select lowest out of
Cb Basis X1 X2 S1 S2 positive ratios.
X3 S3 b

0 S1 2 3 2 1 0 0 24 24/2=12
0 S2 4 2 4 0 1 0 36 36/4=9 pivot row
0 S3 2 3 2 0 0 1 50 50/2=25
Zj 0 0 0 0 0 0 0
Cj-Zj 2 5 6 0 0 0

pivot column
Since all values in Cj-Zj row values are not negative or zero this solution is not
optimal. Then select the column with highest value in last row.
Then S2 row is the pivot row. Pivot element is 4.
Entering non-basic variable is X3 and departing basic variable is S2
Divide all values in pivot row by pivot element, 4 and fill same
row of new table.
6 X3 1 1/2 1 0 1/4 0 9
Cj 2 5 6 0 0 0

Cb Basis X1 X2 X3 S1 S2 S3 b

0 S1 0 2 0 1 -1/2 0 6
6 X3 1 1/2 1 0 1/4 0 9
0 S3
Zj
Cj-Zj
Calculation of 1st row (S1 row)
Write down the previous S1 row.
Multiply the pivot row by pivot column value 2 and subtract.
Previous S1 row : 2 3 2 1 0 0 24
Pivot row x 2: - 2 1 2 0 1/2 0 18
0 2 0 1 -1/2 0 6
Cj 2 5 6 0 0 0

Cb Basis X1 X2 X3 S1 S2 S3 b

0 S1 0 2 0 1 -1/2 0 6

6 X3 1 1/2 1 0 1/4 0 9
0 S3 0 2 0 0 -1/2 1 32
Zj
Cj-Zj
Calculation of 3rd row (S3 row)
Write down the previous S3 row.
Multiply the pivot row by pivot column value 2 and subtract.
Previous S3 row : 2 3 2 0 0 1 50
Pivot row x 2: - 2 1 2 0 1/2 0 18
0 2 0 0 -1/2 1 32
Calculate ratios
Cj 2 5 6 0 0 0 dividing bvalues by
P.C. values
Cb Basis X1 X2 X3 S1 S2 S3 b Select lowest out of
positive ratios.
0 S1 0 2 0 1 -1/2 0 6 6/2=3 pivot row
6 X3 1 1/2 1 0 1/4 0 9 9/(1/2)=18

0 S3 0 2 0 0 -1/2 1 32 32/2=16
Zj 6 3 6 0 3/2 0 54
Cj-Zj -4 2 0 0 -3/2 0

pivot column
Since there is a positive value, 2 in Cj-Zj row this solution is not optimal. Then
select the column with highest value in last row.
S1 row is the pivot row. Pivot element is 2.
Entering variable is X2 and departing variable is S1
Divide all values in pivot row by pivot element, 2 and fill same row of new
table.
5 X2 0 1 0 1/2 -1/4 0 3
Cj 2 5 6 0 0 0

Cb Basis X1 X2 X3 S1 S2 S3 b

5 X2 0 1 0 1/2 -1/4 0 3

6 X3 1 0 1 -1/4 3/8 0 15/2

0 S3 0 0 0 -1 0 1 26
Zj 6 5 6 1 1 0 60
Cj-Zj -4 0 0 -1 -1 0
Calculation of 2nd row (X3 row)
Calculation of 3rd row (S3 row)
Previous
PreviousXS3 3row
row: : 0 2 1 0 1/20 -1/2
1 0 1 1/432 0 9
(2):
Pivot row x (1/2): 0 2 0 0 1/21 0
-1/21/4 0 -1/86 0 3/2
0 0 1 0 -1
0 01 -1/4 1 3/8 26 0 15/2
Cj 2 5 6 0 0 0

Cb Basis X1 X2 X3 S1 S2 S3 b

5 X2 0 1 0 1/2 -1/4 0 3

6 X3 1 0 1 -1/4 3/8 0 15/2

0 S3 0 0 0 -1 0 1 26
Zj 6 5 6 1 1 0 60
Cj-Zj -4 0 0 -1 -1 0

Since there is no any positive values in Cj-Zj row this solution is optimal.

Solution : X1 = 0 X2 = 3 X3 = 7.5 Maximum Z=60


S1 = 0 S2 = 0 No unused resources.
S3 = 26 (unused) . Out of 50 units 24 only used by S 3.
How to solve problems with <= and =

Solve the following LP problem using simplex method.


Maximize Z=2x1+3x2+4x3

Subject to
3x1+x2+4x3 <=600
2x1+4x2+2x3 >=480
2x1+3x2+3x3 =540
x1, x2, x3 >=0
3x1+x2+4x3 <=600
As it has <= sign it can be add a slack variable, S 1.
3x1+x2+4x3 + S1 =600
But regarding 2x1+4x2+2x3 >=480 expression we have to deduct
some value (positive) from left hand side of the expression.
2x1+4x2+2x3 -S2 =480. S2 is called surplus variable.
But when x1=0, x2=0 and x3=0 then -S2 =480. Therefore S2 =-480.
To avoid S2 become negative another variable , A1 named artificial
variable is added to the RHS of the expression.
2x1+4x2+2x3 -S2 + A1 =480.

Even there is ‘=‘ sign in 2x1+3x2+3x3 =540 it makes an impossible


situation when x1=0, x2=0 and x3=0. That is 0=540 (impossible)
Therefore to avoid this situation an artificial variable A2 is added to
the RHS of the expression.
2x1+3x2+3x3 + A2 =540
In objective or z equation slack and surplus variables are contributed with
zero coefficients. But artificial variables are contributed with M
coefficients those are very large values.
They are deducted if it is maximizing problem.
They are added if it is minimizing problem.

Z=2x1+3x2+ 4x3+0.s1+0.s2-MA1-MA2

Standard form
Maximize Z=2x1+3x2+ 4x3+0.s1+0.s2-MA1-MA2

3x1+ x2+ 4x3 + s1 = 600


2x1+4x2+2x3 - s2+ A1 = 480
2x1+3x2+3x3 + A2 = 540

x1, x2, x3 , s1 , s2 , A1 , A2,>=0


Step 2

If both an artificial variable and a surplus variable contains in a


same constraint only one of them must includes into the basis.
Out of them artificial variable is selected. Therefore s2 is non-

basic and s2=0

Substituting x1=0 , x2=0 , x3=0, s2=0

S1=600, A1=480, A2=540, Z= -1020M (initial basic variables)


Cj 2 3 4 0 0 -M -M

Cb Basis X1 X2 X3 S1 S2 A1 A2 b

0 S1 3 1 4 1 0 0 0 600 600/1=600
-M A1 2 4 2 0 -1 1 0 480 480/4=120

-M 2 3 3 0 0 0 1 540 540/3=180
A2
Zj -4M -7M -5M 0 M -M -M -1020M
Cj-Zj 2+4M 3+7M 4+5M 0 -M 0 0

Entering non-basic variable is X2 and departing basic variable is A1

New pivot row:

3 X2 1/2 1 1/2 0 -1/4 1/4 0 120


Cj 2 3 4 0 0 -M

Cb Basis X1 X2 X3 S1 S2 A2 b

0 S1 5/2 0 7/2 1 1/4 0 480


480/(7/2)=960/7
3 X2 1/2 1 1/2 0 -1/4 0 120 120/(1/2)=240

-M A2 180/(3/2) =120
1/2 0 3/2 0 3/4 1 180

Zj 3/2-M/2 3 3/2-3M/2 0 -3/4-3M/4 -M 360-180M

Cj-Zj 1/2+M/2 0 5/2+3M/2 0 ¾+3M/4 0

Old 1st row: S1 3 1 4 1 0 0 600


pivot row x 1 X2 1/2 1 1/2 0 -1/4 0 120
New 1st row: S1 5/2 0 7/2 1 1/4 0 480

Old 3rd row: A2 2 3 3 0 0 1 540


pivot row x 3 X2 3/2 3 3/2 0 -3/4 0 360

New 3rd row: A2 1/2 0 3/2 0 3/4 1 180


Cj 2 3 4 0 0

Cb Basis X1 X2 X3 S1 S2 b

0 S1 4/3 0 0 1 -3/2 60
3 X2 1/3 1 0 0 -1/2 60

4 X3 1/3 0 1 0 1/2 120


Zj 7/3 3 4 0 1/2 660

Cj-Zj -1/3 0 0 0 -1/2

Old 1st row: 5/2 0 7/2 1 1/4 480


pivot row x 7/2 7/6 0 7/2 0 7/4 420
New 1st row: 4/3 0 0 1 -3/2 60

Old 2nd row: 1/2 1 1/2 0 -1/4 120


pivot row x 1/2 1/6 0 1/2 0 1/4 60

New 2nd row: 1/3 1 0 0 -1/2 60


Cj 2 3 4 0 0

Cb Basis X1 X2 X1 S1 S2 b

0 S1 4/3 0 0 1 -3/2 60

3 X2 1/3 1 0 0 -1/2 60

4 X3 1/3 0 1 0 1/2 120

ZJ 7/3 3 4 0 1/2 660

Cj-ZJ -1/3 0 0 0 -1/2

Solution is optimal. X1=0 X2=60 X3=120


Zmax=660
A diet conscious housewife wishes to ensure certain minimum intake of
vitamins A, B and C for the family. The minimum daily (quantity) needs of the
vitamins A, B , C for the family are respectively 40, 50 and 35 units. For the
supply of these minimum vitamin requirements, the housewife relies on two
types of fresh foods. The first one provides 2, 1, 1 units of the three vitamins
per gram of the foodstuff respectively and the second one provides 1, 2, 1
units of the same three vitamins per gram of the foodstuff respectively. The
first foodstuff costs Rs. 4 per gram and the second Rs. 3 per gram. Using the
graphical method find the grams of each foodstuff that should be bought by
the housewife everyday to keep her food bill as low as possible.
Solve the following LP problem using simplex method.
Minimize Z=4x1+3x2

Subject to
2x1+x2>= 40
x1+2x2>=50
x1+x2>= 35
x1, x2>=0
Solution

Step 1
Standard form
Minimize Z=4x1+3x2+ 0.s1+0.s2+0.s2+MA1+MA2+MA3

2x1+ x2- s1 + A1 =40


x1+2x2-s2 + A2 = 50
x1 + x2 -s3 + A3= 35

x1, x2, s1 , s2 , s3 ,A1 , A2, A3 >=0


Cj 4 3 0 0 0 M M M

Cb Basis X1 X2 S1 S2 S3 A1 A2 A3 b

M A1 2 1 -1 0 0 1 0 0 40 40/1=40
M A2 1 2 0 -1 0 0 1 0 50 50/2=25
M A3 1 1 0 0 -1 0 0 1 35 35/1=35

Zj 4M 4M -M -M -M M M M 125M
Cj-Zj 4-4M 3-4M M M M 0 0 0

Entering non-basic variable is X2 and departing basic variable is A2

New pivot row: Here A2 column is not included to the new table.

3 X2 1/2 1 0 -1/2 0 0 0 25
Cj 4 3 0 0 0 M M

Cb Basis X1 X2 S1 S2 S3 A1 A3 b

M A1 3/2 0 -1 1/2 0 1 0 15 15/(3/2)=10


3 X2 1/2 1 0 -1/2 0 0 0 25 25/(1/2)=50
M A3 1/2 0 0 1/2 -1 0 1 10 10/(1/2)=20

Zj 2M+3/2 3 -M M-3/2 -M M M 25M+75

Cj-Zj -2M+5/2 0 M -M+3/2 M 0 0

Old 1st row: A1 2 1 -1 0 0 1 0 40


pivot row x 1 X2 1/2 1 0 -1/2 0 0 0 25
A1 3/2 0 -1 1/2 0 1 0 15
Old 3rd row: A3 1 1 0 0 -1 0 1 35
pivot row x 1 X2 1/2 1 0 -1/2 0 0 0 25
A3 1/2 0 0 1/2 -1 0 1 10
Cj 4 3 0 0 0 M

Cb Basis X1 X2 S1 S2 S3 A3 b

4 X1 1 0 -2/3 1/3 0 0 10 10/(1/3)=30


3 X2 0 1 1/3 -2/3 0 0 20 20/(-2/3)=-30
M A3 0 0 1/3 1/3 -1 1 5 5/(1/3)=15

Zj 4 3 M/3-5/3 M/3-2/3 -M M 100+5M

Cj-Zj 0 0 -M/3+5/3 -M/3+2/3 M 0

Old 2nd row: X2 1/2 1 0 -1/2 0 0 25


pivot row x 1/2 X1 1/2 0 -1/3 1/6 0 0 5
X2 0 1 1/3 -2/3 0 0 20
Old 3rd row: A3 1/2 0 0 1/2 -1 1 10
pivot row x1/2 X2 1/2 0 -1/3 1/6 0 0 5
A3 0 0 1/3 1/3 -1 1 5
Cj 4 3 0 0 0

Cb Basis X1 X2 S1 S2 S3 b

4 X1 1 0 -1 0 1 5
3 X2 0 1 1 0 -2 30
0 S2 0 0 1 1 -3 15

Zj 4 3 -1 0 -2 110

Cj-Zj 0 0 1 0 2

Old 1st row: X1 1 0 -2/3 1/3 0 10


pivot row x 1/3 S2 0 0 1/3 1/3 -1 5
X1 1 0 -1 0 1 5
Old 2nd row: X2 0 1 1/3 -2/3 0 20
pivot row x (-2/3) S2 0 0 -2/3 -2/3 2 -10
X2 0 1 1 0 -2 30
Cj 4 3 0 0 0

Cb Basis X1 X2 S1 S2 S3 b

4 X1 1 0 -1 0 1 5
3 X2 0 1 1 0 -2 30
0 S2 0 0 1 1 -3 15

Zj 4 3 -1 0 -2 110

Cj-Zj 0 0 1 0 2

Since all Cj-Zj row values are non-negative it has been


obtained the optimal solution.
X1=5 X2=30 Minimum Cost = Rs. 110/=
S1=0 S2=15 S3=0
Surplus of Vitamin B is 15 units.
Sensitivity Analysis
Once the optimal solution to a LP problem has been attained situations may arise
changes in parameters (availability of resources, resource consumptions, relevant
cost or profit per unit ……. may affect the current solutions. It may cause to arise an
infeasible solution. Even if it is feasible, solution variables can be changed.
Sensitivity analysis is used to detect the new optimal solution or the ranges of
parameters (resources available, per unit cost or profit, constrain coefficients) without
re-computing the entire LP problem.
The following changes can be happened on current situation.

1. Changes of availability of resources, bj (Right-hand side coefficient


of constraints)
2. Changes of cost/profit coefficients, cj (objective function coefficients)
3. Changes of coefficients of constraints, aij
4. Addition or deletion of new variables
5. Addition or deletion of new constraints
Exercise 01.
A firm manufactures three products A ,B and C on which the profit earned per
unit are Rs. 20, Rs. 15 and Rs. 15 respectively. Each product is processed on
two machines M1 and M2. Product A requires 8 hours of processing time on
machine M1, B requires 2 hours on M1 and C requires 8 hours on M1. Each
product requires 4 hours in machine M2. Machine M1 is available for not more
than 100 hours while Machine M2 is available for not more than 60 hours
during one month. Find the number of units of products A, B and C to be
manufactured to get maximum profit.
Maximize Z=20x1+15x2+15x3+0s1+0s2
8x1+2x2 + 8x3 +s1=100
4x1+4x2 + 4x3+s2=60
x1, x2, x3, s1 , s2>=0
Here s1 and s2 are called Slack variables or slacks. Slack variables
are also represents unused amounts of resources.
Cj 20 15 15 0 0

Cb Basis X1 X2 X3 S1 S2 b

0 S1 8 2 8 1 0 100

0 S2 4 4 4 0 1 60

ZJ 0 0 0 0 0 0

Cj-ZJ 20 15 15 0 0

Initial Solution

Cj 20 15 15 0 0

Cb Basis X1 X2 X3 S1 S2 b

20 X1 1 0 1 1/6 -1/12 35/3


Optimal Sollution
15 X2 0 1 0 -1/6 1/3 10/3

ZJ 20 15 20 5/6 10/3 850/3

Cj-ZJ 0 0 -5 -5/6 -10/3


Changes of resources

Cj 20 15 15 0 0

Cb Basis X1 X2 X3 S1 S2 b
0 X1 1 0 1 1/6 -1/12 35/3

3 X2 0 1 0 -1/6 1/3 10/3

ZJ 20 15 20 5/6 10/3 850/3

Cj-ZJ 0 0 -5 -5/6 -10/3

x1+ x3 +(1/6) s1+(-1/12) s2=35/3

x2 +(-1/6)s1+(1/3) s2=10/3
…….Changes of resources
x1+ x3 +1/6 s1-1/12 s2=35/3 x2 -1/6 s1+1/3 s2=10/3

Change of 1st resource ( s1)


If s1 increases by 1 unit X1 increases by 1/6 units.
If s1 increases by 1 unit X2 decreases by 1/6 units.

Therefore If s1 increases by h units X1 increases by 1/6h units.


If s1 increase by h units X2 decreases by 1/6h units.

Therefore new solutions are 35/3 +h/6 and 10/3-h/6. In order to remain the
solution feasible those values must be positive.
35/3+h/6 >0 h >-70 100+h >30
10/3-h/6 >0 h < 20 100+h < 120
Therefore range of first resource must be from 30 to 120.
What will be the new solutions if the first resource is increased
by 12 units ?
Another method how to find effect of change of 0
resources
S1 b
Divide the solution values by relevant resource
column values. 1/6 35/3

(35/3) /(1/6) = 70 -1/6 10/3

(10/3) /(-1/6) =-20 5/6 850/3


Detect the lowest negative value and lowest
-5/6
positive values.
* Lowest negative value shows the allowable increase. (here 20)
* Lowest positive value shows the allowable decrease. (here 70)
Therefore current value 100 can be changed from 100 -70 to
100+20.
Therefore current value 100 can be changed from 30 to 120.
Time required in hours per unit Availability
in hours
A B C D
Machine P 1.5 2 4 3 550
Machine Q 4 1 2 1 700
Machine R 2 3 1 2 200
Profit per unit (Rs.) 4 6 3 1
Cj 4 6 3 1 0 0 0
Bas
Cb X1 X2 X3 X4 S1 S2 S3 b
is

3 X3 1/20 0 1 1/2 3/10 0 -1/5 125


0 S2 13/4 0 0 -1/2 -1/2 1 0 425
6 X2 13/20 1 0 1/2 -1/10 0 2/5 25
Optimum solution
Zj 81/20 6 3 9/2 3/10 0 9/5 525
Cj-Zj -1/20 0 0 -7/2 -3/10 0 -9/5
i Is it optimal solution? Why?
ii What is the optimal product mix and maximum profit?
iii Which machine has excess capacity? How much?
iv What are the shadow prices of each machine?
v If machine P is to be shut down for 50 hours due to repairs what
would be the effect on maximum profit?
vi If the profit contribution of product B is increased by Rs. 3 per unit
will the product mix change? What would be the new maximum
profit?
vii What is the maximum capacity of machine R so that no change in
the current product mix (B and C)?
Changes of objective function coefficients

1. Changes of objective function coefficients of non-basic variables

2. Changes of objective function coefficients of basic variables


1. Changes of objective function coefficients of non-basic variables

Example 1 Cj 4+h 6 3 1 0 0 0
b
Cb Basis X1 X2 X3 X4 S1 S2 S3

3 X3 1/20 0 1 1/2 3/10 0 -1/5 125


0 S2 13/4 0 0 -1/2 -1/2 1 0 425
6 X2 13/20 1 0 1/2 -1/10 0 2/5 25
Zj 81/20 6 3 9/2 3/10 0 9/5 525
Cj-Zj -1/20+h 0 0 -7/2 -3/10 0 -9/5
Let’s change in X1 variable as 4+h. Then Cj-Zj row X1 column value is -1/20+h

If -1/20+h<0 current solution remains unchanged. h <1/20.

If any non-basic variable is equals to zero at Cj-Zj row it arises


a special situation called multiple solution.
2. Changes of objective function coefficients of basic variables.
Example 1

Let’s change in X2 variable as 6+h. Then recalculate all Zj and Cj-Zj row values.
Cj 4 6+h 3 1 0 0 0
Cb Basis X1 X2 X3 X4 S1 S2 S3 b

3 X3 1/20 0 1 1/2 3/10 0 -1/5 125


0 S2 13/4 0 0 -1/2 -1/2 1 0 425
6+h X2 13/20 1 0 1/2 -1/10 0 2/5 25
Zj 81/20+13h/20 6+h 3 9/2+h/2 3/10-h/10 0 9/5+2h/5 525+25h
Cj-Zj -1/20-13h/20 0 0 -7/2-h/2 -3/10+h/10 0 -9/5-2h/5

Select those Cj-Zj row values which include h value. In order to remain the
current solution un effected all those values must be less than or equal to zero.
(if it is a maximization problem)

-1/20-13h/20<0 -1/13< h
-7/2-h/2<0 -7 < h
-3/10+h/10<0 h<3 -7 -9/2 -1/13 3

-9/5-2h/5<0 -9/2 < h


……Changes of objective function coefficients of basic variables.

Same result can be obtained applying the following method.

Identify the row of the basic variable which we intend to change.


Divide the coefficients of Cj-Zj row at non-basic columns by the
basic variable row coefficients of same columns.
Detect the lowest negative (L1) and lowest positive ( L2)
among those values.
L1 is the allowable decrease and L2 is the allowable increase.

row of the basic variable X2 13/20 1 0 1/2 -1/10 0 2/5 25


Cj-Zj -1/20 0 0 -7/2 -3/10 0 -9/5

(Cj-Zj)/Xj (-1/20) /(13/20) = -1/13


(-7/2) /(1/2) = -7/2
(-1/10) /(-3/10) = 3
(-9/5) /(2/5) = -9/2
2. …….Changes of objective function coefficients of basic variables.
Example

Let’s change in X3 variable as 3+h. Then recalculate all Zj and Cj-Zj row values.
Cj 4 6 3+h 1 0 0 0
Cb Basis X1 X2 X3 X4 S1 S2 S3 b

3+h X3 1/20 0 1 1/2 3/10 0 -1/5 125


0 S2 13/4 0 0 -1/2 -1/2 1 0 425
6 X2 13/20 1 0 1/2 -1/10 0 2/5 25
Zj 81/20+h/20 6 3+h 9/2+h/2 3/10+3h/10 0 9/5-h/5 525+125h
Cj-Zj -1/20-h/20 0 0 -7/2-h/2 -3/10-3h/10 0 -9/5+h/5

Select those Cj-Zj row values which include h value. In order to remain the
current solution un effected all those values must be less than or equal to zero.
(if it is a maximization problem)

-1/20-h/20<0 -1< h
-7/2-h/2<0 -7 < h
-3/10-3h/10<0 -1< h -7 -1 9

-9/5+h/5<0 h< 9
……Changes of objective function coefficients of basic variables.

Same result can be obtained applying the following method.

Identify the row of the basic variable which we intend to change.


Divide the coefficients of Cj-Zj row at non-basic columns by the
basic variable row coefficients of same columns.
Detect the lowest negative (L1) and lowest positive ( L2)
among those values.
L1 is the allowable decrease and L2 is the allowable increase.

row of the basic variable, X3 X3 1/20 0 1 1/2 3/10 0 -1/5 125


Cj-Zj -1/20 0 0 -7/2 -3/10 0 -9/5

(Cj-Zj)/Xj (-1/20) /(1/20) = -1


(-7/2) /(1/2) = -7
(-3/10) /(3/10) = -1
(-9/5) /(-1/5) = 9
Change of 2nd t resurce ( s2)
If s2 increase by 1 unit X1 decreases by 1/12 units.
If s2 increase by 1 unit X2 decreases by 1/3 units.
Special cases in LP models
• Degeneracy ( ties in ratio column)
• Multiple optimal solutions (a non-basic var.=0)
• Unbounded solution (all ratios are non positive)
• Infeasible solution ( at least one artificial var. in op. sol)
Degeneracy
1. It can happen when at least one basic variable has a zero value in
ibfs (initial basic feasible solution)
2. At any subsequent iteration when there is tie (same values) among
the minimum non-negative ratios.

There is no assurance that the solution can be improved in next table.


It may have the same Z in next iteration.

The degeneracy cannot be identified by graphical method.

b b

0 2
12 2
5 5
Multiple Optimal Solution

3x1 - x2  0

14 x1 + 2x2  28 z=
3x
1 +6
x2
9 x +x 9 C
1 2

x1 - 2x2  0
D
B

A
0,0 9 28

If Z line is parallel to one of boundary line all the points on that boundary
give optimal solutions. ( as in the example points of line BC)
In the optimal simplex table if a non-basic variable has a zero value in the Cj –Zj
row there exist an multiple solution.

It is because that non-basic variable can be entered to the solution without


changing optimal Z but causing the changes in decision variables or slack/surplus
variables.
This non-basic variable can be a decision variable or a slack variable or a surplus
variable.

In practically it is useful because the decision makers can have flexible decision
on having more choices in their optimal solutions
Example
Cj
Cb Basis x1 b

0 S1
0 S2
Z
Cj-ZJ 0
Unbounded Solution

An unbounded situation occurs when it is not possible to determine the


basic variable that should leave the basis. This arises when all the ratios
calculated are negative.

3x1 - x2  0
Ma
14 x :z
=3
x1 +
8x
2
9 x +x 9 C
1 2

x1 - 2x2  0
D
B

A
0,0 9 28
Example

Cj
Cb Basis b

0 S1 -4 24 -6
0 S2 -2 18 -9
Z
Cj-ZJ
Infeasible Solution

If all the constraints are not satisfied simultaneously the model has no
Infeasible solution. In simplex method when the optimal solution occurred
there exist an Artificial variable in the basis then model is infeasible.
Cj
Cb Basis x1 x2 b An optimal solution
0 S1
0 A1
Z
Cj-ZJ -3 -1 -M -6

6
4 x1
+ x1 +
x2 3x
4
2  1
8

0,0 4 18

You might also like