You are on page 1of 33

Week 05

IS 231
Operation Research
Dr. Yasser ALHABIBI
E-mail: yasser.alhabibi@must.edu.eg
Misr University for Science and Technology
Faculty of Information Technology
Fall-2023
List of References
Course notes
Available (handed to students' part by part).

Essential books (textbooks)


 Introduction to Operation Research, Frederick S. Hillier,
Gerald J. Lieberman, Tenth Edition McGraw-Hill, 2015.
 Operation Research, An Introduction, Hmdy A. Taha,
University of Arkansas, Fayetteville. USA, Pearson, Prentice
Hall, 2007
 Operations Research, A. Somaiah & Vanaja, IARE, USA,
Institute of Aeronautical Engineering Press, 2000

Recommended books
 Other books that are related to Operation Research
Course Outline
 Introduction to Operation Research
 Linear Programming
 Solving LP Linear Programming using Simplex
Method
 The Transportation problem
 The Assignment Problem
 Project Scheduling ( PCM & PERT ).
Operation Research
WKS
01 Introduction to Operation Research
02 Introduction to Linear Programming
03 The Fundamental Theorem of Linear Programming Geometry in Rn
Basic Linear Algebra, Definitions and theorems
04 Solving Linear Programming Problem (Graphical Solution)
05 Solving Linear Programming Problem ( The Simplex Method)
06 QUIZ 01
07 Solving Linear Programming Problem Two phases of the Simplex Method
08 Duality
09 Complementary Slackness Theorem
10 Application of Linear Programming ( Transportation Problem)
Alternative Criteria for Finding Initial BF Solution
11 Application of Linear Programming ( Transportation Problem) Optimal Solution
12 QUIZ 02
13 Application of Linear Programming (Assignment Problem)
Alternative Criteria for Finding Initial BF Solution
14 4 Project Scheduling ( PCM & PERT ). LAB Final Exam
15 FINAL EXAM
Course Objectives

To provide the student (participants) with 

the modern concepts and techniques in


.Operation Research and Decision Making
To train the student on how to use and 

.apply these techniques in practice


Operation Research
Lecture 5

Solving Linear Programming Problem


The Simplex Method
Solving Linear Programming Problems
The Simplex Method
 It is a general algebraic method to solve a set of linear
equations. When decision variable are more than 2, it is always
advisable to use Simplex Method to avoid lengthy graphical
procedure.
 We use simplex method to get extreme (or corner) point
solution. The Simplex Method is not used to examine all the
feasible solutions. It deals only with a small and unique set of
feasible solutions, the set of vertex points (i.e., extreme points) of
the convex feasible space that contains the optimal solution.
 We must first convert the model into the standard LP
form by using slack or surplus variables to convert the
inequality constraints into equations. Our interest in the
standard LP form lies in the basic solutions of the
simultaneous linear equations.
7
Steps involved
1. Locate an extreme point of the feasible region.
2. Examine each boundary edge intersecting at this point
to see whether movement along any edge increases
the value of the objective function.
3. If the value of the objective function increases along
any edge, move along this edge to the adjacent
extreme point. If several edges indicate improvement,
the edge providing the greatest rate of increase is
selected.
4. Repeat steps 2 and 3 until movement along any edge
no longer increases the value of the objective function.

8
The Simplex Method
Algorithm for solving LPPs in Standard Form

Min cT x
s.t. A x = b
and x ≥ 0

Basic steps:
Phase I: Pivot to obtain feasible solution
Phase II: Pivot to optimal solution

The simplex method moves from a basic feasible solution


.to another to reach the optimal value of the L.P.P

9
Standard Form
Since simplex method requires standard form, we must be able to convert any
LPP:
1. Eliminate inequalities:
A i  x  bi Ai  x  bi
A i x  s i  b A i x  s i  b
 
 si  0  si  0
slack surplus
)Murty uses “slack” for both( Slack is the difference
between the left- and
2. convert max to min: right-hand sides of a
max cTx = - min -cTx constraint when the
optimal solution is
3. Eliminate unrestricted variables: i.e., 0, +ve or -ve substituted for the
variables.
 
x i  x i  x i

.xi unr   x  , x   0

 i i
10
Simplex Algorithm
The objective of the simplex algorithm is to find a vector X ≥ 0, which
minimizes the function f(X) and satisfies the equations:
1 . x1 + 0 . x2 + … + 0 . xm + a"1,m+1 . xm+1 + … + a"1,n . xn = b"1
0 . x1 + 1 . x2 + … + 0 . xm + a"2,m+1 . xm+1 + … + a"2,n . xn = b"2
……………………………………………………………………. (1)
0 . x1 + 0 . x2 + … + 1 . xm + a"m,m+1 . xm+1 + … + a"m,n . xn = b"m
0 . x1 + 0 . x2 + … + 0 . xm - f + c"m+1 . xm+1 + … + c"n . xn = -f"0
where a"ij , c"j , b"i and f"0 are constants.
Notice that: (-f) is treated as a basic variable in the form (1) which is called a
canonical form.
The basic solution which can be deduced from equations (1) is:
(the first m-equations are m-equations in m-basic variables xi , i=1,2,…,m)
xi = b"i , i = 1,2,…,m
f = f"0 (2)
xi = 0 , i = m+1, m+2,…,n
For this basic solution to be feasible, xi = b"i , i = 1,2,…,m.
11
Theorem
A basic feasible solution is an optimal solution with a
minimum objective function with value f"0 if all the cost
coefficients c“j, j = m+1, m+2,…,n in equation (1) are
nonnegative.
Proof
From last row of equations (1) , we have
f = f"0 + c"m+1 . xm+1 + … + c"n . xn (3)
xi, i= m+1, m+2, … ,n are (now) non-basic variables with
zero values, and will be nonnegative if it becomes basic.
Hence if all the cost coefficients c"j , j = m+1, m+2,…,n
are nonnegative , f cannot be decreased , and its present
value is the required minimum.#
12
Special cases
1) If all c"i > 0 for i = m+1, m+2, … , k-1, k+1, …, n
and c"k = 0 for some non-basic variable xk.
Then if the constraints allow that variable to be made
positive (from its present value of zero), no change in
f results, and there are multiple optimal (infinite
number of solutions).

2) If in the final solution, one or more basic variables


have value zero.
Then this solution is called degenerate solution.

13
Improving a non-optimal basic
feasible solution
From last row of equations (1) , we have
m n
f = f 0'' + ci'' x i   x jc ''j (4)
i 1 j  m 1

= f 0'' for the solution given by equations (2).


Consider the following cases:
1) If at least one c"j < 0 (negative).
The value of f can be reduced by making the
corresponding xj>0, i.e. xj (which was a non-basic
variable) is to be made basic, and due to the pivotal
operation, one of the basic variables will become non-
basic.
14
Improving a non-optimal basic
feasible solution
2) If there are more than one c"j < 0.
The index S of the non-basic variable xs which is to be
made basic is chosen such that
c"s = minimum c"j < 0, (5)
for trying to get the greatest possible decrease in f.

3) If more than one c"j have the same minimum value.


We select one of them as c"s arbitrarily.

15
Improving a non-optimal basic
feasible solution
4) If all the coefficients a"is ≤ 0, i = 1, 2, …, m.
On making xs a basic variable, we obtain:
x1 = b"1 – a"1s xs , ≥ b“1,
x2 = b"2 – a"2s xs , ≥ b“2,
……………………………... (6)
xm = b"m – a"ms xs , ≥ b“m,

f = f“0 + c“s xs , c“s < 0. (7)


Then xs can be made infinitely large without making any x i
< 0, i=1, 2, … ,n.
In this case, the minimum value of f is - ∞ and the L.P.P.
is said to have an unbounded solution.
16
Improving a non-optimal basic
feasible solution
5) If there is one a"is > 0.
The maximum value that xs can take without making xi
negative is (b"i / a"is).

6) If there are more than on a"is > 0.


The largest value x*s that xs can take is
x*s = b"r / a"rs = minimum (b"i / a"is ), a"is >0. (8)

7) If more than one b"i / a"is have the same minimum


value, b"i > 0.
We select one of them arbitrarily.
17
Improving a non-optimal basic
feasible solution
8) If any b"i for which a"is > 0 is zero in equations (6).
xs cannot be increased by any amount (since the basic variable x i will
be negative).
Such a solution is called a degenerate solution.
In the case of a non-degenerate basic feasible solution, a new basic
feasible solution with a lower value of the objective function is given
by:
xs = x*s ,
xi = b"i – a"is x*s 0 , i = 1, 2, …, m and i ≠ r, (9)
xr = 0,
xj = 0, j = m+1, m+2, …, n and j ≠ s,
f = f"0 + c"s xs* ≤ f"0. (10)
If the solution is not optimal, the whole procedure of moving to
another basic feasible solution is repeated until we reach the optimal
18
Example 1
:Solve the following L.P.P
Max z = 2 x1 + x2 + 3 x3
Subject to
x1 + 3 x2 +2 x3 ≤ 6

x1 - x 2 + 3 x3 ≤ 9
:Solution: First, convert it to the standard form, We add slacks to get
and x 1 , x 2 , x3 ≥ 0
- Min -z = -2 x1 - x2 - 3 x3
S.t.
x1 + 3 x2 +2 x3 + s1 =6

x1 - x 2 + 3 x3 + s2 = 9
Where:
and S1 and S2 arex1 slack
, x2 , svariables.
1 , s2 ≥ 0 .
We solve by the simplex tableau as follows:

19
Departing Variable Min. Ratio
Interning Variable

Pivot element Most negative

B.V X1 X2 X3 S1 S2 -Z R.H.S θ
S1 1 3 2 1 0 0 6 6/2=3
S2 1 -1 3 0 1 0 9 9/3=3
CN - ZN -2 -1 -3 0 0 1 0 B.F.S.=(0,0,0,6,9)

X3 1/2 3/2 1 1/2 0 0 3 3/0.5=6


S2 -1/2 -11/2 0 -3/2 1 0 0 -

CN - ZN -1/2 7/2 0 3/2 0 1 9 B.F.S.=(0,0,3,0,0)

X1 1 3 2 1 0 0 6
S2 0 -4 1 -1 1 0 3
CN - ZN 0 5 1 2 0 1 12 B.F.S.=(6,0,0,0,3)

:Optimal Solution
z  12 at x 1  6, x 2  0, x 3  0.
20
Example 2
:Solve the following L.P.P
Min z = x1 - 3 x2 + 3 x3
Subject to
3x1 - x2 +2 x3 ≤ 7

2x1 + 4 x2 ≥ -12
-4x1 + 3 x2 +8x3 ≤ 10
:Solution
and positive:
- Make all the bi ’s (R.H.S) x 1 , x 2 , x3 ≥ 0
2x1 + 4 x2 ≥ -12
Multiplying the second constraint throughout by (-1).
- 2x1 - 4 x2 ≤ 12

21
Example 2 : Solution
:Solution: First, convert it to the standard form, We add slacks to get
Min z = x1 - 3 x2 + 3 x3
Subject to
3x1 - x2 + 2 x3 + S1 = 7

-2x1 - 4 x2 + S2 = 12
-4x1 + 3 x2 +8x3 + S3 = 10
Where: S1 , S2 , S3 are slack variables. We solve by the simplex tableau
as follows: and x1 , x2 , x3 , S1 , S2 , S3 ≥0
- So we can use S1 , S2 ,and S3 as the initial basis (Basic Feasible
Solution).
m=3, n=6, m-n=6-3=3.
- The initial basis: BFS
x1 x2 x3 s1 s2 s3 
 , z  0
 0 0 0 7 12 10 
22
B. V. x1 x2 x3 S1 S2 S3 -Z R.H.S θ (Ratio)

-
S1 3 -1 2 1 0 0 0 7

S2 -2 -4 0 0 1 0 0 12 -

S3 -4 (3) 8 0 0 1 0 10 10/3

B.F.S.=(0,0,0,7,12,10)
CN - ZN 1 -3 3 0 0 0 1 0

S1 (5/3) 0 14/3 1 0 1/3 0 31/3 31/5

S2 -22/3 0 22/3 0 1 4/3 0 76/3 -

x2 -4/3 1 8/3 0 0 1/3 0 10/3 -

CN - ZN -3 0 11 0 0 1 1 -10 B.F.S.=(0,10/3,0,31/3,76/3,0)

x1 1 0 14/5 3/5 0 1/5 0 31/5

S2 0 0 156/5 22/5 1 14/5 0 354/5

x2 0 1 32/5 4/5 0 3/5 0 58/5

CN - ZN 0 0 97/5 9/5 0 8/5 1 -143/5 B.F.S.=(31/5,58/5,0,0,354/5,0)

- Since: CN - ZN is non-negative under all variable columns. Then, we have


optimal solution.
- Optimal Solution is: x1 = 31/5, x2 = 58/5 , x3 =0, Zmin =-143/5.
23
Unbounded solution : Example 3
:Solve the following L.P.P
Min z = -3 x1 -2 x2
Subject to x1 - x2 ≤ 1

3x1 - 2x2 ≤ 6

:Solution: First, convert it to the standard form, We add slacks to get


and x 1 , x2 ≥ 0
Min z = -3 x1 -2 x2
S.t. x 1 - x 2 + s1 =1
3x1 - 2x2 + s2 =6
and x 1 , x 2 , s1 , s2 ≥ 0 .

where S1 and S2 are slack variables. We solve by the simplex tableau


as follows:

24
Example 3
Solution (Unbounded solution )
θ
B. V. x1 x2 S1 S2 -Z R.H.S
1
S1 (1) -1 1 0 0 1
2
s2 3 -2 0 1 0 6

CN - ZN -3 -2 0 0 1 0
-
x1 1 -1 1 0 0 1
3
s2 0 (1) -3 1 0 3

CN - ZN 0 -5 3 0 1 3
-
x1 1 0 -2 1 0 4
-
x2 0 1 -3 1 0 3

CN - ZN 0 0 -12 5 1 18

Since c"3 = -12 is the most negative cost coefficient, all a"i3 ≤ 0, we have
an unbounded solution.
25
Example 4
Infinite number of solutions
:Solve the following L.P.P
Min Z = -40 x1 -100 x2
Subject to 10 x1 + 5 x2 ≤ 2500

4x1 + 10 x2 ≤ 2000
2x1 + 3 x2 ≤ 900
:Solution: First, convert it to the standard form, We add slacks to get
and x
Min Z = -40 x1 -100 x 1 , x2 ≥ 0 .
2
s.t. 10 x1 + 5 x2 + S1 = 2500,
4x1 + 10 x2 + S2 = 2000
2x1 + 3 x2 + S3 = 900
and x1 , x2 , s1 , s2 , s3 ≥ 0 .

where S1 , S2 and S3 are slack variables. We solve by the simplex tableau


as follows: 26
Example 4
Infinite number of solutions
θ
B. V. x1 x2 S1 S2 S3 -Z R.H.S.

S1 500
10 5 1 0 0 0 2500

S2 200
4 (10) 0 1 0 0 2000

S3 300
2 3 0 0 1 0 900

CN - ZN -40 -100 0 0 0 1 0

S1 8 0 1 -1/2 0 0 1500

x2 4/10 1 0 1/10 0 0 200

S3 8/10 0 0 -3/10 1 0 300

CN - ZN 0 0 0 10 0 1 20000

Since all c"i ≥ 0 , the present solution is optimum and is given by:
x2 = 200, S1 = 1500, S3 = 300, … basic variables, x1 = S2 = 0 , … non-
basic variables, Zmin = -20000.
Since the cost coefficient corresponding to the non-basic variable x 1 is
c" =0, we have an infinite number of solutions. 27
Example 5
Solve the following L.P.P
Min Z  4 x 1  x 2  30 x 3  11x 4  3x 5  3x 6
s .t  2x 1   6x3  2x 4  3x 6  x 7  20
 4x 1  x 2  7 x 3  x 4 x6  10
 5 x 3  3x 4  x 5  x 6  60
and x i  0, i  1, 2,..., 7
:Solution
- We see that x2 , x5 and x7 are Basic Variable.
x 2  10  4x 1 7x3 x 4 x6
x 5  60  5 x 3  3x 4 x6
x 7  20  2x 1 6x 3  2x 4  3x 6
- We know that the objective function given in terms of non-basic variables.
So we eliminate B.V. from O.F. So, Sub by x2 , x5 and x7 in O.F.
Z  4 x 1  10  4x 1  7 x 3  x 4  x 6   30 x 3  11x 4 
3  60  5 x 3  3x 4  x 6   3x 6  13x 3  6x 4  2x 6  110
28
B. V. x1 x2 x3 x4 x5 x6 x7 -Z R.H.S θ (Ratio)

x7 -2 0 6 2 0 -3 1 0 20 10
x2 -4 1 7 (1) 0 -1 0 0 10 10
x5 0 0 -5 3 1 -1 0 0 60 20
CN - ZN 0 0 13 -6 0 2 0 1 110 B.F.S.=(0,10,0,0,60,0,20)
x7 (6) -2 -8 0 0 -1 1 0 0 0
x4 -4 1 7 1 0 -1 0 0 10 -

x5 12 -3 -26 0 1 2 0 0 30 30/12
CN - ZN -24 6 55 0 1 -4 0 1 170 B.F.S.=(0,0,0,10,0,0,30)
x1 1 -1/3 -4/3 0 0 -1/6 1/6 0 0 -
x4 0 -1/3 5/3 1 0 -5/3 4/6 0 10 -
x5 0 1 -10 0 1 (4) -2 0 30 30/4
CN - ZN 0 -2 23 0 0 -8 4 1 170 B.F.S.=(0,0,0,10,0,0,30)

x1 1 -7/24 -7/4 0 1/24 0 1/12 0 5/4


x4 0 1/12 -5/2 1 5/12 0 -1/6 0 45/2
x6 0 1/4 -5/2 0 1/4 1 -1/2 0 15/2
CN - ZN 0 0 3 0 2 0 0 1 230 B.F.S.=(5/4,0,0,45/2,0,15/2,0)

- Since: CN - ZN is non-negative under all variable columns. Then, we have


optimal solution.
- Optimal Solution is: x1 = 5/4, x4 = 45/2 , x6 =15/2, Zmin =-230.
29
Unbounded solution : Example 6

Solve the following L.P.P:


Min Z  5 x 1  14x 2  7 x 3  9x 4
s .t x 1  2x 2  x 3  x 4  5
 x1 3x 2  5x 4  10
2x 1  2 x 2  4x 4  10
and x i  0, i  1, 2,3, 4
:Solution
- We see that x3 is a Basic Variable.
x 3  5 x1  2x 2  x 4

- We know that the objective function given in terms of non-basic variables.


So we eliminate B.V. from O.F. So, Sub by x3 in O.F.

Min Z  5 x 1  14x 2  7 5  x 1  2 x 2  x 4   9x 4
  12x 1  2x 4  35

30
Unbounded solution : Example 6

:First, convert it to the standard form, We add slacks to get

Min Z  5 x 1  14x 2  7 x 3  9x 4
s .t x 1  2x 2  x 3  x 4 5
 x1 3x 2  5x 4  s1  10
2x 1  2 x 2  4x 4  s 2  10
and x 1 , x 2 , x 3 , x 4 , s 1 , s 2 , 0

where S1 and S2 are slack variables. We solve by the simplex


tableau as follows:

31
θ (Ratio)
B. V. x1 x2 x3 x4 s1 s2 -Z R.H.S
x3 (1) -2 1 1 0 0 0 5 5
s1 -1 -3 0 5 1 0 0 10 -
s2 2 2 0 -4 0 1 0 10 5
CN - ZN -12 0 0 2 0 0 1 -35 B.F.S.=(0,0,5,0,10,10)
x1 1 -2 1 1 0 0 0 5 -
s1 0 -5 1 6 1 0 0 15 -

s2 0 (6) -2 -6 0 1 0 0 0
CN - ZN 0 -24 12 14 0 0 1 25 B.F.S.=(5,0,0,0,0,15,0)
x1 1 0 1/3 -1 0 1/3 0 5 -
s1 0 0 -2/3 (1) 1 5/6 0 15 15
x2 0 1 -1/3 -1 0 1/6 0 0 -
CN - ZN 0 0 4 -10 0 4 1 25 B.F.S.=(5,0,0,0,15,0)

x1 1 0 -1/3 0 1 7/6 0 20 -

x4 0 0 -2/3 1 1 5/6 0 15 -

x2 0 1 -1 0 1 1 0 15 -

CN - ZN 0 0 -8/3 0 10 74/6 1 175

Since c"3 = -8/3 is the most negative cost coefficient, all a" i3 ≤ 0, we
have an unbounded solution.

32
33

You might also like