0% found this document useful (0 votes)
4 views

Chapter 4 - Solving Linear Programs Part 1

Uploaded by

zqweo23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Chapter 4 - Solving Linear Programs Part 1

Uploaded by

zqweo23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Chapter 4

Solving Linear Programs:


Part 1: Simplex Method

Prof. Hai Yang


Department of Civil and Environmental Engineering
HKUST

1
Graphical Method (Two Variables)

• Optimal solution, feasible solution, objective


function, and feasible region
– Case 1: Two decision variables
Feasible Region:
Optimal Solution Convex 2-D shape

𝑥2

Objective Function: Feasible Solution:


A shifting line with One point in the
predefined slope feasible region
𝑥1

2
Graphical Method (Three Variables)

• Optimal solution, feasible solution, objective function,


and feasible region
Objective Function:
A shifting plane
𝑥2
Feasible Region:
Convex 3-D polyhedra

Feasible Solution:
One point in the 𝑥1
feasible region

𝑥3
Optimal Solution
3
Linear Programs: with More Decision Variables

• How to describe optimal solutions, feasible solutions,


objective functions, and feasible regions with Four
decision variables in the graphical method

• What about Five decision variables, and more than


Five decision variables

• The graphical method cannot find optimal solutions


for linear programs with more than three decision
variables

4
Simplex Method

• Developed by George Bernard


Dantzig in 1947 as part of a U.S.
Air Force research project

• The Father of Linear Programming

• Founder of Operations Research

• One of Top 10 Algorithms in 20th


century (by Computing in Science and
Engineering: a joint publication of the American
Institute of Physics and the IEEE Computer
Society)

1914.11⎯2005.05

5
Underlying Concepts of Simplex Method

• If it exists, the optimal solution must be an extreme point


(Theorem 3)
• For an n-dimension convex feasible region, the number of
extreme points is limited
• Simplex method moves from one extreme point to another to
find the optimal solution
𝑥2
D

E C

A B 𝑥1 6
Solving Linear Program:
Simplex Method

7
Simplex Method: Basic Solutions

• In a standard LP with n decision


𝑐11 𝑥1 + ⋯ + 𝑐1𝑛 𝑥𝑛 = 𝑏1
variables and m constraints, a basic ⋮
solution is a unique solution by 𝑐𝑚1 𝑥1 + ⋯ + 𝑐𝑚𝑛 𝑥𝑛 = 𝑏𝑚
setting n-m of the variables equal to
𝑥1 , … , 𝑥𝑛 ≥ 0
zero and solving the constraint
functions for the other m variables
– The n-m variables set to zero are
non-basic variables (𝑥𝑚+1 , … , 𝑥𝑛 )
– The other m variables are basic 𝑐11 𝑥1 + ⋯ + 𝑐1𝑚 𝑥𝑚 = 𝑏1
variables (𝑥1 , … , 𝑥𝑚 ) ⋮
– The basis [sub-matrix associated 𝑐𝑚1 𝑥1 + ⋯ + 𝑐𝑚𝑚 𝑥𝑚 = 𝑏𝑚
with (𝑥1 , … , 𝑥𝑚 )] 𝑥1 , … , 𝑥𝑚 ≥ 0

8
Simplex Method: Representation of a Basic Solution

• A basic solution consists of


– (𝑥1 , … , 𝑥𝑚 ) are basic variables
Basic variables
– (𝑥𝑚+1 , … , 𝑥𝑛 ) are non-basic variables
Non-basic
𝐵0 = {𝑥1 , 𝑥2 , … , 𝑥𝑚 } variables

𝑥1 = 𝑙1 + 𝑘1,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘1𝑛 𝑥𝑛


Basic
variables
𝑥2 = 𝑙2 + 𝑘2,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘2𝑛 𝑥𝑛

𝑥𝑚 = 𝑙𝑚 + 𝑘𝑚,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘𝑚𝑛 𝑥𝑛

𝑍 = 𝑐1 𝑥1 + ⋯ + 𝑐𝑚 𝑥𝑚 + ⋯ + 𝑐𝑛 𝑥𝑛
Objective
function
𝑍 = 𝐿 + 𝑑𝑚+1 𝑥𝑚+1 + ⋯ + 𝑑𝑛 𝑥𝑛
9
Example of Representation of a Basic Solution

Max Z = 3𝑥1 +5𝑥2 Max Z = 3𝑥1+ 5𝑥2 + 0𝑠1 + 0𝑠2 + 0𝑠3


s.t. s.t.
𝑥1 ≤ 4 𝑥1 + 𝑠1 = 4
2𝑥2 ≤ 12 2𝑥2 +s2 = 12
3𝑥1 + 2𝑥2 ≤ 18 3𝑥1 + 2𝑥2 + s3 = 18
𝑥1 , 𝑥2 ≥ 0 𝑥1 , 𝑥2 , s1 , s2 , s3 ≥ 0

B0={x1,x2,s1}, NB0={s2,s3}
1 1
𝐵 = {𝑥1 , 𝑥2 , … , 𝑥𝑚 }
0 x1 = 2 + s2 – s3
3 3
1 (Refer to next
𝑥1 = 𝑙1 + 𝑘1,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘1𝑛 𝑥𝑛 x2 = 6 – s2
2 slide)
𝑥2 = 𝑙2 + 𝑘2,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘2𝑛 𝑥𝑛 1 1
s1 = 2 – s2 + s3
3 3

𝑥𝑚 = 𝑙𝑚 + 𝑘𝑚,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘𝑚𝑛 𝑥𝑛
Z = 3𝑥1+ 5𝑥2 + 0𝑠1 + 0𝑠2 + 0𝑠3
𝑍 =𝐿 + 𝑑𝑚+1 𝑥𝑚+1 + ⋯ + 𝑑𝑛 𝑥𝑛 1 1
= 3 2 + s2 – s3 + 5 6 – s2
1
3 3 2
3
= 36 − s –s3
2 2 10
11
Example of Representation of a Basic Solution

Min Z = 𝑥1 + 𝑥2 − 3𝑥3 Max Z’ = −𝑥1 − 𝑥2 + 3𝑥3 + 0𝑠1 + 0𝑠2 − 𝑀a1 − 𝑀a2


s.t. s.t.
− 𝑥1 + 2𝑥2 − 𝑥3 ≥ -11 𝑥1 − 2𝑥2 + 𝑥3 + 𝑠1 = 11
2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3 2𝑥1 + 𝑥2 − 4𝑥3 − s2 + a1 = 3
𝑥1 − 2𝑥3 = 1 𝑥1 − 2𝑥3 + a2 = 1
𝑥1 , 𝑥2 , 𝑥3 ≥ 0 𝑥1 , 𝑥2 , 𝑥3 , s1 , s2 , a1 , a2 ≥ 0

B0={s1,a1,a2}
s1 = 11 – x1 + 2x2 – x3
𝐵0 = {𝑥1 , 𝑥2 , … , 𝑥𝑚 }
a1 = 3 – 2x1 – x2 + 4x3 + s2
𝑥1 = 𝑙1 + 𝑘1,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘1𝑛 𝑥𝑛 a2 = 1 – x1 + 2x3
𝑥2 = 𝑙2 + 𝑘2,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘2𝑛 𝑥𝑛
⋮ Z’ = – x1 – x2 + 3x3 + 0s1 + 0s2 – Ma1 – Ma2
𝑥𝑚 = 𝑙𝑚 + 𝑘𝑚,𝑚+1 𝑥𝑚+1 + ⋯ + 𝑘𝑚𝑛 𝑥𝑛 = – x1 – x2 + 3x3 – M(3 – 2x1 – x2+ 4x3 +s2)
– M(1 – x1+ 2x3)
𝑍 =𝐿 + 𝑑𝑚+1 𝑥𝑚+1 + ⋯ + 𝑑𝑛 𝑥𝑛
= –4M + (3M–1)x1 + (M–1)x2 – (6M–3)x3
– Ms2 12
Simplex Method: Algebra Meaning

• Any two extreme point


solutions that share all
𝑥2 except one non-basic
D variable are adjacent.

B1={s1,a1,a2}
E C s1 = 11 – x1 + 2x2 – x3

An Example
a1 = 3 – 2x1 – x2 + 4x3 + s2
a2 = 1 – x1 + 2x3

B2={s1,s2,a2}
A B 𝑥1 s1 = 11 – x1 + 2x2 – x3
s2 = 3 – 2x1 – x2 + 4x3 + a1
a2 = 1 – x1 + 2x3

13
An Example of Simplex Method: Algebra
Meaning

x1 + 2 x2  6 x1 + 2 x2 + s1 = 6
𝑥2 2 x1 + x2  6 2 x1 + x2 + s2 = 6
10
9
B1 = {s1,s2} 1
8
s1 = 6 – x1 – 2x2 𝑥1 , 𝑥2 , 𝑠1 , 𝑠2 = 0,0,6,6
7 s2 = 6 – 2x1 – x2
6
5 B2 = {s1,x1} 2
2 x1 + x2  6 3
s1 = 3 – x2 + 𝑠2
1
𝑥1 , 𝑥2 , 𝑠1 , 𝑠2 = 3,0,3,0
4 2 2

3 ( 0,3) x1 = 3
1
– x2 –
1
𝑠
2 2 2
2 ( 2, 2 )
x1 + 2 x2  6
1
( 3, 0 )
0 1 2 𝑥1
0 1 2 3 4 5 6 7 8 9 10 11 12 13
14
A Quick Example for General Understanding
of the Processes of Simplex Method

Original LP Standard form

maximize 3 x1 + x2 + 2 x3 z = 3 x1 + x2 + 2 x3 + 0 s1 + 0s2 + 0s3


subject to
x1 + x2 + 3 x3  30 x1 + x2 + 3 x3 + s1 = 30
2 x1 + 2 x2 + 5 x3  24 2x1 + 2x2 + 5x3 + s2 = 24
4 x1 + x2 + 2 x3  36 4x1 + x2 + 2x3 + s3 = 36
x1 , x2 , x3  0 x1 , x2 , x3 , s1 , s2 , s3  0

15
A Quick Example for General Understanding
the Processes of Simplex Method
Basic and feasible solution Pivot in x1 ; remove s3 from the basis
z = 3 x1 + x2 + 2 x3 1 1 3
z = 27 + x2 + x3 − s3
s1 = 30 − x1 − x2 − 3 x3 4 2 4
1 1 1
s2 = 24 − 2x1 − 2x2 − 5x3 x1 = 9 − x2 − x3 − s3
4 2 4
s3 = 36 − 4x1 − x2 − 2x3
3 5 1
s1 = 21 − x2 − x3 + s3
4 2 4
3 1
s2 = 6 − x2 − 4 x3 + s3
2 2

Pivot in x3 ; remove s2 Pivot in x2 ; remove x3 Optimal !


111 1 1 11 1 1 2
z = + x2 − s2 − s3 z = 28 − x3 − s2 − s3
4 16 8 16 6 6 3
33 1 1 5 1 1 1
x1 = − x2 + s2 − s3 x1 = 8 + x3 + s2 − s3
4 16 8 16 6 6 3
3 3 1 1 8 2 1
x3 = − x2 − s2 + s3 x2 = 4 − x3 − s2 + s3
2 8 4 8 3 3 3
69 3 5 1 1 1
s1 = + x2 + s2 − s3 s1 = 18 − x3 + s2
4 16 8 16 2 2 16
Simplex Method
Processes of Simplex Method

Stage 1: Stage 2:
Find one basic Find the optimal solution based on the
feasible solution identified basic feasible solution

Basic solution Optimal


with all Solution Q2: Check
slack/surplus optimal solution
variables basis Yes

No Select variable
Optimal?
Feasible? entering the basis

Find a basic feasible Derive values for Decide variable


solution basic variables leaving the basis

Q1: Check Q4: Develop new Q3: Determine entering


feasible solution simplex pivot and leaving variables
17
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

18
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

19
Stage 1: Feasibility of a Basic Solution (Q1)

• To find a basic feasible solution, an initial tableau form


should be generated
– An artificial variable must be added to each constraint that does
not have a basic variable.

• A set of equations is in tableau form if for each equation:


– its right hand side (RHS) is non-negative, and

– there is a basic variable. (A basic variable for an equation is


a variable whose coefficient in the equation is +1 and
whose coefficient in all other equations of the problem is 0.)

20
Stage 1: Progresses of Formulating the
Initial Tabular Form (Step 1)

Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

Make it a
maximization
problem

If the problem is a minimization, multiply the


Two cases: objective function by -1 and change it to a
Maximization maximization. After finding the optimal solution,
Minimization make sure to put it back in the original objective
(without the minus sign) to find the optimal
objective value.

21
Stage 1: Progresses of Formulating the
Initial Tabular Form (Step 2)

Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

Make all RHS


non-negative

Two cases: If the problem contains negative right-


Non-negative & hand side values, multiply these
Negative constraints by -1 to make the RHS values
positive

22
Stage 1: Progresses of Formulating the
Initial Tabular Form (Step 3)

Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

All the
constraints For each “Less than or equal to”
have basic (≤)constraint, Add a slack variable to each
variables constraint
For each “equal to” (=) constraint, add an
Three cases: artificial variable.

For each “greater than or equal to” (≥)
=
constraint, subtract a surplus variable and

add an artificial variable.

23
Stage 1: Progresses of Formulating the
Initial Tabular Form (Step 4)

Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

For each slack/surplus variables, set its


Two cases: coefficient in the objective function to 0
Slack/surplus &
Artificial variables For each artificial variable, set its
coefficient in the objective function to –M,
where M is a very large number

24
Stage 1: Progresses of Formulating the
Initial Tabular Form (Step 5)

Coefficients
Objective Right-hand (variables in Initial
Constraints
function side (RHS) objective basis
function)

Identity the initial In general, the initial basic


basis
variables includes slack/surplus
and artificial variables

25
Example 1 (Stage 1)

Max 𝒁=𝟓𝒙𝟏 + 𝟖𝒙𝟐


s.t.
𝒙𝟏 + 𝟐𝒙𝟐 ≤ 𝟏𝟐
𝟒𝒙𝟏 + 𝟓𝒙𝟐 ≤ 𝟒𝟎
𝒙𝟏 ≤𝟓
𝒙𝟏 , 𝒙𝟐 ≥ 𝟎

26
Example 1 (Stage 1)
Initial Tabular Form Formulation

1 2 3 4 5
Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

1 4
Max 𝒁=𝟓𝒙𝟏 + 𝟖𝒙𝟐 Max 𝒁=𝟓𝒙𝟏 + 𝟖𝒙𝟐 + 𝟎𝒔𝟏 + 𝟎𝒔𝟐 + 𝟎𝒔𝟑
s.t. s.t.
3 𝒙𝟏 + 𝟐𝒙𝟐 ≤ 𝟏𝟐 2
𝒙𝟏 + 𝟐𝒙𝟐 + 𝒔𝟏 = 𝟏𝟐
𝟒𝒙𝟏 + 𝟓𝒙𝟐 ≤ 𝟒𝟎 𝟒𝒙𝟏 + 𝟓𝒙𝟐 + 𝒔𝟐 = 𝟒𝟎
𝒙𝟏 ≤ 𝟓 𝒙𝟏 + 𝒔𝟑 = 𝟓
𝒙𝟏 , 𝒙𝟐 ≥ 𝟎
𝒙𝟏 , 𝒙𝟐 , 𝒔𝟏 , 𝒔𝟐 , 𝒔𝟑 ≥ 𝟎

27
Example 1 (Stage 1)
Initial Tabular Form Formulation

• The start point — treat slack/artificial variables as 5


basic variables Basis
– 𝑠1 , 𝑠2 , and 𝑠3 are the basic variables
– 𝑥1 and 𝑥2 are the non-basic variables

𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 }
𝑥1 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5
𝑍 = 0 + 5𝑥1 + 8𝑥2

28
Example 1(Stage 1)
Feasibility of a Basic Solution (Q1)

• Any basic solution having one or more negative basic


variables is infeasible
– Let the non-basic variables be zero and check the values of basic variables

𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 }
If 𝑥1 and 𝑥2 are 0, then
This basic solution
𝒔𝟏 = 12 − 𝑥1 − 2𝑥2 = 12 > 0 is feasible
𝒔𝟐 = 40 − 4𝑥1 − 5𝑥2 = 40 > 0
𝒔𝟑 = 5 − 𝑥1 = 5>0
𝑍= 0 + 5𝑥1 + 8𝑥2
( 0,0,12, 40,5 ) ; Z = 0
29
Example 2 (Stage 1)

Min Z = 𝑥1 + 𝑥2 − 3𝑥3
s.t.
− 𝑥1 + 2𝑥2 − 𝑥3 ≥ -11
2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3
𝑥1 − 2𝑥3 = 1
𝑥1 , 𝑥2 , 𝑥3 ≥ 0

30
Example 2 (Stage 1)
Initial Tabular Form Formulation

1 2 3 4 5
Coefficients
Objective Right-hand (variables in
Constraints Basis
function side (RHS) objective
function)

1 4
Min Z = 𝑥1 + 𝑥2 − 3𝑥3 Max Z’ = −𝑥1 − 𝑥2 + 3𝑥3 + 0𝑠1 + 0𝑠2 − 𝑀a1 − 𝑀a2
s.t. s.t.
2
3 − 𝑥1 + 2𝑥2 − 𝑥3 ≥ -11 𝑥1 − 2𝑥2 + 𝑥3 + 𝑠1 = 11
2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3 2𝑥1 + 𝑥2 − 4𝑥3 − s2 + a1 = 3
𝑥1 − 2𝑥3 = 1 𝑥1 − 2𝑥3 + a2 = 1
𝑥1 , 𝑥2 , 𝑥3 ≥ 0 𝑥1 , 𝑥2 , 𝑥3 , s1 , s2 , a1 , a2 ≥ 0

31
Example 2 (Stage 1)
Initial Tabular Form Formulation

• The start point — treat slack/artificial variables as 5


basic variables (choosing artificial variable as basic
Basis
variable first; if no artificial variable, then choosing
slack variable as a basic variable)
– 𝑠1 , 𝑎1 and 𝑎2 are basic variables
– 𝑥1, 𝑥2, 𝑥3 and 𝑠2 are non-basic variables
B0={s1,a1,a2}
x1 − 2x2 + x3 + s1 = 11;
2x1 + x2 − 4x3 − s2 + a1 = 3;
x1 − 2x3 + a2 = 1;
Z’ = 0 – x1 – x2 + 3x3 – Ma1 – Ma2
= –4M + (3M–1)x1 + (M–1)x2 – (6M–3)x3 – Ms2 32
Example 2 (Stage 1)
Feasibility of a Basic Solution (Q1)

• Any basic solution having one or more negative basic


variables is infeasible
– Let the non-basic variables be zero and check the values of basic
variables

B0={s1,a1,a2}
This basic solution
s1 = 11 – x1 + 2x2 – x3 = 11 ≥ 0; is feasible

a1 = 3 – 2x1 – x2 + 4x3 + s2 = 3 ≥ 0;
a2 = 1 – x1 + 2x3 = 1 ≥ 0;
Z’ = 0 – x1 – x2 + 3x3 – Ma1 – Ma2
= –4M + (3M–1)x1 + (M–1)x2 – (6M–3)x3 – Ms2

0,0,0,11,0,3,1 ; 𝑍′ = −4𝑀
33
Question: Why Artificial Variable ?

• If all the constraints are “≤” (with positive right-hand


side), then we can easily find a basic feasible solution,
which consists of all normal variables equal to zero (𝒙𝟏 =
𝒙𝟐 = 𝟎), and 𝑠1 = 12 > 0, 𝑠2 = 40 > 0, 𝑠3 = 5 > 0

𝒙𝟏 + 𝟐𝒙𝟐 ≤ 𝟏𝟐 𝒙𝟏 + 𝟐𝒙𝟐 + 𝒔𝟏 = 𝟏𝟐
𝟒𝒙𝟏 + 𝟓𝒙𝟐 ≤ 𝟒𝟎 𝟒𝒙𝟏 + 𝟓𝒙𝟐 + 𝒔𝟐 = 𝟒𝟎
𝒙𝟏 ≤ 𝟓 𝒙𝟏 + 𝒔𝟑 = 𝟓
𝒙𝟏 , 𝒙𝟐 ≥ 𝟎 𝒙𝟏 , 𝒙𝟐 , 𝒔𝟏 , 𝒔𝟐 , 𝒔𝟑 ≥ 𝟎

34
Question: Why Artificial Variable ?
• Consider the case with at least one constraint with “≥” or “=”,
𝑥1 − 2𝑥2 + 𝑥3 ≤ 11 𝑥1 − 2𝑥2 + 𝑥3 + s1 = 11 (1)
2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3 2𝑥1 + 𝑥2 − 4𝑥3 − s2 = 3 (2)
𝑥1 − 2𝑥3 = 1 𝑥1 − 2𝑥3 = 1 (3)
𝑥1 , 𝑥2 , 𝑥3 ≥ 0 𝑥1 , 𝑥2 , 𝑥3 , s1 , s2 ≥ 0
• Like previous example, if we set normal variables 𝒙𝟏 = 𝒙𝟐 = 𝒙𝟑 = 𝟎, we have
constraint (1) ⇒ 𝑠1 = 11 (OK)
constraint (2) ⇒ 𝒔𝟐 = −𝟑 (Not OK)
constraint (3) ⇒ 0 = 1 (not OK)
• If we choose 𝒙𝟐 and 𝒙𝟑 as the non-basic variables and set their values to be zero
(𝒙𝟐 = 𝒙𝟑 = 𝟎), we have
constraint (3) ⇒ 𝒙𝟏 = 1 (OK)
constraint (1) ⇒ 𝑠1 = 10 (OK)
constraint (2) ⇒ 𝒔𝟐 = −𝟏 (not OK)
Without introducing artificial variables, it is not straightforward to identify an initial
feasible basic solution. 35
Question: Why Artificial Variable ?

𝑥1 − 2𝑥2 + 𝑥3 ≤ 11 𝑥1 − 2𝑥2 + 𝑥3 + s1 = 11 (1)


2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3 2𝑥1 + 𝑥2 − 4𝑥3 − s2 + a1 = 3 (2)
𝑥1 − 2𝑥3 = 1 𝑥1 − 2𝑥3 + a2 = 1 (3)
𝑥1 , 𝑥2 , 𝑥3 ≥ 0 𝑥1 , 𝑥2 , 𝑥3 , s1 , s2 , a1 , a2 ≥ 0

• In this case, by adding artificial variables to “≥” and ”=” constraints (2)
and (3), we can easily identify an initial feasible basic solution.
• Evidently, If we choose basic variables 𝑠1 , 𝑎1 , 𝑎2 , then
(𝑥1 , 𝑥2 , 𝑥3 , 𝑠1 ,𝑠2 , 𝑎1 ,𝑎2 ) = (0,0,0,11,0,3,1) is a basic feasible solution.
• In order NOT to change the original optimal solution and optimal
objective function value after introducing 𝑎1 and 𝑎2 , we introduce a
large number 𝑀 to penalize 𝑎1 & 𝑎2 in the objective function, to ensure
that 𝑎1 = 𝑎2 = 0 at optimum.
𝐌𝐚𝐱 𝒁′ = 𝟎 − 𝒙𝟏 − 𝒙𝟐 + 𝟑𝒙𝟑 − 𝑴𝒂𝟏 − 𝑴𝒂𝟐
36
Question: Why setting a large coefficient M can enforce
artificial variables a equal to zero at final optimum ?

Answer: a1 and a2 are associated with equality constraints and the


equality constraints are satisfied only when they are equal to zero at
final optimum. Since this is a maximization problem, setting a large
coefficient will enforce them to zero at final optimum for maximizing
the objective function value.

Consider Consider
max 𝑍 = 2𝑥1 − 𝑥2 max 𝑍 = 2𝑥1 − 𝑥2 − 9999𝑎 𝑀 = 9999

subject to 𝑥1 + 𝑥2 = 10 subject to 𝑥1 + 𝑥2 + 𝑎 = 10

𝑥1 ≥ 0; 𝑥2 ≥ 0 𝑥1 ≥ 0; 𝑥2 ≥ 0, 𝑎 ≥ 0

Clearly, 𝑥1∗ = 10; 𝑥2∗ = 0; 𝑍 ∗ = 20 Clearly, 𝑥1∗ = 10; 𝑥2∗ = 0; 𝑎∗ = 0; 𝑍 ∗ = 20

37
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

38
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• Maximization Problem: Checking the coefficients of


non-basic variables in the objective functions:
– If the coefficients of all non-basic variables are all
negative, this basic solution is optimal
– If the coefficient of any non-basic variables is
positive, this basic solution is not optimal
– If the coefficients of some non-basic variables are 0
and those of other non-basic variables are all
negative, this basic solution is optimal and this
problem has alternate optima (to be shown later)

39
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑥1 and 𝑥2 Max 𝑍=5𝑥1 + 8𝑥2


s.t.
• The coefficients of the non-basic
𝑥1 + 2𝑥2 ≤ 12
variables are 5 and 8; both are positive 4𝑥1 + 5𝑥2 ≤ 40
• This basic solution is not optimal 𝑥1 ≤ 5
𝑥1 , 𝑥2 ≥ 0
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 }
𝑥1 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5
𝑍 = 0 + 5𝑥1 + 8𝑥2 ( x1 , x2 , s1 , s2 , s3 ) = ( 0, 0,12, 40,5 )
If the coefficient of any non-basic variable (its value = 0 at the present
extreme point) is positive, that means objective function can still be
increased, since the non-basic variable can be put into basic variable set
(to have a value ≥ 0 as a new basic variable at the next extreme point). 40
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

41
Example 1 (Stage 2)
Select an Entering Variable (Q3)

• Maximization problem
– Select the non-basic variable with a positive coefficient in the
objective function
• 𝑥1 is a non-basic variable with a positive coefficient
Basic Variables Non-basic Variables
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 } 𝑁𝐵0 = {𝑥1 , 𝑥2 }

𝑥1 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5
𝑍 = 0 + 5𝑥1 + 8𝑥2
𝒙𝟏 is the entering variable
42
Example 1 (Stage 2)
Decide the Leaving Variable (Q3)
𝑥1 in
Basic 𝐵 0 = {𝑠1 , 𝑠2 , 𝑠3 } 𝑁𝐵0 = { 𝑥1 , 𝑥2 } Non-basic
Variables Variables

Which one should be out or leaving ?

• The leaving variable is the one that first goes to zero as the
value of the entering variable increases from zero
– Set 𝒙𝟏 to the maximum while maintaining all variables non-negative.
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 }
𝒔𝟏 = 12 − 𝑥1 − 2𝑥2 ≥ 0 requires 𝑥1 ≤ 12
𝒔𝟐 = 40 − 4𝑥1 − 5𝑥2 ≥ 0 requires 𝑥1 ≤ 10
𝒔𝟑 = 5 − 𝑥1 ≥ 0 requires 𝑥1 ≤ 5 More limiting, hence 𝑠3 is the leaving
variable, or 𝑥1 will replace 𝑠3 as the new
𝑍 = 0 + 5𝑥1 + 8𝑥2 basic variable at a maximum value of 5
43
Example 1 (Stage 2)
Decide the Leaving Variable (Q3)
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 } 𝑁𝐵0 = {𝑥1 , 𝑥2 }
𝒔𝟏 = 12 − 𝑥1 − 2𝑥2 ≥ 0 requires 𝑥1 ≤ 12
𝒔𝟐 = 40 − 4𝑥1 − 5𝑥2 ≥ 0 requires 𝑥1 ≤ 10 𝑥1 becomes basic variable
but 𝑥2 remains non-basic
𝒔𝟑 = 5 − 𝑥1 ≥ 0 requires 𝑥1 ≤ 5 and hence still zero
𝑍 = 0 + 5𝑥1 + 8𝑥2

• To maximize the objective function 𝑍 = 0 + 5𝑥1 + 8𝑥2 , 𝑥1 should be increased


(from 0) as much as possible.
• If 𝑥1 is increased to 10, then 𝑠1 = 2, 𝑠2 = 0, 𝑠3 = −5 < 0, violating the non-
negativity constraints.
• While maintaining the non-negativity constraints, the maximum increase of
𝑥1 is 5 (0 → 5), then 𝑠1 = 7, 𝑠2 = 20, 𝑠3 = 0, so 𝑠3 is the first variable that goes
to zero as 𝑥1 increases from zero.
Hence, 𝑠3 is the leaving variable to become non-basic
44
Example 1 (Stage 2)
Decide the Leaving Variable (Q3)
If 𝑥1 enters and 𝑠3 leaves 1
𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 } 𝑥1 , 𝑥2 , 𝑠1 , 𝑠2 , 𝑠3 = 5,0,7,20,0
𝒙𝟏 + 2𝑥2 + 𝒔𝟏 = 12 𝒔𝟏 = 7 − 2𝑥2 + 𝑠3 = 7 > 0 New basic
4𝒙𝟏 + 5𝑥2 + 𝒔𝟐 = 40 ⇒ 𝒔𝟐 = 20 − 5𝑥2 + 4𝑠3 = 20 > 0 solution is
𝒙𝟏 + 𝑠3 = 5 𝒙𝟏 = 5 − 𝑠3 = 5 > 0 feasible

If 𝑥1 enters and 𝑠2 leaves


2
1
𝐵 = {𝑠1 , 𝑥1 , 𝑠3 } 𝑥1 , 𝑥2 , 𝑠1 , 𝑠2 , 𝑠3 = 10,0,2,0, −5
𝒙𝟏 + 2𝑥2 + 𝒔𝟏 = 12 𝒔𝟏 = 2 − 3Τ4 𝑥2 + 1Τ4 𝑠2 > 0 New basic
4𝒙𝟏 + 5𝑥2 + 𝑠2 = 40 ⇒ 𝒙𝟏 = 10 − 5Τ4 𝑥2 − 1Τ4 𝑠2 > 0 solution is
𝒙𝟏 + 𝒔𝟑 = 5 𝒔𝟑 = −5 + 5Τ4 𝑥2 + 1Τ4 𝑠2 < 𝟎 infeasible

If 𝑥1 enters and 𝑠1 leaves


3
𝐵1 = {𝑥1 , 𝑠2 , 𝑠3 } 𝑥1 , 𝑥2 , 𝑠1 , 𝑠2 , 𝑠3 = 12,0,0, −8, −7
𝒙𝟏 + 2𝑥2 + 𝑠1 = 12 𝒙𝟏 = 12 − 2𝑥2 − 𝑠1 > 0 New basic
4𝒙𝟏 + 5𝑥2 + 𝒔𝟐 = 40 ⇒ 𝒔𝟐 = −8 + 3𝑥2 + 4𝑠1 < 𝟎 solution is
𝒙𝟏 + 𝒔𝟑 = 5 𝒔𝟑 = −7 + 2𝑥2 + 𝑠1 < 𝟎 infeasible 45
Question: Why the leaving variable should be the one that first goes
to zero as the value of the entering variable increases from zero ?

𝑥2
10
𝑍=5𝑥1 + 8𝑥2
9 Max 𝑍 = 5𝑥1 +8𝑥2
8 s.t.
7 𝑥1 + 2𝑥2 ≤ 12
4𝑥1 + 5𝑥2 ≤ 40
6 𝑥1 ≤ 5
5 𝑥1 , 𝑥2 ≥ 0
4
3
2
1
0 𝐵0 1 2 3 𝑥1
0 1 2 3 4 5 6 7 8 9 10 11 12 13
46
Question: Why choose x1 instead of x2 as entering variable even
x2 has a larger coefficient in the objective function ?

Answer: First, it is fine to choose either x1 or x2. Larger coefficient of x2 just means
larger increase in objective function for one unit increase in x2. The total increase in
objective function also depends on how much x2 can be increased once it enters the
set of basic variables.
Second, even a larger increase in objective function can be achieved at the current
iteration by choosing x2 as the entering variable; it does not guarantee that the total
number of movements is minimal to reach the optimum. In another word, the path
towards the optimum is not necessarily the shortest.
47
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

48
Example 1 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variable to get a new basic feasible solution
– Change the coefficient of all basic variables to be 1.
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 } 𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 }
𝑥1 + 2𝑥2 + 𝒔𝟏 = 12 5 − 𝑠3 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40 𝒙𝟏 = 𝟓 − 𝒔𝟑 4 5 − 𝑠3 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5 𝒙𝟏 + 𝑠3 = 5
𝑍 = 0 + 5𝑥1 + 8𝑥2 𝑍 = 0 + 5 5 − 𝑠3 + 8𝑥2

𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 } 𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 }
2𝑥2 + 𝒔𝟏 − 𝑠3 = 7 𝒔𝟏 = 7 − 2𝑥2 + 𝑠3
5𝑥2 + 𝒔𝟐 − 4𝑠3 = 20 𝒔𝟐 = 20 − 5𝑥2 + 4𝑠3
OR
𝒙𝟏 + 𝑠3 = 5 𝒙𝟏 = 5 − 𝑠3
𝑍 = 25 − 5𝑠3 + 8𝑥2 𝑍 = 25 − 5𝑠3 + 8𝑥2 49
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑠3 and 𝑥2


• The coefficient of non-basic variable 𝑥2 is positive, 8
• This basic solution is not optimal

𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 }
2𝑥2 + 𝒔𝟏 − 𝑠3 = 7
5𝑥2 + 𝒔𝟐 − 4𝑠3 = 20
𝒙𝟏 + 𝑠3 = 5
𝑍 = 25 − 5𝑠3 + 8𝑥2

50
Example 1 (Stage 2)
Select the Entering Variable and Leaving Variable (Q3)

• Select the non-basic variable with a positive coefficient


in the objective function
• The leaving variable is the one that first goes to zero as
the value of the entering variable increases from zero

𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 }
𝑠1 ≥ 0 requires 𝑥2 ≤ 3.5 more limiting, hence
2𝑥2 + 𝒔𝟏 − 𝑠3 = 7 𝑠1 is the leaving
5𝑥2 + 𝒔𝟐 − 4𝑠3 = 20 𝑠2 ≥ 0 requires 𝑥2 ≤ 4 variable, or 𝑥2 will
replace 𝑠1 as the
𝒙𝟏 + 𝑠3 = 5 𝑥1 ≥ 0 requires 𝑥2 ≤ ∞ new basic variable
at a value of 3.5
𝑍 = 25 − 5𝑠3 + 8𝑥2
𝑥2 is the entering variable

51
Example 1 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variables to get a new basic feasible solution
– Change the coefficient of all basic variables to be 1.
𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 } 𝐵2 = {𝑥2 , 𝑠2 , 𝑥1 }
2𝑥2 + 𝒔𝟏 − 𝑠3 = 7 𝒙𝟐 + 0.5𝑠1 − 0.5𝑠3 = 3.5
5𝑥2 + 𝒔𝟐 − 4𝑠3 = 20 −2.5𝑠1 + 𝒔𝟐 − 1.5𝑠3 = 2.5
𝟕 𝒔𝟑 𝒔𝟏
𝒙𝟐 = + −
𝒙𝟏 + 𝑠3 = 5 𝟐 𝟐 𝟐 𝒙𝟏 + 𝑠3 = 5
𝑍 = 25 − 5𝑠3 + 8𝑥2 𝑍 = 53 − 4𝑠1 − 𝑠3
𝐵2 = {𝑥2 , 𝑠2 , 𝑥1 }
𝒙𝟐 = 3.5 − 0.5𝑠1 + 0.5𝑠3
𝒔𝟐 = 2.5 + 2.5𝑠1 + 1.5𝑠3
𝒙𝟏 = 5 − 𝑠3
𝑍 = 53 − 4𝑠1 − 𝑠3 52
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)
• The non-basic variables are 𝑠1 and 𝑠3
• The coefficient of all non-basic variable are non-positive
• This basic solution is optimal

𝐵2 = {𝑥2 , 𝑠2 , 𝑥1 }
𝒙𝟐 + 0.5𝑠1 − 0.5𝑠3 = 3.5
−2.5𝑠1 + 𝒔𝟐 − 1.5𝑠3 = 2.5
𝒙𝟏 + 𝑠3 = 5
𝑍 = 53 − 4𝑠1 − 𝑠3
Optimal solution:
𝑥1∗ = 5, 𝑥2∗ = 3.5
All the coefficients of 𝑍 ∗ = 53
the non-basic
variables are negative
53
Example 1 (Summary of Stage 2)
Simplex method without Tableau form

𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 } Max 𝒁=𝟓𝒙𝟏 + 𝟖𝒙𝟐


𝑥1 + 2𝑥2 + 𝒔𝟏 = 12, 𝑠1 ≥ 0 requires 𝑥1 ≤12; s.t.
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40, 𝑠2 ≥ 0 requires 𝑥1 ≤ 10; 𝒙𝟏 + 𝟐𝒙𝟐 ≤ 𝟏𝟐
𝑥1 + 𝒔𝟑 = 5, 𝑠3 ≥ 0 requires 𝑥1 ≤ 5; 𝟒𝒙𝟏 + 𝟓𝒙𝟐 ≤ 𝟒𝟎
𝒙𝟏 ≤𝟓
𝑍 = 0 + 5𝑥1 + 8𝑥2 𝒙𝟏 , 𝒙𝟐 ≥ 𝟎
𝑥1 enters and 𝑠3 leaves

𝐵1 = {𝑠1 , 𝑠2 , 𝑥1 } 𝐵2 = {𝑥2 , 𝑠2 , 𝑥1 }
2𝑥2 + 𝒔𝟏 − 𝑠3 = 7, 𝑠1 ≥ 0 requires 𝑥2 ≤ 3.5 𝒙𝟐 + 0.5𝑠1 − 0.5𝑠3 = 3.5
5𝑥2 + 𝒔𝟐 − 4𝑠3 = 20, 𝑠2 ≥ 0 requires 𝑥2 ≤ 4 −2.5𝑠1 + 𝒔𝟐 − 1.5𝑠3 = 2.5
𝒙𝟏 + 𝑠3 = 5, 𝑥1 ≥ 0 requires 𝑥2 ≤ ∞ 𝒙𝟏 + 𝑠3 = 5
𝑍 = 25 − 5𝑠3 + 8𝑥2 𝑍 = 53 − 4𝑠1 − 𝑠3
𝑥2 enters and 𝑠1 leaves
Optimal solution:
𝑥1∗ = 5, 𝑥2∗ = 3.5, 𝑍 ∗ = 53 54
Simplex Method: Example 1
Graphical Illustration of Simplex Method

𝑥2
10
9
𝑍=5𝑥1 + 8𝑥2
8
7
6
5
4
3
2
1
0 𝑥1
0 1 2 3 4 5 6 7 8 9 10 11 12 13
55
Min Z = 𝑥1 + 𝑥2 − 3𝑥3
Example 2 s.t.
− 𝑥1 + 2𝑥2 − 𝑥3 ≥ -11
Initial basic feasible solution
2𝑥1 + 𝑥2 − 4𝑥3 ≥ 3
B0={𝑠1 , 𝑎1 , 𝑎2 } 𝑥1 − 2𝑥3 = 1
1 𝑥 , 𝑥 ,
2 3 𝑥 ≥ 0
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3 ⇒ 𝒂𝟏 = 3 − 2𝑥1 − 𝑥2 + 4𝑥3 + s2
𝑥1 − 2𝑥3 + 𝒂𝟐 = 1 ⇒ 𝒂𝟐 = 1 − 𝑥1 + 2𝑥3

𝑍′ = 0 − 𝑥1 − 𝑥2 + 3𝑥3 − 𝑀𝑎1 − 𝑀𝑎2


= 0 − 𝑥1 − 𝑥2 + 3𝑥3 − 𝑀 3 − 2𝑥1 − 𝑥2 + 4𝑥3 + s2
−𝑀 1 − 𝑥1 + 2𝑥3
= −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2 + −6𝑀 + 3 𝑥3 − 𝑀𝑠2

56
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

57
Example 2 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑥1 , 𝑥2 , 𝑥3 , 𝑠2


• The coefficients of the non-basic variables are 𝟑𝑴 − 𝟏, 𝑴 − 𝟏,
− 6𝑀 + 3, −𝑀; two of them are positive
• This basic solution is not optimal

B0={𝑠1 , 𝑎1 , 𝑎2 }
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3
𝑥1 − 2𝑥3 + 𝒂𝟐 = 1
𝑍′ = −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2 + −6𝑀 + 3 𝑥3 − 𝑀𝑠2

If the coefficient of any non-basic variable (its value = 0 at the present


extreme point) is positive, that means objective function can still be
increased, since the non-basic variable can be put into basic variable set
(to have a value ≥ 0 as a new basic variable at the next extreme point). 58
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

59
Example 2 (Stage 2)
Select an Entering Variable (Q3)

• Maximization problem
– Select the non-basic variable with a positive coefficient in the
objective function
• 𝑥1 is a non-basic variable with a positive coefficient

B0={𝑠1 , 𝑎1 , 𝑎2 }
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3
𝑥1 − 2𝑥3 + 𝒂𝟐 = 1
𝑍′ = −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2 + −6𝑀 + 3 𝑥3 − 𝑀𝑠2
𝒙𝟏 is the entering variable

60
Example 2 (Stage 2)
Decide the Leaving Variable (Q3)

• The leaving variable is the one that first goes to zero as the
value of the entering variable increases from zero
– Set 𝑥1 to the maximum while maintaining all variables non-negative.

B0={𝑠1 , 𝑎1 , 𝑎2 }
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11, 𝑠1 ≥ 0 requires 𝑥1 ≤ 11
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3, 𝑎1 ≥ 0 requires 𝑥1 ≤ 3Τ2
𝑥1 − 2𝑥3 + 𝒂𝟐 = 1, 𝑎2 ≥ 0 requires 𝑥1 ≤ 1 𝒂𝟐 leaving
𝑍′ = −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2 + −6𝑀 + 3 𝑥3 − 𝑀𝑠2

𝑥1 will replace 𝑎2 as
the new basic variable

61
Simplex Method: Processes of Simplex Method

Stage 1

• Q1: Check feasible solution

Stage 2

• Q2: Check optimal solution

• Q3: Determine entering and leaving variables

• Q4: Develop new simplex pivot

62
Example 2 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variable to get a new basic feasible solution
– Change the coefficient of all basic variables to be 1.
B0={𝑠1 , 𝑎1 , 𝑎2 }
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11
𝒙𝟏 = 1 + 2𝑥3 − 𝑎2
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3
𝑥1 − 2𝑥3 + 𝒂𝟐 =1
𝑍 = −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2
+ −6𝑀 + 3 𝑥3 − 𝑀𝑠2
B1={𝑠1 , 𝑎1 , 𝑥1 }
−𝑎2 − 2𝑥2 + 3𝑥3 + 𝒔𝟏 = 10
−2𝑎2 + 𝑥2 − 𝑠2 + 𝒂𝟏 = 1
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = − 𝑀 + 1 + −3𝑀 + 1 𝑎2 + 𝑀 − 1 𝑥2 + 𝑥3 − 𝑀𝑠2
63
Example 2 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑥2 , 𝑥3 , 𝑠2 , 𝑎2


• The coefficient of non-basic variable 𝑥2 is positive, 𝑀 − 1
• This basic solution is not optimal

B1={𝑠1 , 𝑎1 , 𝑥1 }
−𝑎2 − 2𝑥2 + 3𝑥3 + 𝒔𝟏 = 10
−2𝑎2 + 𝑥2 − 𝑠2 + 𝒂𝟏 = 1
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = − 𝑀 + 1 + −3𝑀 + 1 𝑎2 + 𝑀 − 1 𝑥2 + 𝑥3 − 𝑀𝑠2

64
Example 2 (Stage 2)
Select the Entering Variable and Leaving Variable (Q3)

• Select the non-basic variable with a positive coefficient


in the objective function
• The leaving variable is the one that first goes to zero as
the value of the entering variable increases from zero

B1={𝑠1 ,𝑎1 ,𝑥1 }


−𝑎2 − 2𝑥2 + 3𝑥3 + 𝒔𝟏 = 10, 𝑠1 ≥ 0 requires 𝑥2 ≤ +∞
−2𝑎2 + 𝑥2 − 𝑠2 + 𝒂𝟏 = 1, 𝑎1 ≥ 0 requires 𝑥2 ≤ 1 𝒂𝟏 leaving
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1, 𝑥1 ≥ 0 requires 𝑥2 ≤ +∞
𝑍′ = − 𝑀 + 1 + −3𝑀 + 1 𝑎2 + 𝑀 − 1 𝑥2 + 𝑥3 − 𝑀𝑠2
𝒙𝟐 entering

65
Example 2 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variables to get a new basic feasible solution
– Change the coefficient of all basic variables to be 1.
B1={𝑠1 ,𝑎1 ,𝑥1 }
−𝑎2 − 2𝑥2 + 3𝑥3 + 𝒔𝟏 = 10
𝒙𝟐 = 1 + 2𝑎2 + 𝑠2 − 𝑎1
−2𝑎2 + 𝑥2 − 𝑠2 + 𝒂𝟏 = 1
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = − 𝑀 + 1 + −3𝑀 + 1 𝑎2
+ 𝑀 − 1 𝑥2 + 𝑥3 − 𝑀𝑠2
B2={𝑠1 ,𝑥2 ,𝑥1 }
−5𝑎2 − 2𝑠2 + 3𝑥3 + 2𝑎1 + 𝒔𝟏 = 12
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = −2 + 𝑥3 − 𝑠2 + −𝑀 − 1 𝑎2 − 𝑀 − 1 𝑎1
66
Example 2 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑥3 , 𝑠2 , 𝑎1 , 𝑎2


• The coefficient of non-basic variable 𝑥3 is positive, 1
• This basic solution is not optimal

B2={𝑠1 ,𝑥2 ,𝑥1 }


−5𝑎2 − 2𝑠2 + 3𝑥3 + 2𝑎1 + 𝒔𝟏 = 12
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = −2 + 𝑥3 − 𝑠2 + −𝑀 − 1 𝑎2 − 𝑀 − 1 𝑎1

67
Example 2 (Stage 2)
Select the Entering Variable and Leaving Variable (Q3)

• Select the non-basic variable with a positive coefficient


in the objective function
• The leaving variable is the one that first goes to zero as
the value of the entering variable increases from zero

B2={𝑠1 ,𝑥2 ,𝑥1 }


−5𝑎2 − 2𝑠2 + 3𝑥3 + 2𝑎1 + 𝒔𝟏 = 12, 𝑠1 ≥ 0 requires 𝑥3 ≤ 4 𝒔𝟏 leaving
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1, 𝑥2 ≥ 0 requires 𝑥3 ≤ +∞
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1, 𝑥1 ≥ 0 requires 𝑥3 ≤ +∞
𝑍′ = −2 + 𝑥3 − 𝑠2 + −𝑀 − 1 𝑎2 − 𝑀 − 1 𝑎1
𝒙𝟑 entering

68
Example 2 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variable to get a new basic feasible solution
– Change the coefficient of all basic variables to be 1.
B2={𝑠1 ,𝑥2 ,𝑥1 }
−5𝑎2 − 2𝑠2 + 3𝑥3 + 2𝑎1 + 𝒔𝟏 = 12 5 2 2 1
𝒙𝟑 = 4 + 𝑎2 + 𝑠2 − 𝑎1 − 𝑠1
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1 3 3 3 3
𝑎2 − 2𝑥3 + 𝒙𝟏 = 1
𝑍′ = −2 + −𝑀 − 1 𝑎2 + 𝑀 − 1 𝑠2
− 𝑀 − 1 𝑎1 + 𝑥3 B3={𝑥3 ,𝑥2 ,𝑥1 }
5 2 2 1
− 𝑎2 − 𝑠2 + 𝑎1 + 𝑠1 + 𝒙𝟑 = 4
3 3 3 3
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1
7 4 4 2
− 𝑎2 − 𝑠2 + 𝑎1 + 𝑠1 + 𝒙𝟏 = 9
3 3 3 3
1 1 1 2
𝑍′ = 2 − 𝑠1 − 𝑠2 − 𝑀 − 𝑎 − 𝑀− 𝑎
3 3 3 1 3 2
69
Example 2 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)

• The non-basic variables are 𝑠1 , 𝑠2 , 𝑎1 , 𝑎2


• The coefficient of all non-basic variable are non positive;
hence this basic solution is optimal

B3={𝑥3 ,𝑥2 ,𝑥1 }


5 2 2 1
− 𝑎2 − 𝑠2 + 𝑎1 + 𝑠1 + 𝒙𝟑 = 4 Optimal solution:
3 3 3 3
−2𝑎2 − 𝑠2 + 𝑎1 + 𝒙𝟐 = 1 𝑥1∗ = 9, 𝑥2∗ = 1, 𝑥3∗ = 4
7 4 4 2 𝑍∗ = 2
− 𝑎2 − 𝑠2 + 𝑎1 + 𝑠1 + 𝒙𝟏 = 9
3 3 3 3
1 1 1 2
𝑍′ = 2 − 𝑠1 − 𝑠2 − 𝑀 − 𝑎 − 𝑀− 𝑎
3 3 3 1 3 2

70

You might also like