0% found this document useful (0 votes)
15 views31 pages

Simplex + M-Method Sheet 3 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views31 pages

Simplex + M-Method Sheet 3 Solution

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Operation and Research

Simplex Method
It is an algebraic procedure (a sequence of steps) to solve LPP. Requires that the problem
is expressed as a standard LPP. This implies that all the constraints are expressed as
equation by adding a variable called slack variable.

‫ بإضافة ر‬equality ‫ ال‬Inequality ‫ من‬Constraint ‫نعتمد يف هذه الطريقة عىل تحويل كل ال‬
‫متغي جديد وهو ال‬
s
Slack variable

Note
In equality ≥ or ≤
Equality =
‫ـــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬
Slack variable
• Slack variable is used mainly to convert inequality to equality.

Example
X ≤ 70
• To convert the inequality to equality

X + 𝒔𝟏 = 70
• If 𝒔𝟏 = 𝟒𝟎 that means 𝑿 = 𝟑𝟎.
• It means that all available resources were 70 but only 30 of them is used that is
represented by 𝑿 = 𝟑𝟎 on the other hand the unused resources were 40 that is
represented by 𝒔𝟏 = 𝟒𝟎.

Basic variable
• Represent the unused resources between the left-hand side and the right-hand side of
each in equality.
• In simplex
✓ Both the basic and slack variables are the same.

• Features of basic variables are the same for both simplex and M-Method.

DIAA EL-DINE ALI FARGHAL 1


• Features of basic variables
✓ It appears in a single equation only and must not be repeated.
✓ Coefficient of basic variable must be equal positive one.
✓ It must not be included in Z equation by means its coefficient in Z equation must be
equal zero.
✓ Right hand-side of all constraints must be positive number or zero.
‫ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ‬
Problem (3.1)
• We will discuss how to solve the simplex problems.

𝐦𝐚𝐱 𝒁 = 𝟒𝟎𝟎𝒙𝟏 + 𝟐𝟎𝟎𝒙𝟐


𝟏𝟖𝒙𝟏 + 𝟑𝒙𝟐 ≤ 𝟖𝟎𝟎
𝟗𝒙𝟏 + 𝟒𝒙𝟐 ≤ 𝟔𝟎𝟎
𝒙𝟐 ≤ 𝟐
𝒙𝟏,𝟐 ≥ 𝟎. 𝟎

Solution
Steps
1. Convert the objective function to equation.

𝒁 − 𝟒𝟎𝟎𝒙𝟏 − 𝟐𝟎𝟎𝒙𝟐 = 𝟎. 𝟎
2. Convert all the inequalities in each constraint to equality by using slack variable.
• Example
✓ If X ≤ 70
➢ X +𝒔𝟏 =70, it will be solved by simplex method.
✓ If X ≥70
➢ X −𝒔𝟏 =70, it will be solved by M-method.

𝟏𝟖 + 𝟑𝒙𝟐 + 𝒔𝟏 = 𝟖𝟎𝟎
𝟗𝒙𝟏 + 𝟒𝒙𝟐 + 𝒔𝟐 = 𝟔𝟎𝟎
𝒙𝟐 + 𝒔𝟑 = 𝟏𝟓𝟎

DIAA EL-DINE ALI FARGHAL 2


3. Construct the first table.

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z −400 −200 0 0 0 0
𝒔𝟏 18 3 1 0 0 800
𝒔𝟐 9 4 0 1 0 600
𝒔𝟑 0 1 0 0 1 150

• Note
✓ Write all variables either basic (𝑺𝟏,𝟐,….. ) or non-basic (𝑿𝟏,𝟐,…..) in the first row.
✓ Write the solution (right hand side of each equation) in the first column in the right-
hand side.
✓ Write the Z label and basic variables (𝑺𝟏,𝟐,….. ) in the first column in the left-hand
side.
✓ Write the coefficients of the variable involved in each constraint in the row of its
basic variable.
➢ Example
✓ The first constraint
𝟏𝟖 + 𝟑𝒙𝟐 + 𝒔𝟏 = 𝟖𝟎𝟎
✓ in the table
𝒔𝟏 18 3 1 0 0 800

4. determine the entering column


• the entering column is the one which has the most negative value in the Z row if
the objective function is Max Z.

• the entering column is the one which has the most positive value in the Z row if
the objective function is Min Z.

5. Inset a new column to the right of the table which is called Ratio column.

𝒔𝒐𝒍𝒖𝒕𝒊𝒐𝒏
• 𝒓𝒂𝒕𝒊𝒐 = 𝒄𝒐𝒓𝒓𝒐𝒔𝒑𝒐𝒏𝒅𝒊𝒏𝒈 𝒗𝒂𝒍𝒖𝒆 𝒊𝒏 𝒕𝒉𝒆 𝒆𝒏𝒕𝒆𝒓𝒊𝒏𝒈 𝒄𝒐𝒍𝒖𝒎𝒏

DIAA EL-DINE ALI FARGHAL 3


• The corresponding value in the entering column must not be equal to zero or a
negative value.

6. Determine the leaving row.


• The row that has the smallest value in the ratio column.

Entering
Column

𝑥1 𝑥2 𝑠1 𝑠2 𝑠3 solution Ratio
Z −400 −200 0 0 0 0
800
𝑠1 18 3 1 0 0 800 = 44.44
18
600
𝑠2 9 4 0 1 0 600 = 66.66
9
Do not divide on
𝑠3 0 1 0 0 1 150 zero or negative
number

Pivot leaving
element Row

7. Determine the pivot element which is the intersection between the entering column
and leaving row.

8. Replace the entering column variable by the leaving row variable.

𝑿𝟏 𝒊𝒔 𝒕𝒉𝒆 𝒆𝒏𝒕𝒆𝒓𝒊𝒏𝒈 𝒆𝒍𝒆𝒎𝒆𝒏𝒕


𝑺𝟏 𝒊𝒔 𝒕𝒉𝒆 𝒍𝒆𝒂𝒗𝒊𝒏𝒈 𝒆𝒍𝒆𝒎𝒆𝒏𝒕

• Replace 𝑺𝟏 by 𝑿𝟏 .

DIAA EL-DINE ALI FARGHAL 4


9. Divide the whole leaving row on the pivot element and remove the ratio column.

𝑥1 𝑥2 𝑠1 𝑠2 𝑠3 solution
Z
𝒙𝟏 1 1/6 1/18 0 0 400/9
𝑠2
𝑠3

New
Row

10. 𝒙𝟏 becomes a new basic variable so it should follow the features of basic variables
by means its value should be zero in all equations except its new row.

• 𝑵𝒆𝒘 𝒁 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒁 + 𝟒𝟎𝟎 𝑵𝒆𝒘 𝒙𝟏 𝒓𝒐𝒘


New Z row
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old Z −400 −200 0 0 0 0
+400 𝒙𝟏 400 200/3 200/9 0 0 160,000/9
New Z 0 −400/3 200/9 0 0 160,000/9

• 𝑵𝒆𝒘 𝒔𝟐 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒔𝟐 − 𝟗 𝑵𝒆𝒘 𝒙𝟏 𝒓𝒐𝒘


New 𝒔𝟐 row
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old 𝒔𝟐 9 4 0 1 0 600
−9𝒙𝟏 −9 −1.5 −0.5 0 0 −400
New 𝒔𝟐 0 2.5 −0.5 1 0 200

• For 𝒔𝟑 row 𝒙𝟏 = 𝟎. 𝟎 so there is no need for a new row.


• All the previous steps will result in the following table.

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z 0 −400/3 200/9 0 0 160,000/9
𝒙𝟏 1 1/6 1/18 0 0 400/9
𝒔𝟐 0 2.5 −0.5 1 0 200
𝒔𝟑 0 1 0 0 1 150

DIAA EL-DINE ALI FARGHAL 5


11. Repeat the previous steps till all the Z row values become positive or zeros if the
objective function is Max Z but if it is Min Z, repeat the previous steps till Z row values
become negative or zero.
Entering
Column

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution Ratio
Z 0 −400/3 200/9 0 0 160,000/9
0 𝟖𝟎𝟎
𝒙𝟏 1 1/6 1/18 0 400/9 = 𝟐𝟔𝟔. 𝟔𝟕
𝟑
𝟐𝟎𝟎
𝒔𝟐 0 2.5 −0.5 1 0 200 = 𝟖𝟎
𝟐. 𝟓
𝒔𝟑 0 1 0 0 1 150 150

Pivot leaving
Element Row

12. Start the next iteration

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z
𝒙𝟏
𝒙𝟐 0 1 −0.2 0.4 0 80
𝒔𝟑
𝟒𝟎𝟎
• 𝑵𝒆𝒘 𝒁 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒁 + ( ) 𝑵𝒆𝒘 𝒙𝟐 𝒓𝒐𝒘
𝟑
New Z row
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old Z 0 −400/3 200/9 0 0 160,000/9
𝟒𝟎𝟎
+( ) 𝒙𝟐 0 400/3 −80/3 160/3 0 32,000/3
𝟑
New Z 0 0 −40/3 160/3 0 256,000/9

DIAA EL-DINE ALI FARGHAL 6


𝟏
• 𝑵𝒆𝒘 𝒙𝟏 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒙𝟏 + (− ) 𝑵𝒆𝒘 𝒙𝟐 𝒓𝒐𝒘
𝟔
𝑵𝒆𝒘 𝒙𝟏 𝒓𝒐𝒘
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old 𝒙𝟏 1 1/6 1/18 0 0 400/9
−𝟏
+( ) 𝒙𝟐 0 −1/6 1/30 −1/15 0 −40/3
𝟔
New 𝒙𝟏 1 0 4/45 −1/15 0 280/9

• 𝑵𝒆𝒘 𝒔𝟑 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒔𝟑 + (−𝟏)𝑵𝒆𝒘 𝒙𝟐 𝒓𝒐𝒘


𝑵𝒆𝒘 𝒔𝟑 𝒓𝒐𝒘
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old 𝒔𝟑 0 1 0 0 1 150
+(−1)𝒙𝟐 0 −1 0.2 −0.4 0 −80
New 𝒔𝟑 0 0 0.2 −0.4 1 70

• All the previous steps will result in the following table.

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z 0 0 −40/3 160/3 0 256,000/9
𝒙𝟏 1 0 4/45 −1/15 0 280/9
𝒙𝟐 0 1 −0.2 0.4 0 80
𝒔𝟑 0 0 0.2 −0.4 1 70

13. Start the next iteration

Entering
Column

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution Ratio
Z 0 0 −40/3 160/3 0 256,000/9
𝒙𝟏 1 0 4/45 −1/15 0 280/9 𝟑𝟓𝟎
Do not divide on negative
𝒙𝟐 0 1 −0.2 0.4 0 80 number or zero
𝒔𝟑 0 0 0.2 −0.4 1 70 350
Pivot leaving
Element Row

DIAA EL-DINE ALI FARGHAL 7


• VIP note

• If there is an opportunity to replace basic variable 𝒔𝟏 by non-basic 𝒙𝟏 or another


basic 𝒔𝟐
✓ Replace basic variable 𝒔𝟏 by the non-basic 𝒙𝟏
• If there is an opportunity to replace basic variable 𝒔𝟏 by two non-basic 𝒙𝟏 or 𝒙𝟐
✓ Use the trial and error by replacing 𝒔𝟏 by 𝒙𝟏 then calculate the objective
function. Then return back and replace 𝒔𝟏 by 𝒙𝟐 and then calculate the
objective function again, the one that will get the efficient value for the
objective function will be the solution.

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z
𝒔𝟏 45/4 0 1 −3/4 0 350
𝒙𝟐
𝒔𝟑

𝟒𝟎
• 𝑵𝒆𝒘 𝒁 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒁 + ( ) 𝑵𝒆𝒘 𝑺𝟏 𝒓𝒐𝒘
𝟗
New Z row
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old Z 0 0 −40/9 100/3 0 256,000/9
𝟒𝟎
+( ) 𝑺𝟏 50 0 40/9 −10/3 0 140,000/9
𝟗
New Z 50 0 0 30 0 30,000

• 𝑵𝒆𝒘 𝒙𝟐 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒙𝟐 + (𝟎. 𝟐) 𝑵𝒆𝒘 𝒔𝟏 𝒓𝒐𝒘


𝑵𝒆𝒘 𝒙𝟏 𝒓𝒐𝒘
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old 𝒙𝟐 0 1 −0.2 0.4 0 80
+(𝟎. 𝟐) 𝑺𝟏 9/4 0 0.2 −0.15 0 70
New 𝒙𝟐 9/4 1 0 0.25 0 150

DIAA EL-DINE ALI FARGHAL 8


• 𝑵𝒆𝒘 𝒔𝟑 𝒓𝒐𝒘 = 𝑶𝒍𝒅 𝒔𝟑 + (−𝟎. 𝟐)𝑵𝒆𝒘 𝒙𝟐 𝒓𝒐𝒘
𝑵𝒆𝒘 𝒔𝟑 𝒓𝒐𝒘
𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Old 𝒔𝟑 0 0 0.2 −0.4 1 70
+(−0.2)𝑺𝟏 −9/4 0 −0.2 0.15 0 −70
New 𝒔𝟑 −9/4 0 0 −0.25 1 0

14. The final table is determined as all values in the Z row is positive or zero while the
objective function is Max Z.

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 solution
Z 50 0 0 30 0 30,000
𝒔𝟏 45/4 0 1 −3/4 0 350
𝒙𝟐 9/4 1 0 0.25 0 150
𝒔𝟑 −9/4 0 0 −0.25 1 0

Solution
column
Results
Max Z = 30,000
𝒙𝟐 = 𝟏𝟓𝟎 & 𝒙𝟏 = 𝟎. 𝟎

DIAA EL-DINE ALI FARGHAL 9


Problem (3.2)
𝐦𝐚𝐱 𝒁 = 𝟑𝒙𝟏 + 𝟐𝒙𝟐
𝒙𝟏 + 𝟐𝒙𝟐 ≤ 𝟔
𝟐𝒙𝟏 + 𝒙𝟐 ≤ 𝟖
−𝒙𝟏 + 𝒙𝟐 ≤ 𝟏
𝒙𝟐 ≤ 𝟐
𝒙𝟏,𝟐 ≥ 𝟎. 𝟎

solution
𝒁 − 𝟑𝒙𝟏 − 𝟐𝒙𝟐 = 𝟎. 𝟎
𝟐𝒙𝟏 + 𝒙𝟐 + 𝒔𝟏 = 𝟔
𝒙𝟏 + 𝒙𝟐 + 𝒔𝟐 = 𝟖
−𝒙𝟏 + 𝒙𝟐 + 𝒔𝟑 = 𝟏
𝒙𝟐 + 𝒔𝟒 = 𝟐 Entering
Column

𝑥1 𝑥2 𝑠1 𝑠2 𝑠3 𝑠4 solution Ratio
Z −3 −2 0 0 0 0 0
𝑠1 1 2 1 0 0 0 6 6
𝑠2 2 1 0 1 0 0 8 4
𝑠3 −1 1 0 0 1 0 1
𝑠4 0 1 0 0 0 1 2

leaving
Row

DIAA EL-DINE ALI FARGHAL 10


Entering
Column

𝑥1 𝑥2 𝑠1 𝑠2 𝑠3 𝑠4 solution Ratio
Z 0 −0.5 0 1.5 0 0 12
𝑠1 0 1.5 1 −0.5 0 0 2 4/3
𝑥1 1 0.5 0 0.5 0 0 4 8
𝑠3 0 1.5 0 0.5 1 0 5 10/3
𝑠4 0 1 0 0 0 1 2 2

leaving
Row

𝑥1 𝑥2 𝑠1 𝑠2 𝑠3 𝑠4 solution
Z 0 0 1/3 4/3 0 0 38/3
𝑥2 0 1 2/3 −1/3 0 0 4/3
𝑥1 1 0 −1/3 2/3 0 0 10/3
𝑠3 0 0 −1 1 1 0 3
𝑠4 0 0 −2/3 1/3 0 1 2/3

Results
𝟑𝟖
𝒁=
𝟑
𝟏𝟎
𝒙𝟏 =
𝟑
𝟒
𝒙𝟐 =
𝟑

DIAA EL-DINE ALI FARGHAL 11


Problem (3.3)
𝐦𝐚𝐱 𝒁 = 𝟐𝒙𝟏 + 𝒙𝟐 + 𝟑𝒙𝟑
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 ≤ 𝟐𝟓
𝟑𝒙𝟏 − 𝒙𝟐 + 𝒙𝟑 ≤ 𝟗
𝟐𝒙𝟏 + 𝟑𝒙𝟐 − 𝒙𝟑 ≤ 𝟕
𝒙𝟏,𝟐,𝟑 ≥ 𝟎. 𝟎

solution
𝒁 − 𝟐𝒙𝟏 − 𝒙𝟐 − 𝟑𝒙𝟑 = 𝟎. 𝟎
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 + 𝒔𝟏 = 𝟐𝟓
𝟑𝒙𝟏 − 𝒙𝟐 + 𝒙𝟑 + 𝒔𝟐 = 𝟗
𝟐𝒙𝟏 + 𝟑𝒙𝟐 − 𝒙𝟑 + 𝒔𝟑 = 𝟕
Entering
Column

𝑥1 𝑥2 𝑥3 𝑠1 𝑠2 𝑠3 solution Ratio
Z −2 −1 −3 0 0 0 0
𝑠1 1 5 3 1 0 0 25 25/3
𝑠2 3 −1 1 0 1 0 9 9
𝑠3 2 3 −1 0 0 1 7

leaving
Row

DIAA EL-DINE ALI FARGHAL 12


Entering
Column

𝑥1 𝑥2 𝑥3 𝑠1 𝑠2 𝑠3 solution Ratio
Z −1 4 0 1 0 0 25
𝑥3 1/3 5/3 1 1/3 0 0 25/3 25
𝑠2 8/3 −8/3 0 −1/3 1 0 2/3 1/4
𝑠3 7/3 14/3 0 1/3 0 1 46/3 46/7

leaving
Row

𝑥1 𝑥2 𝑥3 𝑠1 𝑠2 𝑠3 solution
Z 0 3 0 7/8 3/8 0 101/4
𝑥3 0 2 1 3/8 −1/8 0 33/4
𝑥1 1 −1 0 −1/8 3/8 0 ¼
𝑠3 0 7 0 5/8 −7/8 1 59/4

Results
𝟏𝟎𝟏
𝒁=
𝟒
𝟏
𝒙𝟏 =
𝟒
𝒙𝟐 = 𝟎. 𝟎
𝟑𝟑
𝒙𝟑 =
𝟒

DIAA EL-DINE ALI FARGHAL 13


Problem (3.4)
Solve the following linear programming problem using simplex method
Assume that 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 are basic variables.
𝐦𝐚𝐱 𝒁 = 𝟕𝒙𝟏 + 𝟐𝒙𝟐 + 𝒙𝟑 − 𝒙𝟒 + 𝟐𝒙𝟓
𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟐
𝟐𝒙𝟏 − 𝒙𝟐 − 𝒙𝟒 = 𝟎
𝒙𝟏 + 𝟐𝒙𝟐 + 𝟐𝒙𝟓 = 𝟒
𝒙𝟏,𝟐,𝟑,𝟒,𝟓 ≥ 𝟎. 𝟎

Assume that 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 are basic variables.


• Notes
✓ As mentioned, before that the role of slack variable in simplex problems to
convert the inequality to equality and act as basic variable.
✓ It is said that 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 are basic variables that means the inequality of all
constraints is converted to equality which is clear in the problem.
• How to start the solution?
✓ We have to make 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 basic variables
1. 𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟐
▪ No problem as 𝒙𝟑 coefficient is positive one.
2. 𝟐𝒙𝟏 − 𝒙𝟐 − 𝒙𝟒 = 𝟎
▪ There is a problem as 𝒙𝟒 is negative one that can be adjusted
by multiplication of the whole constraint in −𝟏 which result
in.
−𝟐𝒙𝟏 + 𝒙𝟐 + 𝒙𝟒 = 𝟎

DIAA EL-DINE ALI FARGHAL 14


3. 𝒙𝟏 + 𝟐𝒙𝟐 + 𝟐𝒙𝟓 = 𝟒
▪ There is a problem as 𝒙𝟓 coefficient is positive 2 that can be
adjusted by division of the constraint sides on 2 which
result in.
𝟎. 𝟓𝒙𝟏 + 𝒙𝟐 + 𝒙𝟓 = 𝟐

4. there is also another problem that 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 are involved in the Z


equation.
▪ We have to eliminate all the basic variables from the Z
equation by finding a value for each one from the
constraints.

𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟐 𝒙𝟑 = 𝟐 − 𝒙𝟏 − 𝒙𝟐
−𝟐𝒙𝟏 + 𝒙𝟐 + 𝒙𝟒 = 𝟎 𝒙𝟒 = 𝟐𝒙𝟏 − 𝒙𝟐
𝟎. 𝟓𝒙𝟏 + 𝒙𝟐 + 𝒙𝟓 = 𝟐 𝒙𝟓 = 𝟐 − 𝟎. 𝟓𝒙𝟏 − 𝒙𝟐

▪ Substitute by this system in Z equation.


𝐦𝐚𝐱 𝒁 = 𝟕𝒙𝟏 + 𝟐𝒙𝟐 + 𝒙𝟑 − 𝒙𝟒 + 𝟐𝒙𝟓
𝐦𝐚𝐱 𝒁 = 𝟕𝒙𝟏 + 𝟐𝒙𝟐 + 𝟐 − 𝒙𝟏 − 𝒙𝟐 − (𝟐𝒙𝟏 − 𝒙𝟐 ) + 𝟐(𝟐 − 𝟎. 𝟓𝒙𝟏 − 𝒙𝟐 )
∴ 𝐦𝐚𝐱 𝒁 = 𝟑𝒙𝟏 + 𝟔

First Solution
𝒁−𝟑𝒙𝟏 = 𝟔
𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟐
−𝟐𝒙𝟏 + 𝒙𝟐 + 𝒙𝟒 = 𝟎
𝟎. 𝟓𝒙𝟏 + 𝒙𝟐 + 𝒙𝟓 = 𝟐

DIAA EL-DINE ALI FARGHAL 15


entering
column

𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution Ratio
Z −3 0 0 0 0 6
𝑥3 1 1 1 0 0 2 2
𝑥4 −2 1 0 1 0 0
𝑥5 0.5 1 0 0 1 2 4

leaving
Row

new 𝑥1 1 1 1 0 0 2

Old Z −3 0 0 0 0 6
+3𝑥1 3 3 3 0 0 6
New Z 0 3 3 0 0 12

Old 𝑥4 −2 1 0 1 0 0
+2𝑥1 2 2 2 0 0 4
New 𝑥4 0 3 2 1 0 4

Old 𝑥5 0.5 1 0 0 1 2
−0.5𝑥1 −0.5 −0.5 −0.5 0 0 −1
New 𝑥5 0 0.5 −0.5 0 1 1

DIAA EL-DINE ALI FARGHAL 16


𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution
Z 0 3 3 0 0 12
𝑥1 1 1 1 0 0 2
𝑥4 0 3 2 1 0 4
𝑥5 0 0.5 −0.5 0 1 1

Results
𝒁 = 𝟏𝟐
𝒙𝟏 = 𝟐
𝒙𝟒 = 𝟒
𝒙𝟓 = 𝟏

Second Solution
𝒁 − 𝟕𝒙𝟏 − 𝟐𝒙𝟐 − 𝒙𝟑 + 𝒙𝟒 − 𝟐𝒙𝟓 = 𝟎. 𝟎
𝒙 𝟑 , 𝒙𝟒 , 𝒙𝟓
𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟐
Are basic variable
−𝟐𝒙𝟏 + 𝒙𝟐 + 𝒙𝟒 = 𝟎. 𝟎
1. Coefficient must be 1
𝟎. 𝟓𝒙𝟏 + 𝒙𝟐 + 𝒙𝟓 = 𝟐 2. Must not be included in Z equation

𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution
Z −7 −2 −1 1 −2 0.0
𝑥3 1 1 1 0 0 2
𝑥4 −2 1 0 1 0 0.0
𝑥5 0.5 1 0 0 1 2

DIAA EL-DINE ALI FARGHAL 17


You have to initiate a new Z row with 𝒙𝟑 , 𝒙𝟒 , 𝒙𝟓 coefficients equal zero

𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution
Z −7 −2 −1 1 −2 0.0
𝑥3 1 1 1 0 0 2
𝑥4 −2 1 0 1 0 0
2 × 𝑥5 1 2 0 0 2 4
Z+𝑥3 − 𝑥4 + 2𝑥5 −3 0 0 0 0 6

Entering
Column

𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution Ratio
Z −3 0 0 0 0 6
𝑥3 1 1 1 0 0 2 2
𝑥4 −2 1 0 1 0 0
𝑥5 0.5 1 0 0 1 2 4

leaving
Row

new 𝑥1 1 1 1 0 0 2

Old Z −3 0 0 0 0 6
+3𝑥1 3 3 3 0 0 6
New Z 0 3 3 0 0 12

DIAA EL-DINE ALI FARGHAL 18


Old 𝑥4 −2 1 0 1 0 0
+2𝑥1 2 2 2 0 0 4
New 𝑥4 0 3 2 1 0 4

Old 𝑥5 0.5 1 0 0 1 2
−0.5𝑥1 −0.5 −0.5 −0.5 0 0 −1
New 𝑥5 0 0.5 −0.5 0 1 1

𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 solution
Z 0 3 3 0 0 12
𝑥1 1 1 1 0 0 2
𝑥4 0 3 2 1 0 4
𝑥5 0 0.5 −0.5 0 1 1

Results
𝒁 = 𝟏𝟐
𝒙𝟏 = 𝟐
𝒙𝟒 = 𝟒
𝒙𝟓 = 𝟏

DIAA EL-DINE ALI FARGHAL 19


Operation and Research
M- Method
This method is applied if the in equality of any constraint is (≥ bigger than); also, it is used
in case of equality.
.)‫ ) مصاحب بعالمة (أكبر من او يساوي‬Constraints ( ‫يتم استخدام هذه الطريقة في حالة إذا كان واحد او اكثر من ال‬

How the M-method is differing from Simplex?


Slack variable is used in case of simplex for eliminating the in equality and acting as basic
variable. However, in case of M-method it is used only for replacing the inequality by
equality.

Example Results
Simplex X ≤ 70 X=70+S Basic variable

M-method X ≥ 70 X=70−S Non- Basic


Slack variable variable
M-method X = 70 cannot be used

As we see, in case of simplex slack variable is added to the equation; in contrast, in case of
M-method slack variable is subtracted from the equation.

Slack variable in case of M-method


1. In case of M- method slack variable cannot be a basic variable as its sign will be
negative if the in equality is bigger than.

Example
• Convert the following inequality to equality
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 ≥ 𝟐𝟓
• Result in Slack variable has a
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 − 𝑺 = 𝟐𝟓 negative sign so it is
Non- Basic variable

DIAA EL-DINE ALI FARGHAL 20


2. In case of M-method slack variable cannot be included in constraints that have equality
Example
• 𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 = 𝟐𝟓
• Slack variables are used mainly for converting inequality to equality; therefore, they
have nothing to do in a constraint like that.

Conclusion
in case of M- method, slack variable cannot be used as a basic variable so we have to add
another variable called artificial variable to be the basic variable.

How to use artificial variable?


For constraints
1. Bigger than ≥
• Use the artificial variable in the following constraint
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 ≥ 𝟐𝟓
• Result in
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 − 𝑺𝟏 + 𝑹𝟏 = 𝟐𝟓 Artificial variable is basic
as its coefficient is +ve one

2. Equality =
• Use the artificial variable in the following constraint
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 = 𝟐𝟓
• Result in
𝒙𝟏 + 𝟓𝒙𝟐 + 𝟑𝒙𝟑 + 𝑹𝟏 = 𝟐𝟓 Artificial variable is basic
as its coefficient is +ve one

• Note that no slack variable is used for equality

DIAA EL-DINE ALI FARGHAL 21


For objective function
1. Min Z
• Use the artificial variable in the following constraint
𝑴𝒊𝒏𝒁 = 𝒙𝟏 + 𝟓𝒙𝟐
• Result in

𝑴𝒊𝒏𝒁 = 𝒙𝟏 + 𝟓𝒙𝟐 + 𝑴 ∑ 𝑹

𝑴𝒊𝒏𝒁 − 𝒙𝟏 − 𝟓𝒙𝟐 − 𝑴 ∑ 𝑹 = 𝟎. 𝟎

• Note that R is the basic variable and its coefficient in objective function is not zero
so we have to convert its coefficient to zero in the first step before starting solution.

2. Max Z
• Use the artificial variable in the following constraint
𝑴𝒂𝒙𝒁 = 𝒙𝟏 + 𝟓𝒙𝟐
• Result in

𝑴𝒊𝒏𝒁 = 𝒙𝟏 + 𝟓𝒙𝟐 − 𝑴 ∑ 𝑹

𝑴𝒊𝒏𝒁 − 𝒙𝟏 − 𝟓𝒙𝟐 + 𝑴 ∑ 𝑹 = 𝟎. 𝟎

• Note that R is the basic variable and its coefficient in objective function is not zero
so we have to convert its coefficient to zero in the first step before starting solution.

DIAA EL-DINE ALI FARGHAL 22


Problem (3.5)
𝐦𝐢𝐧 𝒁 = 𝟒𝒙𝟏 − 𝟖𝒙𝟐 + 𝟑𝒙𝟑
S.T
𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 = 𝟕
𝟐𝒙𝟏 − 𝟓𝒙𝟐 + 𝒙𝟑 ≥ 𝟏𝟎
𝒙𝟏,𝟐,𝟑 ≥ 𝟎. 𝟎
Solution
Steps
1. Convert the objective function to equation.

𝒁 = 𝟒𝒙𝟏 − 𝟖𝒙𝟐 + 𝟑𝒙𝟑 + 𝑴(𝑹𝟏 + 𝑹𝟐 )


𝒁 − 𝟒𝒙𝟏 + 𝟖𝒙𝟐 − 𝟑𝒙𝟑 − 𝑴𝑹𝟏 − 𝑴𝑹𝟐 = 𝟎. 𝟎
2. Convert all the inequalities in each constraint to equality by using slack variables and
artificial variables.
𝒙𝟏 + 𝒙𝟐 + 𝒙𝟑 + 𝑹𝟏 = 𝟕
𝟐𝒙𝟏 − 𝟓𝒙𝟐 + 𝒙𝟑 − 𝒔𝟏 + 𝑹𝟐 = 𝟏𝟎

3. Construct the first table.

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution
Z −4 8 −3 0 −M −M 0
𝑹𝟏 1 1 1 0 1 0 7
𝑹𝟐 2 −5 1 −1 0 1 10

DIAA EL-DINE ALI FARGHAL 23


4. Adjusting Z-row

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution
Z −4 8 −3 0 −M −M 0
𝐌 × 𝑹𝟏 M M M 0 M 0 7M
𝐌 × 𝑹𝟐 2M −5M M −M 0 M 10M
New Z 3M−4 −4M+8 2M−3 −M 0 0 17M
(𝐙 + 𝐌 × 𝑹𝟏 + 𝐌 × 𝑹𝟐 )

• After adjusting Z-row, the table will be 1st construction


table
Entering
Column

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution Ratio
Z 3M−4 −4M+8 2M−3 −M 0 0 17M
𝑹𝟏 1 1 1 0 1 0 7 7
𝑹𝟐 2 −5 1 −1 0 1 10 5

Pivot leaving
element Row

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution
Z
𝑹𝟏
𝒙𝟏 1 −2.5 0.5 −0.5 0 0.5 5

DIAA EL-DINE ALI FARGHAL 24


• After adjusting Z-row, the table will be

Entering
Column

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution Ratio
Z 0 3.5M−2 0.5M−1 0.5M−2 0 −1.5M+2 2M+20
𝑹𝟏 0 3.5 0.5 0.5 1 −0.5 2 4/7
𝒙𝟏 1 −2.5 0.5 −0.5 0 0.5 5
leaving
Pivot Row
element

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution
Z
𝒙𝟐 0 1 1/7 1/7 2/7 −1/7 4/7
𝒙𝟏

• After adjusting Z-row, the table will be

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝑹𝟏 𝑹𝟐 solution
Z 0 0 −3/7 −12/7 −4M+(22/7) −M+(12/7) 148/7
𝒙𝟐 0 1 1/7 1/7 2/7 −1/7 4/7
𝒙𝟏 1 0 6/7 −1/7 5/7 1/7 45/7

Results
𝟏𝟒𝟖 𝟒𝟓 𝟒
𝒁= 𝒙𝟏 = 𝒙𝟐 =
𝟕 𝟕 𝟕

DIAA EL-DINE ALI FARGHAL 25


Problem (3.6)
𝐦𝐢𝐧 𝒁 = 𝟐𝒙𝟏 + 𝟑𝒙𝟐
S.T
𝟎. 𝟓𝒙𝟏 + 𝟎. 𝟐𝟓𝒙𝟐 ≤ 𝟒
𝒙𝟏 + 𝟑𝒙𝟐 ≥ 𝟐𝟎
𝒙𝟏 + 𝟑𝒙𝟐 = 𝟏𝟎
𝒙𝟏,𝟐 ≥ 𝟎. 𝟎

Solution
𝒁 − 𝟐𝒙𝟏 − 𝟑𝒙𝟐 − 𝑴𝑹𝟏 − 𝑴𝑹𝟐 = 𝟎. 𝟎
𝟎. 𝟓𝒙𝟏 + 𝟎. 𝟐𝟓𝒙𝟐 + 𝒔𝟏 = 𝟒
𝒙𝟏 + 𝟑𝒙𝟐 − 𝒙𝟑 + 𝑹𝟏 = 𝟐𝟎
𝒙𝟏 + 𝟑𝒙𝟐 + 𝑹𝟐 = 𝟏𝟎

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z −2 −3 0 0 −M −M 0
𝒔𝟏 0.5 0.25 1 0 0 0 4
𝑹𝟏 1 3 0 −1 1 0 20
𝑹𝟐 1 1 0 0 0 1 10

DIAA EL-DINE ALI FARGHAL 26


• Adjusting Z-row

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z −2 −3 0 0 −M −M 0
𝐌 × 𝑹𝟏 M 3M 0 −M M 0 20M
𝐌 × 𝑹𝟐 M M 0 0 0 M 10M
New Z 2M−2 4M−3 0 −M 0 0 30M
(𝐙 + 𝐌 × 𝑹𝟏 + 𝐌 × 𝑹𝟐 )

• After adjusting Z-row, the table will be


1st construction
table
Entering
Column

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution Ratio
Z 2M−2 4M−3 0 −M 0 0 30M
𝒔𝟏 0.5 0.25 1 0 0 0 4 16
𝑹𝟏 1 3 0 −1 1 0 20 20/3
𝑹𝟐 1 1 0 0 0 1 10 𝟏𝟎

Pivot
element leaving
Row

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z
𝒔𝟏
𝒙𝟐 1/3 1 0 −1/3 1/3 0 20/3
𝑹𝟐

DIAA EL-DINE ALI FARGHAL 27


• After adjusting Z-row, the table will be

Entering
Column

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution Ratio
Z (2M−3)/3 0 0 (M-3)/3 (3−4M)/3 0 (10M+60)/3
𝒔𝟏 5/12 0 1 1/12 −1/12 0 7/3 28/5
𝒙𝟐 1/3 1 0 −1/3 1/3 0 20/3 20
𝑹𝟐 2/3 0 0 1/3 −1/3 1 10/3 5

leaving
Pivot Row
element

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z
𝒔𝟏
𝒙𝟐
𝒙𝟏 1 0 0 0.5 −𝟎. 𝟓 1.5 5

• After adjusting Z-row, the table will be

𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z 0 0 0 −0.5 (1−2M)/2 (3−2M)/2 25
𝒔𝟏 0 0 1 −0.125 0.125 −5/8 0.25
𝒙𝟐 0 1 0 −0.5 0.5 −0.5 5
𝒙𝟏 1 0 0 0.5 −0.5 1.5 5

Results
𝒁 = 𝟐𝟓 𝒙𝟏 = 𝟓 𝒙𝟐 = 𝟓

DIAA EL-DINE ALI FARGHAL 28


Problem (3.7)
𝐦𝐚𝐱 𝒁 = 𝒙𝟏 + 𝒙𝟐
S.T
𝟐𝒙𝟏 + 𝒙𝟐 ≥ 𝟒
𝒙𝟏 + 𝟐𝒙𝟐 = 𝟔
𝒙𝟏,𝟐 ≥ 𝟎. 𝟎

Solution
𝒁 − 𝒙𝟏 − 𝒙𝟐 + 𝑴𝑹𝟏 + 𝑴𝑹𝟐 = 𝟎. 𝟎
𝟐𝒙𝟏 + 𝒙𝟐 − 𝒙𝟑 + 𝑹𝟏 = 𝟒
𝒙𝟏 + 𝟐𝒙𝟐 + 𝑹𝟐 = 𝟔

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z −1 −1 0 M M 0
𝑹𝟏 2 1 −1 1 0 4
𝑹𝟐 1 2 0 0 1 6

• Adjusting Z-row

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z −1 −1 0 M M 0
−𝐌 × 𝑹𝟏 −2M −M M −M 0 −4M
−𝐌 × 𝑹𝟐 −M −2M 0 0 −M −6M
New Z −3M−1 −3M−1 M 0 0 −10M
(𝐙 − 𝐌 × 𝑹𝟏 − 𝐌 × 𝑹𝟐 )

DIAA EL-DINE ALI FARGHAL 29


• After adjusting Z-row, the table will be
1st construction
table
Entering
Column

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution Ratio
Z −3M−1 −3M−1 M 0 0 −10M
𝑹𝟏 2 1 −1 1 0 4 2
𝑹𝟐 1 2 0 0 1 6 6

Pivot leaving
Row
element

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z
𝒙𝟏 1 0.5 −0.5 0.5 0 2
𝑹𝟐

• After adjusting Z-row, the table will be

Entering
Column

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution Ratio
Z 0 −1.5M−0.5 −0.5M−0.5 1.5M+0.5 0 2−4M
𝒙𝟏 1 0.5 −0.5 0.5 0 2 4
𝑹𝟐 0 1.5 0.5 −0.5 1 4 8/3

leaving
Pivot
Row
element

DIAA EL-DINE ALI FARGHAL 30


𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z
𝒙𝟏
𝒙𝟐 0 1 1/3 −1/3 2/3 8/3

• After adjusting Z-row, the table will be

Entering
Column

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution Ratio
Z 0 0 −1/3 M+(𝟏/𝟑) M+(𝟏/𝟑) 10/3
𝒙𝟏 1 0 −2/3 2/3 −1/3 2/3
𝒙𝟐 0 1 1/3 −1/3 2/3 8/3 8

Pivot leaving
element Row

𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z
𝒙𝟏
𝒙𝟑 0 3 1 −1 2 8

• After adjusting Z-row, the table will be


𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑹𝟏 𝑹𝟐 solution
Z 0 1 0 M M+𝟏 6
𝒙𝟏 1 2 0 0 𝟏 6
𝒙𝟑 0 3 1 −1 2 8
Results
𝒁=𝟔 𝒙𝟏 = 𝟔 𝒙𝟐 = 𝟎

DIAA EL-DINE ALI FARGHAL 31

You might also like