Yardstick International College: Chapter Two: Linear Programing (LP) BY Shewayirga Assalf (Asst. Prof.)
Yardstick International College: Chapter Two: Linear Programing (LP) BY Shewayirga Assalf (Asst. Prof.)
Yardstick International College: Chapter Two: Linear Programing (LP) BY Shewayirga Assalf (Asst. Prof.)
November 2022
HISTORY
OF LP
linear programs.
Introduction
Optimization
Characteristics of Optimization Problems
One or more decisions
Restrictions or constraints
Objective
maximizes profits
Decision variables
X1 , X2 , X3 , … , Xn
e.g. the quantities of different
products
Index n = the number of
product types
f(X1 , X2 , X3 , … , Xn) < b
Constraints f(X1 , X2 , X3 , … , Xn) > b
– a less than or equal to constraint :
f(X1 , X2 , X3 , … , Xn) = b
– a greater than or equal to constraint :
– an equal to constraint :
Objective
Subject to:
f(X1 , X2 , X3 , … , Xn) < bm
f(X1 , X2 , X3 , … , Xn) = bm
note : n variables , m
constraints
Requirements For Application Of Linear Programming
1. Proportionality
2. Additivity
3. Continuity
4. Certainty
5. Finite choices
6. Non-negativity
ADVANTAGES OF LINEAR PROGRAMMING
model constraints,
constraint)
x1 ≤40 (Constraint on
demand for soldiers)
x1 = bags of Super-gro
x2 = bags of Crop-quick
The Objective
Function
where
St:7x1 + 2x2 ≥ 28
2x1 + 12x2 ≥
24
x1, x2 ≥ 0
Home work
A company is making two products A and B. The cost of
producing one unit of product A and B is $ 60 and $ 80
respectively. As per the agreement, the company has to supply at
least 200 units of product B to its regular customers. One unit of
product A requires one machine hours whereas product B has
machine hours available abundantly within the company. Total
machine hours available for product A are 400 hours. One unit of
each product A and B requires one labour hour each and total of
500 labour hours are available. The company wants to minimise
the cost of production by satisfying the given requirement.
Formulate the problem as a linear programming problem.
LP:
Graphical method
Solution of Linear Programming Problems
Then draw the line for the values of x1 and x2 which represents
the particular constraint. Once the lines are drawn for all
feasible polygon (area) by shading the area below the line for the
Contd
Step III. Identify the extreme points of the feasible polygon and
name the Corners.
2x1 + 4x2 = 48 X 1 X2
∴ 2x1= 48 or x1 =24
0 12
24 0 ∴ 4x2 = 48 or x2 = 12
Feasible
region
contd
Step III. Both the constraints are to be satisfied
simultaneously, therefore, OACD becomes the region of
feasible solution. This is also known as feasible polygon.
On line OA, point A give maximum profit, on line OD, point
D gives maximum profit.
contd
Step IV. Evaluate the objective function Z= 8x1 + 6x2 for all points of
feasible region i.e. O,A,C,D.
At point O profit is ∴ Z=O
zero
∴ Z=12x6=72
At point A x2=12, x1=0
∴ Z=15x8=120
At point D x1=15, x2=0
∴
At point C x1=12, x2=6 Z=12x8+6x6=132
(from graph)
Step V. Z is maximizing objective function, hence the point with maximum
value of Z is the optimal solution point.
Therefore at point C (Z=132) with x1=12 and x2=6 is the optimal point.
A maximization model (class work)
X Company is a small crafts operation run by an American natives. The
company employs skilled artisans to produce clay bowls and mugs with
authentic Native America designs and colors. The two primary resources used
by the company are special pottery clay and skilled labor. Given these limited
resources, the company desires to know how many bowls and mugs to produce
each day in order to maximize profit.
The two products have the following resource requirements for production and
profit per item produced (i.e., the model parameters):
Resource Requirements Required:
formulate linear
model,
product Labor (hr/unit) Clay (lb/unit) Profit/unit graphically solve
Bowl 1 4 40 ,
the optimum
find
point
Mug 2 3 50
There are 40 hours of labor and 120 pounds of clay available each day for
production.
answer
Contd X2
The labor constraint area
60
50
Letting X1 and solving for X2
40
Let’s first consider labor constraint line first
30
1(0)+2X1=40 20
X2= 20 10
1X1+2(0)=40 X1
0 60
10 20 30 40 50
X1=40 (40,20) X2
The constraint area for clay
Then, let’s consider clay constraint 60
4(0)+3X2=120 50
40
X2=40
30
4X1+3(0)= 120 20
X1=30 10
( 0
X1
10 20 60
3 30 40 50
Contd
The feasible solution area is an area on the graph that
is bounded by the constraint equations.
X2
60
50
40
Common area to both constraints
30
20
10
X1
0 10 20 30 40 50 60
The Optimal Solution Point
50
40
4X1+3X2=120
A
30
20
10
B 1X1+2X2=40
C X1
0 10 20 30 40 50 60
Calculate the value of each corner (O, A, B and C) to get
the optimal solution
Max Z= $40X1+$50X2
At point 0, Profit is 0 (substitute both X1 and X2 by 0 in the OF)
At point A, profit is 1000 (substitute X1 by 0 and X2 by 20)
At point B, profit is 1360 (substitute X1 by 24 and X2 by 8)
At point C, profit is 1200 (substitute X1 by 30 and X2 by 0)
Thus the optimal solution is point be (the firm should produce
24 bowls and 8 mugs so as to meet its objective).
Contd
Let’s assign letters to each corner
50
40
10
B 1X1+2X2=40
the best feasible solution.
C X1
0 10 20 30 40 50 60
LP: Cost Minimization
x1 =1, x2=2
We draw the line with these coordinates and get line I drawn in the graph
passing through origin.
Now, convert constraint (ii) in equality
x1 + 4x2 = 80
When x1 =0, x2=20
X2 =0, x1=80
We draw the line II (80, 20) as shown
in graph.
Now, convert constraint (iii) in equality
0.9x1 + 0.8x2 =40
When x1 =0, x2=50
X2 =0, x1=44.4
We draw line III (44.4, 50) as shown in
graph.
contd
contd
Animals need:
X 2 1 1 2
Y 1 1 3 4
Total 14 12 18
needs
Change inequalities in to equalities
X1 X 2 X1 X2
0 14 X 1 X2
0 12
7 0 12 0 0 6
18 0
12
10
2X1+X2= 14
B
8
4 C
2X1+X2= 14
2
D
0 X1
2 4 6 8 7 10 12 14 16
18
Optimum solution
Special Cases in Graphical solution
1. Redundant Constraint
• If a constraint when plotted on a graph doesn’t
form part of the boundary making the feasible
region of the problem that constraint is said to be
redundant.
• Example:
Cont..
2. Multiple optimal Solutions
• /Alternative optimal solutions/
• -This is a situation where by a LPP has more than one optimal
solution.
• Multiple optimal Solutions will be found if two corers give optimal
solution, then the line segment joining these points will be the
solution.
Contd….
• ==>We have unlimited number of optimal solution with out increasing or decreasing
the objective function.
•
• Example:
• The information given below is for the products A and B.
• _____________________________________________________________________
Machine hours per week Maximum available
• Department Product A Product B per week
• _____________________________________________________________________
• Cutting 3 6 900
• Assembly 1 1 200
• Profit per unit $8 $16
• _____________________________________________________________________
• Assume that the company has a marketing constraint on selling products B and
therefore it can sale a maximum of 125units of this product.
Contd…
• Required:
a. Formulate the LPP of this problem
b. Find the optimal solution
Solution:
• Let X1 =The No of units f product A produced
per week
• X2 =The No of units f product B produced per
week
• The LPP Model of the problem is:
Contd…
contd…..
Corners Coordinates MaxZ=8 X1 + 16X2
A (0, 0) 0
B (0, 125) 2000
C (50, 125) 2400
D (100, 100) 2400
E (200, 0) 1600
Interpretation:
Both C and D are optimal solutions. Any point on the line segment CD will also lead to the same optimal solution.
==>Multiple optimal solutions provide more choices for management to reach their objectives.
3. Infeasible Solution
A solution is called feasible if it satisfies all the constraints and the constraints and non-negativity condition.
However, it is sometimes possible that the constraints may be inconsistent so that there is no feasible solution to the
problem. Such a situation is called infeasibility.
Example:
MaxZ=20X1+30X2
St:
2X1+X2< 40
4X1+X2< 60
X1 > 30
X1, X2 > 0
Solution:
contd……
Simplex
method
Simplex method of solving LP
When a large number of variables (more than 2) are involved
in a problem, the solution by graphical method is difficult/ not
possible.
The simplex method provides an efficient technique which
can be applied for solving LPPs of any magnitude, involving
two or more decision variables.
In this method, the objective function is used to control the
development and evaluation of each feasible solution of the
problem.
The simplex Algorithm is an iterative procedure for
finding, in a systematic manner, the optimal solution that
comes from the corner points of the feasible region.
Simplex algorithm considers only those feasible solutions
which are provided by the corner points and that too not all
of them.
It is very efficient algorithm.
The technique also has the merit to indicate whether a
given solution is optimal or not.
Was formulated by G.B. Dantzig in 1947.
Forapplication of simplex method, following conditions must
be satisfied.
• Right Hand Side (RHS) of each constraint should be non-negative.
x3.
Basic Definitions
Before using the simplex method, let us examine and understand certain
basic terms involved in the procedure.
1.Standard Form: This has already been clarified in the initial part of this
chapter. With linear relationships of objective function and constraints,
making RHS of constraints as equal produces standard form, whereas the
inequality situation is called canonical form.
2.Slack and Artificial Variables: These have also been explained under
an appropriate heading. Their physical significance have also been
clarified. These are generally designated as S1, S2 . . . . etc. and A1, A2 etc.
respectively. Whereas the slack variables indicate spare capacity of the
constraints, artificial variables are imaginary variables added for
standard form.
3. Surplus Variable: A variable subtracted from the left hand side of a greater
than or equal to constraint to convert the constraint into equality. Physical
sense or interpretation of the surplus variable is that it is amount of resource
over and above the minimum required level. In case the constraint inequality
is of the type "less than or equal to", then it is called slack variable.
7.Variable Mix: The values of the column that contains all the variables in the
solution.
8. Basis: The set of variables which are not set to zero and
figure in the column of "Product Mix" are said to be in the
'Basis'. Other than these figuring in the product mix column
are termed as non basic variables.
12.Cj - Zj = ∆j or Index Row: The row containing net profit or loss resulting
from introducing one unit of the variable in that column in the solution. A
positive number in the ∆j row would indicate an algebraic reduction or
increment in the objective function if one unit of the variable of that column is
introduced in the basis.
13.Pivot -Column: The column with the largest positive number in Cj - Zj row
in a maximization problem or the smallest number in a minimization problem
is called Pivot column. This indicates the variable entering the solution in the
next iteration by replacing an appropriate variable.
14.Pivot Row: When we work out the ratio of quantities bi's and the elements
of the Pivot column, we get the last column of the simplex table. The
outgoing variable to be replaced by the entering variable (decided by the
key row) would be the one with the smallest positive value of the ratio
column.
15. Pivot Element: The element at the point of intersection of
the key column and the key row is called the Pivot element.
Constraints (linear)
St: a11 x1 + a12 x2 + a1n xn = b1
When the constraints are of the type < bi, then to convert the it into equality we
need adding some variable (not constant) this is normally done by adding
variables such as S1, S2. . . . . Sn, which are called slack variables. In physical
sense, these slack variables represent unused resources, the slack variables
contribute nothing towards the objective function and hence their coefficients in
the objective function are to be zeros.
Thus, to illustrate the above concept,
This is done to achieve unit matrix for the constraints. But artificial variables
can not figure in the solution as there are artificially added variables and have
no significance for the objective function. These variables, therefore, are to be
removed from the solution.
Standardization/Tableau Form/
Characteristics:
All constraints are expressed in the form of equalities
or
equations.
All right hand sides are non-negative
All variables are non-negative
2. Develop an initial simplex tableau
v.The last column at the right is called the quantity column. It refers
to the right hand side values (RHS) of the constraints.
vi.There are two more rows at the bottom of the tableau. The first
raw is a Z-row. For each column the Z – value is obtained by
multiplying each of the number of the column by their respective row
coefficient in column C. The last row is Cj-Z row.
The values in this row are also calculated column by
column. For each Column, the value in row Zj is subtracted
form the Cj value in the top row.
3. Interpreting the initial simplex tableau
6.Make the entering variable basic and the leaving non- basic by
applying elementary row operations of matrix algebra.
7. Iteration for improved solution:
(c)new values for the other rows. In the revised simplex table,
all the other rows are recalculated as follows.
Now there are five variables and three equations and hence to obtain the
solution, any two variables will have to be assigned zero value. Moreover, to get
a feasible solution, all the constraints must be satisfied.
To start with, let us assign x1 = 0; x2 = 0 (Both decision variables are assigned
This can be written as initial simplex table 1
Unit Cj 8 16 0 0 0 Ratio
profi
t BV Q X1 X2 S1 S2 S3 Q/aij
(Zj)
0 S1 200 1 1 1 0 0 200/1=200 LV
0 S2 125 0 1 0 1 0 125/1=125
0 S3 900 3 6 0 0 1 900/6= 150
Zj 0 0 0 0 0 0
Cj-Zj 8 16 0 0 0
EV
Key No.
Where: EV= entering variable (Key
column) LV= leaving variable (key
row)
Entering variable
Since Cj - Zj is maximum at 16, i.e., profit is more for each unit for x2
variable, we introduce x2 into the solution. It is the marked as key column and
x2 becomes the entering variable. Dividing Quantities (bi's) by the
corresponding key elements of each row, we obtain the ratio (Q/aij) column
such as for row S1, it is 200 ÷ 1 = 200, S2= 125 and S3=150.
Leaving variable
The leaving variable is, the row which has least ration (Q/aij), here, S2 has 125
ratio which small compare to other BV, it will be replaced by X2.
Now each of the elements of the Key row is divided by Key element to
get x2 row in the new table. Thus we get the key row as follows:
Unit profit Q X1 x2 S1 S2 S3
16 125/1 0/1 1/1 0/1 1/1 0/1
125 0 1 0 1 0
row value
Q X1 X2 S1 S2 S3
0 S3 150 3 0 0 -6 1
Zj 2000 0 16 0 16 0
Cj-Zj 8 0 0 -16 0
Key row
0 S3 150 3 0 0 -6 1 150/3=50
Zj 200 0 16 0 16 0
0
Cj-Zj 8 0 0 -16 0
Key
column
Now each of the elements of the Key row is divided by Key element to
get x2 row in the new table. Thus we get the key row as follows:
Unit profit Q X1 x2 S1 S2 S3
8 150/3 3/3 0/3 0/3 -6/3 1/3
50 1 0 0 -2 1/3
row value
Q X1 X2 S1 S2 S3
8 X1 50 1 0 0 -2 1/3
Zj 2400 8 16 0 0 8/3
Cj-Zj 0 0 0 0 -8/3
Now, all the values of ∆j being zero or negative, suggesting that the
solution is optimal and Z = 2,400 for x1 = 50 and x2 = 125. S1 indicates
surplus.
Class work
Maximise Z = 30x1 + 40x2
Subject to, 60x1 + 120x2 < 12,000
8x1 + 5x2 < 600
3x1 + 4x2 < 500
x1, x2 > 0
Answer
X = 200/11
1
X =1000/11
2
Profit=
Simplex Algorithm-
Minimization problem
B. Simplex Algorithm- Minimization problem
Some of the important aspects of minimization problem
simplex table I
Zj Cj 60 80 0 0 M M Ratio
BV Q x1 x2 s1 s2 A1 A2
M A1 900 20 30 -1 0 1 0 45
M A2 1200 40 30 0 -1 0 1 30
Zj Cj 60 80 0 0
BV Q x1 x2 s1 s2
80 X2 20 0 1 -1/15 1/30
60 X1 15 1 0 1/20 -1/20
simplex table I
Zj Cj 4 2 0 0 M M Ratio
BV Q x1 x2 s1 s2 A1 A2
M A1 3 3 1 0 0 1 0 1
M A2 6 4 3 -1 0 0 1 6/4
0 S2 3 1 2 0 1 0 0 3
Zj 9M 7M 4M -M 0 M M
Cj-Zj 4-7M 2-4M M 0 0 0
X1= Q X1 X2 S1 S2 A2
3 3 1 0 0 0
3/3 3/3 1/3 0/3 0/3 0/3
new row= 1 1 1/3 0 0 0
New row= old row – corresponding coefficient new tableau
in pivot column X row value
Zj Cj 4 2 0 0 M Ratio
BV Q x1 x2 s1 s2 A2
4 X1 1 1 1/3 0 0 0 3
M A2 2 0 5/3 -1 0 1 6/5
0 S2 2 0 5/3 0 1 0 6/5
Zj 4+2M 4 4/3+5/3M -M 0 M
Cj-Zj 0 2-5M/3 M 0 0
Select near to
the top
X2= X1 X2 S1 S2
Q 0 5/3 -1 0
2 0/ 5/3/5/3 - 0
2/5/3 5/ 1/5/3 /
new
New row= old row –3 corresponding
row= 1 coefficient 5
6/5 0 in pivot column
-3/5 /
3
X
0
row X1, Q= 1-(1/3x6/5) = 9/15 S2, Q= 2-(5/3x6/5)= 0 new tableau
X1= 1-(1/3x0)= 1 X1= 0-(5/3x0)= row value
X2= 1/3-(1/3x1)= 0 X2= 5/3-(5/3x1)= 0
0
S1= 0-(1/3x-3/5)= 1/5 S1= 0-(5/3x-3/5)=1
S2= 0-(1/3x0)= 0 S2= 1-(5/3x0)= 1
Optimal solution simplex table
III
Zj Cj 4 2 0 0
BV Q x1 x2 s1 s2
4 X1 9/15 1 0 1/5 0
2 X2 6/5 0 1 -3/5 0
0 S2 0 0 0 1 0
Zj 72/15 4 2 -2/5 0
Cj-Zj 0 0 0 0
These special types include problems with more than one optimal
solution, infeasible problems, problems with unbounded solutions,
problems with ties for the pivot column or ties for the pivot row, and
Multiple optimal solution
40
Profit @ corner B
30
A and C is equal
20
(1200)
B
10
FR
C
10 20 30
40 50
An infeasible solution
The three constraints do not overlap to form a feasible solution area.
Because no point satisfies all three constraints simultaneously, there is no
solution to the problem.
X1= 4
8
X2=6
6
B C
4
4X1+2X2=8
2
A
C
2 4 6 8 10
An unbounded problem
in
theformulating
model
8
2
Example:
The doctor advises a patient visited him that the patient is weak in
and Bare available in the medical shop at a cost of ETB 3 per unit of
A and ETB 2.50 per unit of B. The patient has to fulfill the need of
Subject to:
x1, x2≥0
Basis Cj 60 50 0 0 0 Quantit
X1 X2 S1 S2 S3 y
S1 0 0 0 1 6 -16/3 24
X1 60 1 0 0 1 -1/3 9
X2 50 0 1 0 -1 2/3 4
Z 60 50 0 10 40/3 740
Cj-Z 0 0 0 10 -40/3
Shadow price
From the above tableau; the shadow prices are $ 0 for S1, $10
there are upper and lower limits, i.e. allowable increase and
Range of Feasibility (Right hand side
range)
Cj 60 50 0 0 0
Zj Bv Q X1 X2 S1 S2 S3
0 S1 24 0 0 1 6 -16/3
60 X1 9 1 0 0 -1 -1/3
50 X2 4 0 1 0 -1 2/3
Zj 740 60 50 0 10 40/3
Cj-Zj 0 0 0 -10 -40/3
Solution
1. Recall the original value of the resources
Original value constraints S1 S2 S3
100 S1 1 6 -16/3
22 S2 0 -1 -1/3
39 S3 0 -1 2/3
2. ratio = Q/respective slack values
S1= 24/1= 24 S2= 24/6= 4 S3= 24/-16/3= -4.5
9/0= undefined 9/-1= -9 9/-1/3= -27
4/0= 4/-1= 4/2/3= 6
undefined
-4
3. Find the range of feasibility
X1 Cj-Zj 0 0 0 -10 -40/3
X1 values in the
tableau
1 0 0 1 -1/3 X2 Cj-Zj 0 0 0 -10 -40/3
∞ ∞ ∞ -10 40 0 1 0 -1 2/3