You are on page 1of 83

THE INSTITUTE OF FINANCE MANAGEMENT

(IFM)

Department of Computer Science Mathematics

Linear Programming Problem


(LPM)
Topic content
1. Formulating the linear programming model
2. Solving the linear programming model (graphical
and simplex)
3. Sensitivity analysis
4. The dual linear programming model
Linear Programming
• Linear programming is the technique for choosing the best
alternative from the set of feasible alternatives, in the
situations in which the objective function as well as the
constraints can be expressed as linear mathematical function
(VOHRA , 2007)

• Linear programming is a mathematical technique used to


allocate scarce resources in organization (Baradyana, S and
Ame A, 2005).

• Scarce resources are limited materials that have to be


optimized. e.g money, labour, time, timber, raw materials etc
Application of linear programming
• Linear Programming is applied in area like
1. food preparation
2. furniture manufacturing
3. loan allocation in banks
4. products manufacturing in factories, etc.
Formulation of Linear Programming Problem/
Model (LPM)
Procedure in formulation of LPM
1. Determine the objective of formulating of a linear programming
problem (e. g minimization of cost or maximization of profit or
sales)
2. Determine the variables in the problem (e. g tables, chairs, coast,
gown, etc. )
3. Determine the constraints to the problem
4. Write the objective function and constraints using variables
General form of Linear Programming
Problem
Linear programming problem can be written as
Objective function
Maximize , Z  c 1 x 1  c 2 x 2  ...  c n x n
Subject to
a 11 x 1  a 12 x 2  ...  a 1 n x n  b 1
a 21 x 1  a 22 x 2  ...  a 2 n x n  b 2
  
a m 1 x 1  a m 2 x 2  ...  a mn x n  b m

x 1 , x 2 ,..., x n  0 non  negativity restricti on


Maximisation
n
• Maximize, z  c
j1
j xj

n
Subject to c
j1
ij x j  bi for i  1, 2 ,..., m

xj  0 for j  1, 2,..., n
General form of LPP …
Objective function
Minimize , Z  c1 x 1  c 2 x 2  ...  c n x n
Subject to
a 11 x 1  a 12 x 2  ...  a 1n x n  b 1
a 21 x 1  a 22 x 2  ...  a 2 n x n  b 2
  
a m1 x 1  a m 2 x 2  ...  a mn x n  b m

x 1 , x 2 ,..., x n  0 non  negativity restricti on


Minimisation
n
• Minimize z  j1
c jx j

n
Subject to 
j1
c ij x j  bi for i  1 , 2 ,..., m

xj  0 for i  1 , 2 ,..., n
Assumptions underlying Linear
Programming Model
• Linear programming model is based on the
assumptions of
1) Proportionality
2) Additively
3) Continuity
4) Certainty
5) Finite choices
Solution of Linear Programming
Model
• There two ways of solving the linear programming
model
a. Graphical method
b. Simplex method
Solving a Linear Programming by Graph ...

Steps
1. Plot the constraints on a Cartesian plane
2. Identify the feasible region (region satisfies all the
constraints) on the plotted graph.
3. Find the coordinates of the extreme points of the feasible
region
4. Determine the value of the objective function for each of the
extreme point of the feasible region
5. Determine the optimal solution for the problem
6. For maximization problem, the optimal solution
will be that corner point which provides the highest
value of the objective function

7. For minimization problem will be obtained at a


corner point that provides the lowest value of the
objective function.
Example 1
• Ludewa food processing company produces two types of
children feeds using a combination of maize and
groundnuts as raw materials. To produce feed type 1 the
company needs 6 tons of maize and one tons of
groundnuts To produce food type two the company
needs four ton of maize and two tons of groundnuts. A
survey indicates that
1. Demand for feed type two cannot exceed that of type
one by one ton
2. Maximum daily demand for feed type two is 2 tons
Example Cont
On daily bases , there are 24 tons of maize and six
tons of groundnuts available. Also the profit for feed
type one is 5 (‘000’) per ton and 4 (‘000’) for feed
type two. How many tons of feed type one and two
should Ludewa Co produce on daily bases in order to
maximize profit.
Solution
The above information can be summarized as
Materials Decision variable Resource
Feed type 1 Feed type 1 available

Maize 6 4 24
G’nuts 1 2 6
Profits ('000’) 5 4  
1. Decision variable
Let X1 be the number of tons for feed type one
X2 be the number of tons for feed type two
Solution cont …
2. Objective function
Max (h) = 5X1+4X2

3. Constraints
6X1+ 4X2 ≤ 24
X1 + 2X2 ≤6
- X1 +X2 ≤ 1
X2 ≤ 2
X2 , X1 ≥ 0
Solution cont …
4. Linear programming model

Max (h) = 5X1+4X2

Subject to 6X1+ 4X2 ≤ 24


X1 + 2X2 ≤6
- X1 +X2 ≤ 1
X2 ≤ 2
X2 , X 1 ≥ 0
Solution cont …
Using the graphical method

Use intercept

6X1+ 4X2 ≤ 24, at (0, 6) and (4,0)

X1 + 2X2 ≤ 6, at (0, 3) and (6,0)

- X1 +X2 ≤ 1 at (0, 1) and (-1,0)

X2 ≤ 2 here X2 = 2
Graph of Linear Programming
6
y 6
 X1  X 2  1

X2  2
2 E D
F C
X1  2X2  6

-2 0
A
2
B
4 6 x
6 X1  4 X 2  24
Optimal Solution
Conner Max (h) = 5X1+4X2 h
Point
A(0,0) h= 5(0) + 4(0) 0
B(4,0) h= 5(4) + 4(0) 20
C(3, 1.5) h= 5(3) + 4(1.5) 21
D(2,2) h= 5(2) + 4(2) 18
E(1,2) h= 5(1) + 4(2) 13
F(0,1) h= 5(0) + 4(1) 4
Ludewa company should produce 3 tons of feed type 1
and 1.5 for feed type 2 in order to maximize the profit.
Example 2
• The final product of a firm has a requirement that
it must weight exactly 150kg. The two raw
materials used in manufacture this product are A
with a cost of Tshs 2 per units and B with a cost
of Tshs 8 per units. At least 14 units of B and no
more than 20 units of A must be used. Each unit
of A weighs 5kg and each unit of B weighs 10 kg.
How much each type of raw material should be
used for each unit of the final product if cost is to
be minimized?
Solution
Decision variable
X1= Number of units used for raw material A
X2= Number of units used for raw material B
 
Objective function
Minimize (h) = 2X1+8X2
 
Constraints
5X1+10X2 = 150
X1 ≤20
X2 ≥14
X1 ≥ 0
Multiple Optimal solution
• Multiple Optimal solution happens when a given linear
programming problem has more than one optimal
solution.
• Each of the multiple optimal would naturally yields the
same objective function value
• Example
Minimize (Z) = 8X1+16X2
  Subject to X1+X2 ≤ 16
X2 ≤ 125
3X1+6X2 ≤ 900
X1 , X2 ≥0
Graph of Linear Programming
200
y 6 X1  2 X 2  200

150
X 2  125
E D
100
C
3 X 1  6 X 2  900
50
A B
-2 0 100 200 300 x
Optimal Solution
Conner Point Z = 8X1+16X2 z

A(0,0) Z = 8(0)+16(0) 0
B(0,125) Z = 8(0)+16(125) 2000
C(50, 125) Z = 8(50)+16(125) 2400
D(100,100) Z = 8(100)+16(100) 2400
E(200,0) Z = 8(200)+16(0) 1600
Point C and D clearly represent the optima.
Infeasibility
• Infeasibility is the possibility that the constraints may
be inconsistent so that there is no feasible solution to
the problem.

• Example
Minimize (Z) = 20X1+30X2
  Subject to 2X1+X2 ≤ 40
4X1-X2 ≤ 20
X1 ≤ 900
X1 , X2 ≥0
Graph of Linear Programming
40
y 6 X1  2 X 2  200

20
X1  30
10
3 X 1  6 X 2  900
-2 0 10 20 30
• 10
x

Feasible region
Unboundedness
• For maximization type of the linear programming
problem, unboundedness occurs when there is no
constraint on the solution so that one or more of the
decision variables can be increased indefinitely without
violating any of the restrictions (constraints)
• An unbounded LPP occurs if it is possible to find points
in the feasible region with arbitrarily large Z- value (may
be profit or revenue)
• Example: Minimize (h) = 10X1+20X2
  Subject to 2X1+4X2 ≥ 16
X1+5X2 ≥ 15
X1 , X2 ≥0
Graph of Linear Programming
8
y 6
X1  5 X 2  15
6
FEASIBLE
4

0 6 12 18 x

2 X 1  4 X 2  16
Simplex Method of Solving LPP
• Is a set of instructions which seek to examine
corner point in a methodical manner until the
best solution ensuring highest profit or lowest
cost under given constraints is obtained
Procedure to Develop the Simplex table
• 1st STEP: Change all constraints containing <, ≤,
>, ≥, into constraints containing =.
i. Constraints with <, ≤ are changed to constraints with =
sign by adding a slack variable.
e.g. 5X1+2X2 ≤ 22 will be 5X1+2X2 +S1 = 22

ii. Constraints with >, ≥ are changed to constraints with = by


subtracting a slack (surplus) variable and then adding an
artificial variable.
e.g. 3X1+4X2 ≥ 22 will be 3X1+4X2 - S1+A1 = 22

iii. Constraints with = are again given an artificial variable


12X1+8X2 = 36 will be 12X1+8X2 +A1= 36
Procedure to develop the simplex …
• 2nd STEP: Write the standard form of simplex
objective function that contains slack, surplus
and artificial variables.
i. The coefficient of every slack and surplus
variables in the objective function will be
zero
ii. The coefficient of every artificial variable
in the objective function will be - M for
maximization and +M for minimization
Procedure to develop the simplex …
• 3rd STEP: Form the Initial Simplex
C1 List coefficients of all
variable s as in objective
function
List variable s as in RHS
objective function
Coefficients of basic Basic List Coefficients of all RHS value
variable as in the variables variable as they appear in of each
objective function each constraint constraint

Z1 The sum of product of


coefficients of basic
variables and the
coefficients of the
constraints
C1 – Z1
Procedure to develop the simplex …
• 4th STEP: complete the row Ci and Ci – Zi

• 5th STEP: Assume a basic variable = corresponding to


RHS value. In our example
S1 = 24, S2= 6, X1 = 0, and X2= 0

• 6th STEP: Determine whether the basic feasible


solution is optimal
i. For Maximisation , the basic feasible solution will be
optimal if all values in row Ci – Zi ≤ 0
ii. For Minimisation , the basic feasible solution will be
optimal if all values in row Ci – Zi ≥ 0
Procedure to Develop the simplex …
• 7th STEP: From the Second Simplex
table
a) Identify values which makes the feasible solution not
optimal in row Ci – Zi . Take the highest of these
values . The column in which this highest value lies is
called the pivot column
b) Identify the positive coefficients of the constraints in
the pivot column. This is gives us the entering
variable
c) Divide RHS values by corresponding +ve coefficients
identified in (b) above we get ratios, then identify the
resulting the smallest
Procedure to develop the simplex …
d) The row in which the smallest resulting number
lies is called row.
e) The integer between pivot column and pivot row
is called pivot element (number)
f) Replace the variable in the pivot row by variable
in the pivot column
• Confidents in the row replacing pivot row are
the original coefficients divide by pivot
number
Procedure to develop the simplex …
• Other coefficient is obtained from: -
 corresponding new  coefficient in the 
  
 coefficient in the row  pivot columnof 
 new   Old  
     replacingpivot column that row 

 coefficient    coefficient 
 in a row   in the same row  pivot number
   
Example
• Solve the following linear programming problem
using simplex method
Max (Z) = 5X1+4X2

Subject to 6X1+ 4X2 ≤ 24


X1 + 2X2 ≤6
- X1 +X2 ≤ 1
X2 ≤ 2
X2 , X1 ≥ 0
Example cont…
• Simplex standard equation
Max. Z = 5X1+4X2+0S1+0S2

S.t, 6X1+ 4X2 + S1 = 24


X1 + 2X2 +0S1 +S2 = 6
- X1 +X2 +0S1 +0S2 +S3 = 1
0X1+X2 +0S1 +0S2 +0S3 +S4 = 2
X1, X2, S1’ S2, S3, S4 ≥ 0
Initial simplex table
  Cj 5 4 0 0 0 0  

CB Basis X1 X2 S1 S2 S3 S4 RHS

0 S1 6 4 1 0 0 0 24
0 S2 1 2 0 1 0 0 6
0 S3 0 1 2 0 1 0 1
0 S4 0 0 1 0 0 1 2
  Zj 0 0 0 0 0 0 0
  Ci-Zj 5 4 0 0 0 0  
Initial simplex table
Pivot Column
  Cj 5 4 0 0 0 0  

Pivot row
CB Basis X1 X2 S1 S2 S3 S4 RHS Ratio

0 S1 6 4 1 0 0 0 24 4
0 S2 1 2 0 1 0 0 6 6
0 S3 -1 1 2 0 1 0 1 -1
0 S4 0 0 1 0 0 1 2 ∞
  Zj 0 0 0 0 0 0
  Ci-Zj 5 4 0 0 0 0  

Pivot element
2
nd
simplex table
  Cj 5 4 0 0 0 0  

CB Basis X1 X2 S1 S2 S3 S4 RHS

5 X1 1 2/3 1/6 0 0 0 4
0 S2 0 4/3 -1/6 1 0 0 2
0 S3 0 4/3 1/6 0 1 0 5
0 S4 0 1 0 0 0 1 2
  Zj 5 5/2 5/6 0 0 0 20
  Ci-Zj 0 3/2 -5/6 0 0 0  
2nd
simplex table
Pivot column
  Cj 5 4 0 0 0 0  

CB Basis X1 X2 S1 S2 S3 S4 RHS Ratio

Pivot row
5 X1 1 2/4 1/6 0 0 0 4 8
0 S2 0 4/3 -1/6 1 0 0 2 3/2
0 S3 0 4/3 1/6 0 1 0 5 20/3
0 S4 0 1 0 0 0 1 2 2
  Zj 5 5/2 5/6 0 0 0 20
  Ci-Zj 0 3/2 -5/6 0 0 0  

Pivot element
3
nd
simplex table
  Cj 5 4 0 0 0 0  

CB Basis X1 X2 S1 S2 S3 S4 RHS

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

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

0 S3 0 0 3/8 -5/4 1 0 5/3

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


  Zj 5 4 1/4 1/2 0 0
  Ci-Zj 0 0 -1/4 -1/2 0 0  
Solution
• BFS is
Optimal Solution = 21
X1 = 3
X2 = 1.5
S3 = 5/3
S4 = 1/2 Abundant
S1 = 0
S2 = 0 Scarce
Example 2
• Solve the following linear programming problem using
simplex method

Minimize (Z) = 40X1+24X2

Subject to 20X1+ 50X2 ≥ 4,800

80X1+ 50X2 ≥ 7,200

X2 , X 1 ≥ 0
Example cont…
• Simplex standard equation

Minimize (Z) = 40X1+24X2+0S1+0S2+MA1+MA2

Subject to 20X1+ 50X2 - S1 +A1 = 4,800

80X1+ 50X2 - S2 +A2= 7,200

X2 , X1 , S1, S2, A1,A2≥ 0


Initial simplex table
  Cj 40 24 0 0 M M  
CB Basis X1 X2 S1 S2 A1 A2 RHS
M A1 20 50 -1 0 1 0 4,800
M A2 80 50 0 -1 0 1 7,200

  Zj 0 0 0 0 0 0 0
  Ci-Zj 40 24 0 0 M M  
Initial simplex table
Pivot Column
  Cj 40 24 0 0 M M  

Pivot row
CB Basis X1 X2 S1 S2 A1 A2 RHS Ratio

M A1 20 50 -1 0 1 0 4,800 96

M A2 80 50 0 -1 0 1 7,200 144

  Zj 0 0 0 0 0 0 0

  Ci-Zj 40 24 0 0 M M  

Pivot element
2nd Simplex table
  Cj 40 24 0 0 M M  

CB Basis X1 X2 S1 S2 A1 A2 RHS Ratio

24 X2 2/5 1 -1/50 0 1/50 0 96 240

M A2 60 0 1 -1 -1 1 2,400 40

  Zj 48/5+60M 24 -24/50-M -M 24/50-M M

  Ci-Zj 152/5-60M 0 12/25+M M 2M-12/50 0  


2nd simplex table
  Cj 40 24 0 0 M M  

CB Basis X1 X2 S1 S2 A1 A2 RH Ratio
S
24 X2 0 1 -2/75 1/150 2/75 -1/150 80 3000

40 X1 1 0 1/60 -1/60 -1/60 1/60 40 2400

  Zj 40 24 -2/75 -38/75 -2/75 38/75

  Ci-Zj 0 0 2/75 38/75 M+2/75 M-38/75


3nd
simplex table
  Cj 40 24 0 0 M M  

CB Basis X1 X2 S1 S2 A1 A2 RHS

24 X2 8/5 1 0 -1/50 0 1/50 144

0 S1 60 0 1 -1 -1 1 2400

  Zj 192/5 24 0 -24/50 0 24/50

  Ci-Zj 8/5 0 0 24/25 M M-24/50


Solution
• Optimal Solution
Z= 40x0+24x144+0x2400+0x0+0xM+0xM
=Rs 3,456
X1 = 0
X2 = 144
S1 = 2,400 Abundant
S2 = 0
A1 = 0 Scarce
A2 = 0
Duality
Duality
• Primal LPM is the linear programming
focuses on maximization of earning, while
Dual LPM is the linear programming model
that focuses on the proper utilization of
recourses.
Rules of changing the primal into its Dual
a. State the dual decision variables.
For every constant with ≥, ≤ define one
dual decision variable
For every constant with = define two
decision variables
b. State the dual objective function. If the
objective function of the primal is to
maximize, the objective function of the dual
will be to minimize and vice – versa
Rules of changing the primal into its Dual…
c. Change the primal formulation into its canonical
form.
The canonical form of the maximization
problem is to have all constraints with ≤ sign
The canonical form of the minimization problem
is to have all constraints with ≥ sign
d. Determine the coefficients of dual objective
function.
The coefficients of the dual objective function
are the right hand side values (RHS) of the
primal canonical formulation
Rules of changing the primal into …
e) Determine the coefficients of dual constraints.
The coefficients of the dual resource
constraints are the coefficients of the
corresponding primal variables.
f) Determine the right hand side values of the dual
resources constraints.
The right hand side values of the dual
resources constraints are corresponding
objective function coefficients of the primal
function
Rules of changing the primal into …
g) Change the inequality signs.
Inequality signs are simply changed i,e ≥ to
the primal becomes ≤ to the dual and vice
versa.
Writing the dual
• Primal • Dual
Maximise Z = Cx Minimise G = b′y
Subject to ax ≤ b Subject to a′y ≥ c′
x≥0 y≥0
where where
C= row matrix containing b′= transpose of the b matrix of
coefficients in the objective the primal problem
X = column matrix containing the a′ = transpose of the coefficients
decision variable matrix of the primal problem
a = matrix containing the c′ = transpose of the matrix of the
coefficients in the constraints objective function coefficients
b = column matrix containing the of the primal problem
RHS values of the constraints Y = column matrix of the dual
variables
Example 1
• Change the following primal LPM into dual.

Minimize Z = 2X1 – 3X2

Subject to X1 + 2X2 ≤ 12

4X1 - 2X2 ≥ 3

6X1 - X2 = 10

X1’ X2 ≥ 0
Solution
• Stating the dual variable
Minimize Z = 2X1 – 3X2

Subject to X1 +2X2 ≤ 12
4X1 - 2X2 ≥ 3
6X1 - X2 ≤ 10
6X1 - X2 ≥ 10
X1’ X2 ≥ 0
Solution
• Changing to canonical form
Minimize Z = 2X1 – 3X2

Subject to -X1 -2X2 ≥ - 12


4X1 -2X2 ≥ 3
-6X1+X2 ≥ -10
6X1- X2 ≥ 10
X1’ X2 ≥ 0
Solution
• New variables for the dual to be are Y1, Y2, Y3,
Y4 because we have four constraints

Max Z = -12Y1+3Y2-10Y3 +10Y4

Subject to -Y1 + 4Y2 - 6Y3+ 6Y4 ≤ 2


-2Y1- 2Y2 +Y3 - Y4 ≤ -3
Y1, Y2, Y3, Y4 ≥ 0
Example 2
• Change the following primal LPM into
dual.
Max Z = 50X1 +40X2

Subject to 3X1 +5X2 ≤ 150


X2 ≤ 20
8X1 +5X2 ≤ 300
X1’ X2 ≥ 0
Solution
• Dual problem

Min Z = 150Y1 +20Y2+300Y3

Subject to 3Y1 +8Y3 ≥ 50

5Y1 + Y2+5Y3 ≥ 40

Y1,Y2,Y3 ≥ 0
Solution of dual problem
• We use simplex method to obtain the
dual solution
Sensitivity Analysis
Sensitivity Analysis
• Sensitivity Analysis is the procedure in linear
programming which involves investigate the status of
parameters of linear programming problem.
• These parameter are coefficients of objective
functions and constraints
• Two cases going to be discussed
1. Case One: change of objective function
Parameters
2. Case two: Changing the availability of recourses
affecting optimum solution
Sensitivity Analysis …
• Case One: Change of objective function Parameters

Z  C1X 1  C 2 X 2

• Redundant are the equations do not affect the optimal


solution

C 1X 1 Z
X 2   
C2 C2
Case one: Change of Objective function
Parameters
y L1  6X1  4X2  24

L 2  X1  2 X 2  6

x
L 0  Z  C1X1  C2X 2
Sensitivity Analysis …
• To what extend can we change
3
S L  
1
2
1
S L  
2
2
C
S L   1
0
C 2
Sensitivity Analysis …
• Means
3 C 1
  1
 
2 C 2 2

3 C 1
 1

2 C 2 2
1 C 3
i)  1
 
2 C 2 2

2 C
ii )  2
 2
3 C 1
Sensitivity Analysis …
• But, for C2=4 into (i)

Z  5X 1  4X 2

1 C 3
i)  1

2 C 2 2
1 C1 3
 
2 4 2
2  C1  6
Sensitivity Analysis …
• for C1= 5, into (ii)
2 C
ii )  2
 2
3 C 1

2 C 2
  2
3 5
10
 C 2  10
3
Case two: Changing the availability of recourses
affecting optimum solution
y
6X1  4X2  36
6X1  4X2  M1
L 2  X1  2 X 2  6

(2,2)

(6,0)
x
6X1  4X2  20
6X1  4X2  M2 6X1  4X2  24
Sensitivity Analysis …
• Fixing line L2
X  0 3
2
 
X 1  6 2

3X 1  2X 2  18

6X 1  4X 2  36
Sensitivity Analysis …
• .
X  2 6
2
 
X 1  2 4

6X 1  4X 2  20

20  M 1  36
Case two: Changing the availability of recourses
affecting optimum solution

X1  2X2  B
X1 2X2  6
X1  2X2  A
2,8 / 3

x
4,0

L1  6X1  4X2  24
Sensitivity Analysis …
• Fixing line L1

20  M 1  36
A  M 2  B
X  0 1
2
 
X 1  4 2
Sensitivity Analysis …
X1  2X 2  4

A4

X  2 1
2
 
8 2
X 1 
3
Sensitivity Analysis …

20
X 1  2X 2 
3
20
B 
3
60
4  6 
3

You might also like