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

Simplex

Uploaded by

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

Simplex

Uploaded by

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

ISL 323E Operations Research

Fall 2024

Assoc. Prof. Dr. Fuat Kosanoğlu


ISL 323E Operations Research
Week V
31 October 2024
Simplex Algorithm
 A linear program consists of an objective function and constraints
 The constraints define the feasible region
◼ In 2 dimensions, we can draw the feasible region
 Find the optimal solution graphically using parallel lines
representing the objective function
 In higher dimensions, we can’t draw the feasible region, but the
intuition still holds
 The simplex method is the most common algorithm for solving LPs
 It is an algebraic method but it has a geometric interpretation
 We’ll discuss the geometric interpretation first

2/68
Simplex Algorithm
 The lines are the constraint boundaries.

Max Z= 3𝑥1+ 5𝑥2


s.t
𝑥1 ≤4
2𝑥2 ≤ 12
3𝑥1+ 2𝑥2 ≤ 18
𝑥1 ≥0
𝑥2 ≥ 0

3/68
Corner-Point Solutions

❑ 5corner-point feasible (CPF) solutions:


1. (0, 0)
2. (4, 0)
3. (4, 3)
4. (2, 6)
5. (0, 6)

4/68
Corner-Point Solutions

❑ 3 corner-point infeasible solutions:


6. (6, 0)
7. (0, 9)
8. (4, 6)

5/68
Corner-Point Solutions
 Each corner-point
solution (feasible or
infeasible) lies at the
intersection of two
constrains boundaries.
 For an LP with n
Decision Variables:
◼ Each corner-point
solution lies at the
intersection of n
constraint boundaries.

6/68
Adjacent CPFs
 For an LP with n decision
variables, two CPF solutions
are adjacent if they share
n − 1 constraint boundaries:
 Two adjacent CPF solutions
are connected by an edge of
the feasible region.
◼ (0,6) and (2,6) are adjacent.
◼ (2,6) and (4,3) are adjacent.

7/68
Property 1:
 If an LP has a single
optimal solution, it
is a CPF solution. If
an LP has more than
one optimal
solution, at least two
are CPF solutions.

8/68
How Many CPFs Are There?
 Property 1 means that we can focus only on CPF
solutions and ignore the rest of the feasible region.
 There are an infinite number of feasible solutions
◼ (assuming there are at least 2).
 There are a finite number of CPF solutions
◼ (assuming feasible region is bounded and there are a
finite number of constraints).
 That means we can focus on a much smaller set of
possible answers.
 Can we just examine every CPF?
9/68
How Many CPFs?
 If there are n decision variables and m functional
constraints, how many constraint boundaries are there?
 How many ways can we choose n constraint boundaries?
𝑚+𝑛 𝑚+𝑛 !

𝑛
=
𝑚!𝑛!

 If m = 50 and n = 50, there are 1029 CPFs to


examine
 If you could examine 1 billion CPFs per second, it
would take you 3, 170, 979, 198, 376 years to
examine all of the CPFs.

10/68
Property 2:
 If a CPF solution has no adjacent CPF solutions
that are better, then it must be an optimal solution.
 In other words, if we find a CPF solution with no
better neighbors, we can stop looking—there are
no better solutions anywhere.

11/68
Why is Property 2 true:?

12/68
Summary
 Taken together, Property1 and Property 2
mean we can find an optimal solution by:
1. Starting at any CPF solution
2. Moving to a better adjacent CPF solution, if one
exists
3. Continuing until the current CPF solution has no
adjacent CPF solutions that are better
4. This is the essence of the simplex method.

13/68
Simplex Method Example
 Initialization (Step 0):
Choose (0,0) as the initial
solution.
 (Even if we don’t have a
graphical picture, (0,0) is an
easy solution to find if it’s
feasible.)
 Optimality Test:
◼ Z(0,0) = 3*0 + 5*0= 0
◼ Z(0,6) = 3*0 + 5*6= 30
◼ Z(4,0) = 3*4 + 5*0= 12
◼ Therefore, (0,0) is not optimal.

14/68
Simplex Method Example
 Iteration 1: Move to a better
feasible solution:
◼ Either edge leads along an
improving direction. We’ll
pick the edge that leads up the
x2 axis.
◼ Stop when we hit the first
constraint boundary, 2x2 = 12.
 Optimality Test:
◼ Z(0,6) = 3*0 + 5*6= 30
◼ Z(2,6) = 3*2 + 5*6= 36
◼ Therefore, (0,6) is no optimal

15/68
Simplex Method Example
 Iteration 2: Move to a better
feasible solution:
◼ Only one edge moves along an
improving direction: 2x2 = 12.
◼ Stop when we hit the first
constraint boundary,
3x1 + 2x2 = 18.
2

 Optimality Test:
◼ Z(2,6) = 3*2 + 5*6= 36
◼ Z(4,3) = 3*4 + 5*3= 27
◼ Therefore, (2,6) is optimal.

16/68
Optimal Solution
 So the optimal solution to the this example is
(x1, x2) = (2, 6).
 The optimal objective value is 36.
 (This is the same solution we found using the
graphical method)

17/68
Finding CPF Solutions
 Suppose we didn’t label the coordinates on the
picture.
 In iteration 2, we need to find the CPF solution
that lies at the intersection of two constraints:
2𝑥2 =12
3𝑥1 + 2𝑥2 =18
◼ How can we find this solution?

18/68
Key Solution Concepts:
1. The simplex method focuses solely on CPF solutions.
2. The simplex method is an iterative algorithm:
◼ An algorithm is a sequence of steps to be followed
◼ An iterative algorithm is one whose steps are repeated until a desired
result has been obtained.
◼ Each repeated group of steps is called an iteration.
3. If possible, the simplex method is initialized using the
origin—that(𝑥1 ,…, 𝑥𝑛 )=(0,…,0)
◼ If n > 2, the graphical method doesn’t work, and finding a starting
solution may be tricky.
◼ The origin is an easy solution to find if it’s feasible.
◼ The origin may not be feasible.
 Why?
◼ If it’s feasible, the origin is a CPF.
19/68
Simpleks Simplex Flowchart Diyagramı

Initialization

Solution YES
Optimal?
STOP

N
O
Move to
Another Solution

20/68
Key Solution Concepts:
4. At each iteration, the simplex method only considers
CPFs that are adjacent to the current CPF.
◼ It is quicker computationally to find information about adjacent
CPFs than about non-adjacent CPFs.
◼ The path followed during the course of the algorithm is along
the edges of the feasible region.
5. If there are multiple improving edges from the current
CPF, the simplex method chooses the one with the
largest rate of improvement. It does not find the actual
adjacent solution until after it chooses the edge.

21/68
Rate of Improvement
 Rate of improvement = amount of change in Z for
each unit of movement along the edge.
◼ It may be positive (edge leads to a better solution)
◼ Or negative (edge leads to a worse solution)
◼ Or zero (edge leads to an equivalent solution)
 The solution at the end of the edge with the
largest rate of improvement may not be the best
adjacent CPF!
 This solution concept is designed to save
computation time.
22/68
Rate of Improvement
 Rate of improvement = 5
◼ Z= 3𝑥1 + 5𝑥2

23/68
Key Solution Concepts:
6. The optimality test consists of checking whether
any edge emanating from the current CPF has a
positive rate of improvement in Z. If not, the CPF is
optimal.

24/68
Simplex Method
 We examined the simplex method in a
geometric context.
 Computers can only understand algebraic
instructions.
 We need to formulate the simplex method as
a set of algebraic commands.
 The algebra of the simplex method relies all
of the functional constraints in the LP being
equality constraints.
25/68
Linear Programs in Standard Form
We say that a linear program is in standard form if the
following are all true:
1. Non-negativity constraints for all variables.
2. All remaining constraints are expressed as equality constraints.
3. The right hand side vector, b, is non-negative.

An LP not in Standard Form

maximize 3x1 + 2x2 - x3 + x4


x1 + 2x2 + x3 - x4  5; not equality

-2x1 - 4x2 + x3 + x4  -1; not equality


x1  0, x2  0 x3 may be negative

26/68
Converting Inequalities into
Equalities Plus Non-negatives

Before After
x1 + 2x2 + x3 - x4  5 x1 + 2x2 + x3 - x4 +s1 = 5
s1  0

s1 is called a slack variable, which measures the amount of “unused


resource.”
Note that s1 = 5 - x1 - 2x2 - x3 + x4.

To convert a “” constraint to an equality, add a


slack variable.

27/68
Converting “” constraints
 Consider the inequality -2x1 - 4x2 + x3 + x4  -1;
 Step 1. Eliminate the negative RHS
2x1 + 4x2 - x3 - x4  1
 Step 2. Convert to an equality
2x1 + 4x2 - x3 - x4 – s2 = 1
s2  0
 The variable added will be called a “surplus variable.”

To covert a “” constraint to an equality, subtract a


surplus variable.

28/68
More Transformations

How can one convert a maximization problem to a


minimization problem?
Example: Maximize 3x1 + 2x2
Subject to “constraints”
Has the same optimum solution(s) as

Minimize -3x1 - 2x2


Subject to “constraints”

29/68
Transformations
Transforming variables that may take on negative values.

maximize 3x1 + 4x2 + 5 x3


subject to 2x1 - 5x2 + 2x3 = 7
other constraints
x1  0, x2 is unconstrained in sign, x3  0

Transforming x1: replace x1 by y1 = -x1; y1  0.

max -3 y1 + 4x2 +5 x3
-2 y1 -5 x2 +2 x3 =7
y1  0, x2 is unconstrained in sign, x3  0

One can recover x1 from y1.

30/68
Transforming Variables That May Take On
Negative Values.
max -3 y1 + 4x2 +5 x3
-2 y1 -5 x2 +2 x3 =7
y1  0, x2 is unconstrained in sign, x3  0

e.g., y1 = 1, x2 = -1, x3 = 2 is feasible.

Transforming x2: replace x2 by x2 = y3 - y2; y2  0, y3  0.

max -3 y1 + 4(y3 - y2) +5 x3


-2 y1 -5 y3 +5 y2 +2 x3 =7
all vars  0

One can recover x2 from y2, y3.

e.g., y1 = 1, y2 = 0, y3 = 1 x3 = 2 is feasible.

31/68
EX 1: Leather Limited
 Leather Limited manufactures two types of belts:
the deluxe model and the regular model.
 Each type requires 1 sq yd of leather. A regular
belt requires 1 hour of skilled labor, and a deluxe
belt requires 2 hours. Each week, 40 sq yd of
leather and 60 hours of skilled labor are available.
Each regular belt contributes $3 to profit and each
deluxe belt, $4.
 Give the LP model for this problem.

32/68
EX 1: Solution
 Decision varibales:
◼ 𝑥1 = number of deluxe belts produced weekly
◼ 𝑥2 = number of regular belts produced weekly
 LP model:
max z = 4x1 + 3x2
s.t. x1 + x2 ≤ 40 (Leather constraint)
2x1 +x2 ≤ 60 (Labor constraint)
x1, x2 ≥ 0

33/68
Preview of the Simplex Algorithm
 A standard form LP is:

 Lets define :

 Constraints given above may be written as the system of equations


Ax = b

34/68
Basic and Nonbasic Variables
 Consider a system Ax = b of m linear equations in n variables
(assume n ≥m).
 A basic solution to Ax = b is obtained by setting n - m variables
equal to 0 and solving for the values of the remaining m variables.
This assumes that setting the n - m variables equal to 0 yields
unique values for the remaining m variables or, equivalently, the
columns for the remaining m variables are linearly independent.
 To find a basic solution to Ax = b, we choose a set of n - m
variables (the nonbasic variables, or NBV) and set each of these
variables equal to 0.
 Then we solve for the values of the remaining n - (n - m) = m
variables (the basic variables, or BV) that satisfy Ax = b.

35/68
Feasible Solutions
 Any basic solution in which all variables are
nonnegative is a basic feasible solution (or bfs).
 Theorem: A point in the feasible region of an LP
is an extreme point if and only if it is a basic
feasible solution to the LP.

36/68
Properties of Basic Feasible Solution
 Each variable is classified as basic or non-basic variable
 The number of basic variables are equals to number of
constraints
 The number non-basic variables equals to number of
variables (including surplus variables) minus number of
constraints .
 Non-basic variables are set to zero.
 The value of basic variables are found by solving the
equations.
 If basic variables are nonnegative, the solution is called
basic feasible solution.
37/68
Objective Function
 Writing the objective function as a constraint may
help in simplex algorithm. We call this format the
row 0 version of the objective function (row 0 for
short).
max Z
Z-(-3 y1 + 4(y3 - y2) +5 x3 )=0
-2 y1 - 5 y3 +5 y2 +2 x3 =7
all variables  0
 We treat Z as a normal variable.

38/68
Adjacent Basic Feasible Solutions
 For any LP with m constraints, two basic feasible
solutions are said to be adjacent if their sets of
basic variables have m - 1 basic variables in
common.

39/68
The Simplex Algorithm
Step 1: Convert the LP to standard form
Step 2: Obtain a bfs (if possible) from the standard form.
Step 3: Determine whether the current bfs is optimal.
Step 4: If the current bfs is not optimal, then determine
which nonbasic variable should become a basic variable
and which basic variable should become a nonbasic
variable to find a new bfs with a better objective function
value.
Step 5: Use elementary row operations (EROs) to find the
new bfs with the better objective function value. Go back
to step 3.
40/68
EX 2: Dakota Furniture Company
 The Dakota Furniture Company manufactures desks,
tables, and chairs. The manufacture of each type of
furniture requires lumber and two types of skilled
labor: finishing and carpentry. The amount of each
resource needed to make each type of furniture is
given in Table below.
Resource Desk Table Chair

Lumber (board ft) 8 board ft 6 board ft 1 board ft

Finishing hours 4 hours 2 hours 1.5 hours

Carpentry hours 2 hours 1.5 hours 0.5 hours

41/68
Ex 2 - Continue
 Currently, 48 board feet of lumber, 20 finishing
hours, and 8 carpentry hours are available.
 A desk sells for $60, a table for $30, and a chair
for $20.
 Dakota believes that demand for desks and chairs
is unlimited, but at most five tables can be sold.
Because the available resources have already
been purchased, Dakota wants to maximize total
revenue.

42/68
Ex2: Sol
 Decision variables :
◼ x1 = number of desks produced
◼ x2 = number of tables produced
◼ x3 = number of chairs produced
 LP model:
max z = 60x1 + 30x2 + 20x3
s.t. 8x1 + 6x2 + x3 ≤ 48 (Lumber constraint)
4x1 + 2x2 + 1.5𝑥3 ≤ 20 (Finishing constraint)
2x1 + 1.5x2 + 0.5x3 ≤ 8 (Carpentry constraint)
x2 ≤ 5 (Limitation on table demand)
x1, x2, x3 ≥ 0

43/68
Ex2: Sol-Cont.
 Convert the LP to Standard Form
 We have 4 constraints with “≤”, convert to standard
form:
◼ We add 𝑠1 , 𝑠2 , 𝑠3 and 𝑠4 to each constraint respectively.
 Standard form LP has 7 decision variable
with slack variables (𝑥1 , 𝑥2 , 𝑥3 , 𝑠1 , 𝑠2 , 𝑠3 ,
𝑠4 ).
 Now, we can work on simplex algorithm

44/68
Ex2: Sol-Cont.
 We write objective function as row 0 format.
 Putting rows 1–4 together with row 0 and the sign restrictions
yields the equations and basic variables shown below:

Row Canonical Form Basic


Variable

0 z – 60x1 – 30x2 – 20x3 =0 z=0

1 8x1 + 6x2 + x3 + s1 = 48 s1 = 48

2 4x1 + 2x2 + 1.5x3 + s2 = 20 s2 = 20

3 2x1 + 1.5x2 + 0.5x3 + s3 =8 s3 = 8

4 x2 + s4 =5 s4 = 5

45/68
Ex2: Sol-Cont.
 In Dakota example, we have 4 constraint, so we need 4
basic variables.
 We set 𝑠1 , 𝑠2 , 𝑠3 and 𝑠4 basic variables and 𝑥1 , 𝑥2 , 𝑥3 non-
basic variables.
 Since 𝑥1 , 𝑥2 , 𝑥3 are non-basic variable, we set their values to
zero.
 When we set 𝑥1 , 𝑥2 , 𝑥3 to zero, values of 𝑠1 , 𝑠2 , 𝑠3 and 𝑠4
can be found by solving each equation.
 The basic feasible solution for basic variables is equals to
right-hand side of the equations.

46/68
Ex2: Sol-Cont.
 Once we have obtained a basic feasible solution, we
need to determine whether it is optimal.
 If the bfs is not optimal, then we try to find a bfs
adjacent to the initial bfs with a larger z-value
 To do this, we try to determine whether there is any way
that z can be increased by increasing some non-basic
variable from its current value of zero while holding all
other non-basic variables at their current values of zero.
 If we solve for z by re- arranging row 0, then we obtain
◼ Z = 60x1 + 30x2 + 20x3

47/68
Ex2: Sol-Cont.
 For each non-basic variable, we can use objective
function to determine whether increasing a non-basic
variable (and holding all other non-basic variables at
zero) will increase z.
◼ Increasing any of the non-basic variables will increase z
◼ But, a unit increase in x1 causes the largest rate of increase in
z, we choose to increase x1 from its current value of zero.
◼ If x1 is to increase from its current value of zero, then it will
have to become a basic variable.
◼ For this reason, we call x1 the entering variable.
◼ Note that x1 has the most negative coefficient in row 0.
48/68
Determine the Entering Variable
 The equation below is row 0
Z -60𝑥1 -30𝑥2 -20𝑥3 –0𝑠1 -0𝑠2 -0𝑠3 -0𝑠4 = 0
 We can rewrite row 0.
Z = 60𝑥1 + 30𝑥2 + 20 𝑥3
 Current non-basic variables are 𝑥1 , 𝑥2 and 𝑥3 .
 Z is a function of non-basic variables.

49/68
Determine the Entering Variable
 If we increase the value of 𝑥1 by 1 unit while
holding 𝑥2 =𝑥3 =0, the value of Z increases by 60
◼ (Z=60.1+0+0=60)
 If we increase the value of 𝑥2 by 1 unit while
holding 𝑥1 =𝑥3 =0, the value of Z increases by 30
◼ (Z=0+30.1+0=30)
 If we increase the value of 𝑥3 by 1 unit while
holding 𝑥1 =𝑥2 =0, the value of Z increases by 20
◼ (Z=0+0+20.1=20)

50/68
Ex2: Sol-Cont.
 Which non-basic variable should be basic?
◼ We choose the entering variable (in a max problem) to
be the non-basic variable with the most negative
coefficient in row 0
◼ In other words the non-basic variable which makes the
largest increment in objective function.
◼ In this example a unit increase in 𝑥1 causes the largest
rate of increase in z, we choose to increase 𝑥1 from its
current value of zero. (𝑥1 becomes basic variable)
◼ 𝑥1 column is called pivot column

51/68
RHS

Pivot Column
52/68
Optimality Condition:
 A canonical form is optimal (for a max problem) :
◼ If each non-basic variable has a non- negative
coefficient in the canonical form’s row 0.
◼ If there is at least one non-basic variable with negative
coefficient, we choose the most negative one as
entering variable
◼ (The non-basic variable which makes the largest
increment in objective function.)

53/68
In Which Row Does the Entering Variable Become
Basic?
 𝑥1 is chosen as entering variable. Now, we need
to answer two question:
◼ One of current basic variable must be non-basic.
Which one?
◼ (𝑠1 , 𝑠2 , 𝑠3 , 𝑠4 ?)
◼ What is the maximum value 𝑥1 can take?
 In order to answer these questions, we use pivot
column and right hand side values.
 Note that all non-basic variables are zero.

54/68
In Which Row Does the Entering Variable
Become Basic?
 0.Z+8x1+6x2+x3+ s1+0s2+0s3 +0s4 =48
 From row 1, s1 =48- 8x1 (remember that x2= x3 = 0).
 Because the sign restriction s1 ≥ 0 must be
satisfied,
◼ We can only increase x1 as long as s1 ≥ 0 , or 48 -8x1 ≥
0,
48
◼ x1 ≤ =6
8
◼ The maximum value x1 can take is 6.
◼ If x1 takes any value larger than 6, s 1 becomes negative
55/68
In Which Row Does the Entering Variable
Become Basic?
 We do same thing for other rows to decide the maximum
value of 𝑥1 can take.
Row 1: for 𝑥1 ≤ 6 , 𝑠1 ≥ 0
Row 2: for 𝑥1 ≤ 5 , 𝑠2 ≥ 0
Row 3: for 𝑥1 ≤ 4 , 𝑠3 ≥ 0
Row 4: for every 𝑥1 , 𝑠4 ≥ 0
◼ This means that to keep all the basic variables nonnegative, the
largest that we can make is min{6, 5, 4}
◼ If we make 4≤ 𝑥1 , then 𝑠3 will become negative, and we will no
longer have a basic feasible solution.
◼ Therefore limiting row is row 3

56/68
RHS

Pivot Column RHS Column


57/68
Ratio Test
 When entering a variable into the basis, compute the ratio
in given below for every constraint in which the entering
variable has a positive coefficient.
𝑅𝑖𝑔ℎ𝑡 − ℎ𝑎𝑛𝑑 𝑠𝑖𝑑𝑒 𝑜𝑓 𝑟𝑜𝑤 𝑖
𝑐𝑜𝑒𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑜𝑓 𝑒𝑛𝑡𝑒𝑟𝑖𝑛𝑔 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝑖𝑛 𝑟𝑜𝑤 𝑖
 The constraint with the smallest ratio is called the winner
of the ratio test.
 The smallest ratio is the largest value of the entering
variable that will keep all the current basic variables
nonnegative.
 In our example, row 3 was the winner of the ratio test for
entering x1 into the basis.
58/68
The Ratio Test
 We do not calculate ratio for row that
entering variable coefficient is zero or
negative
◼ Because, the basic variable in this row will be
positive regardless of the value of entering
variable
◼ In other words, this row will not limit the value
of entering variable

59/68
Pivot Column

RHS

Row

Pivot Element Pivot Row


60/68
Ex 2: Sol-Cont.
 For 𝑥1 =4 , it must become a basic variable.
 When 𝑥1 =4 becomes, 𝑠3 will be zero, and 𝑠3 will be
non-basic variable.
 The new BFS objective function value Z’ :
◼ Z` =(initial z-value ) -(coefficient of entering variable in
row 0)x(the value of entering variable in ne BFS)
◼ Z`=(0) –(-60)x(4) = 0+240= 240

61/68
Find a New Basic Feasible Solution:
Pivot in the Entering Variable
 In each iteration of simplex algorithm, we move a
adjacent BFS which gives better objective function
value
◼ (If there is one)
 Two BFS is adjacent if (m-1) basic variable is
common.
 In previous BFS the basic variables were 𝑠1 , 𝑠2 , 𝑠3 and
𝑠4
 The new basic variables are 𝑠1 , 𝑠2 , 𝑥1 and 𝑠4
 Note that 3 (m-1) basic variables are same (𝑠1 , 𝑠2 , 𝑠4 ) .
62/68
Simplex Table for new BFS
 To make x1 a basic variable in row 3, we use elementary
row operations to make x1 have a coefficient of 1 in row
3 and a coefficient of 0 in all other rows.
 This procedure is called pivoting on row 3; and row 3 is
the pivot row.
 The term in the pivot row that involves the entering
basic variable is called the pivot term.
 We create new table by doing elementary row operations
(ERO)

63/68
Elementary Row Operations
 Let Ax=b be linear equations. A matrix (A,b) converted to
another matrix (A’,b’) by doing ERO, the solution of Ax=b
linear equations and A’x=b’ linear equations are said to be
equivalent.
 Type 1 ERO : A’ is obtained by multiplying any row of A
by a nonzero scalar.
 Type 2 ERO : Begin by multiplying any row of A (say,
row i) by a nonzero scalar c. For some 𝑖 ≠ 𝑗, let row j of
A’= c(row i of A) + row j of A,
◼ And let the other rows of A’ be the same as the rows of A.
 Type 3 ERO : Interchange any two rows of A.
64/68
Tableau for new BFS

𝑁𝑒𝑤 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝑃𝑖𝑣𝑜𝑡 𝑟𝑜𝑤 𝑃𝑖𝑣𝑜𝑡


= :
𝑝𝑖𝑣𝑜𝑡 𝑟𝑜𝑤 𝑒𝑙𝑒𝑚𝑒𝑛𝑡 𝑒𝑙𝑒𝑚𝑒𝑛𝑡

𝑁𝑒𝑤 𝑣𝑎𝑙𝑢𝑒 𝑂𝑙𝑑 𝑣𝑎𝑙𝑢𝑒 𝑜𝑓 𝐶𝑜𝑟𝑟𝑒𝑠𝑝𝑜𝑛𝑑𝑖𝑛𝑔 𝐶𝑜𝑟𝑟𝑒𝑠𝑝𝑜𝑛𝑑𝑖𝑛𝑔


𝑜𝑓 = 𝑟𝑜𝑤 − 𝑒𝑙𝑒𝑚𝑒𝑛𝑡 𝑖𝑛 × 𝑒𝑙𝑒𝑚𝑒𝑛𝑡 𝑖𝑛
𝑜𝑡ℎ𝑒𝑟 𝑟𝑜𝑤𝑠 𝑒𝑙𝑒𝑚𝑒𝑛𝑡 𝑛𝑒𝑤 𝑝𝑖𝑣𝑜𝑡 𝑟𝑜𝑤 𝑝𝑖𝑣𝑜𝑡 𝑐𝑜𝑙𝑢𝑚𝑛

65/68
Simplex Table for new BFS: ERO
 𝑟𝑜𝑤 3′ : Create a coefficient of 1 for x1 in row 3 by multiplying
row 3 by 0.5.
𝑥1 + 0.75𝑥2 + 0.25𝑥3 + 0.5𝑠3 = 4
 𝑟𝑜𝑤 0′ : To create a zero coefficient for x1 in row 0, replace row
0 with 60(row 3’ )+ row 0
𝑧 + 15𝑥2 − 5𝑥3 + 30𝑠3 = 240
 𝑟𝑜𝑤 1′ : To create a coefficient of 1 for x1 in row 1, replace row
1 with -8(row 3’) + row 1.
−𝑥3 + 𝑠1 − 4𝑠3 = 16
 𝑟𝑜𝑤 2′ : To create a coefficient of 1 for x1 in row 2, replace row
2 with -4(row 3’) + row 2.
−𝑥2 + 0.5𝑥3 + 𝑠2 − 2𝑠3 = 4

66/68
Simplex Table for new BFS: ERO
 Since x1 does not appear in row 4, we don’t need to perform an
ERO to eliminate x1 from row 4.
 𝑟𝑜𝑤 4′ : x2 +s4 =5

67/68
Row
RHS Calculation of new BFS
tableau: Step 1

Pivot row is multiplied by (1/2)


to make pivot element “1”,
and new row 3 is obtained

RHS

68/68
RHS Calculation of new BFS
tableau: Step 2
New pivot row is multiplied by
(60) and added to row 0 to
obtain new row 0

RHS

69/68
RHS
Calculation of new BFS
tableau: Step 3
New pivot row is multiplied
by (-8) and added to row 1 to
obtain new row 1

RHS

70/68
RHS
Calculation of new BFS
tableau: Step 4
New pivot row is multiplied
by (-4) and added to row 2 to
obtain new row 2

RHS

71/68
RHS
Calculation of new BFS
tableau: Step 5
New pivot row is multiplied
by (0) and added to row 4 to
obtain new row 4

RHS

72/68
RHS
Simplex tableau
after first iteration

Initial tableau

RHS

73/68
Gauss-Jordan Method
 The procedure we did is called Gauss-Jordan
Method
 The goal is utilizing ERO:
◼ Ensure that each basic variable shows up only one
row
◼ Also, make sure that the coefficient of this basic
variable is +1.

74/68
Columns corresponding to new basic variables

RHS

75/68
Optimality check for new BFS

RHS

In row 0, coefficient of a NBV is negative. This indicates,


there is a adjacent CFS with better objective function value.

76/68
Making X3 will yield a better solution

RHS

Pivot Column
77/68
Ratio test to determine leaving variable
RHS

min −, 8, 16, 0 = 8

78/68
X3 is entering and S2 is leaving variable

RHS

79/68
RHS
Calculation of
new BFS tableau

RHS

80/68
Columns corresponding to new basic variables

RHS

81/68
RHS
Simplex tableau
after second iteration

RHS

82/68
Optimality check for new BFS
RHS

Coefficients of all NBV’s are nonnegative at row 0


OPTIMAL SOLITION IS FOUND

83/68
Ex 2: Solution-Cont
 RHS values show the value of basic variables
 𝑠1 =24, 𝑥3 =8, 𝑥1 =2, 𝑠4 =5
 Remaining variables are non-basic, and take
zero value
 𝑠2 =𝑠3 =𝑥2 = 0
 RHS of the row 0 gives the optimum value of
Z (Z=280)

84/68
Ex 2: Solution-Cont
 In this model we have 4 slack variables. Slack
variables show the amount of unused
recourses.
 𝑠1 =24, 𝑠4 =5 , 𝑠2 = 0, 𝑠3 = 0
◼ S1=24: 24 board feet of lumber are not being used.
◼ S4=5: 0 tables are actually being produced
◼ S2= 0, S3= 0: all available finishing and carpentry hours
are being utilized, so the finishing and carpentry
constraints are binding.

85/68
Using the Simplex Algorithm to Solve
Minimization Problems ?
1)Convert LP in to standard form
2)Find a basic feasible solution
3)If all coefficients of non-basic variables in row 0
negative, then STOP. The solution is optimum.
If any coefficients of non-basic variables in row 0 positive,
then choose the variable with largest coefficient as the
entering variable.
4)Choose the basic variable that becomes non-basic
variable by doing ratio test.
5)Find new BFS by doing ERO. Go back to step 3

86/68
Using the Simplex Algorithm to Solve
Minimization Problems ?
 The other solution:
◼ Convert minimization problem to maximimization.
◼ In order to convert an min LP to max LP, we multiply
objective function to (-1)
◼ We do not change constrains

87/68
Big M Method
 We need a BFS for Simplex method
 In previous example, we find BFS by letting
slack variables be basic variables.
◼ If LP problem consists of ≥ or = constraints, finding
BFS may not be that easy.
 For this type of problems, one of the method is
big M method.

88/68
Example: Bevco
 Bevco manufactures an orange-flavored soft drink called Oranj by
combining orange soda and orange juice.
 Each ounce of orange soda contains 0.5 oz of sugar and 1 mg of
vitamin C.
 Each ounce of orange juice contains 0.25 oz of sugar and 3 mg of
vitamin C.
 It costs Bevco 2¢ to produce an ounce of orange soda and 3¢ to
produce an ounce of orange juice.
 Bevco’s marketing department has decided that each 10-oz bottle
of Oranj must contain at least 20 mg of vitamin C and at most 4 oz
of sugar.
 Use linear programming to determine how Bevco can meet the
marketing department’s requirements at minimum cost.
89/68
Solution
 x1 = number of ounces of orange soda in a bottle of Oranj
 x2 = number of ounces of orange juice in a bottle of Oranj

min z = 2x1 + 3x2


st 0.5x1 + 0.25x2 ≤ 4 (Sugar constraint )
x1 + 3x2 ≥ 20 (Vitamin C constraint )
x1 + x2 = 10 (10 oz in bottle of Oranj )
x1, x2 > 0

90/68
Solution: Standard LP

Row 1: Z - 2x1 - 3x2 =0


Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - s2 = 20
Row 4: x1 + x2 = 10

91/68
Solution
 In standard LP s1=4 could be used as a basic (and feasible) variable
for row1. If we multiply row2 by -1,we see that s2=-20 could be
used as a basic variable for row 2. But, s 2=-20 violates the sign
restriction s2 ≥ 0 . Also, in row 3 there is no readily apparent basic
variable.
Row 1: Z - 2x1 - 3x2 =0
Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - s2 = 20
Row 4: x1 + x2 = 10

 In order to use simplex method, we need a BFS:


◼ To remedy this problem, we introduce artificial variables

92/68
Solution
Row 1: z - 2x1 - 3x2 =0
Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - s2 + a2 = 20
Row 4: x1 + x2 +a3 = 10

 In optimal solution, the artificial variables must be zero.


◼ In a min problem, we can ensure that all the artificial
variables will be zero by adding a term Mai to the objective
function for each artificial variable ai.
◼ In a max problem, add a term - Mai to the objective function.
◼ M represents very large number.

93/68
Solution
Row 1: z - 2x1 - 3x2 -Ma2 - Ma3 =0
Row 2: 0.5x1 + 0.25x2 + s1 = 4
Row 3: x1 + 3x2 - s2 + a2 = 20
Row 4: x1 + x2 +a3 = 10

 Modifying the objective function in this way


makes it extremely costly for an artificial
variable to be positive.
 In this way, optimal values of artificial
variables becomes zero.
94/68
Steps of Big M Method:
1. Modify the constraints so that the right-hand side of each
constraint is non- negative. Identify each constraint that is
= or ≥ constraints. In step 3, we will add an artificial
variable to each of these constraints .
2. Convert each inequality constraint to standard form.
3. If constraint i is a ≥ or = constraint, add an artificial
variable ai. ( ai ≥ 0)
4. If the LP is a min problem, add (for each artificial
variable) Mai to the objective function. If the LP is a max
problem, add (for each artificial variable) -Mai to the
objective function
95/68
5. Because each artificial variable will be in the
starting basis, all artificial variables must be
eliminated from row 0 before beginning the
simplex.
 If in the optimum solution any artificial
variable is positive, then there is no feasible
solution.

96/68
Eliminate all Artificial Variables from Row 0

To eliminate basic variables from row 0:


New row Z = row Z + M(row 2)+ M(row 3)

97/68
Solution

98/68
Solution
 The optimal solution : z=25, x1=x2 = 5,
s1=1/4, s2=0.

99/68
The Two-Phase Simplex Method
 When a basic feasible solution is not readily
available, the two-phase simplex method may be
used as an alternative to the Big M method
 We add artificial variables to the same constraints
as we did in the Big M method
 Then we find a bfs to the original LP by solving the
Phase I LP

100/68
The Two-Phase Simplex Method
 Phase I: The objective function is to minimize
the sum of all artificial variables. We find out
whether there is a feasible solution.

 Phase II: Using simplex, we find out if there is a


optimal solution.

101/68
The Two-Phase Simplex Method
1. Modify the constraints so that the right-hand side of each
constraint is nonnegative. Identify each constraint that is now
(after step 1) an = or ≥ constraint.
2. Convert each inequality constraint to the standard form. If
constraint i is a ≤ constraint, then add a slack variable si. If
constraint i is a ≥ constraint, subtract an excess variable ei.
3. If (after step 1 ) constraint i is a ≥ or = constraint, add an artificial
variable ai. Also add the sign restriction ai ≥ 0.
4. For now, ignore the original LP’s objective function. Instead
solve an LP whose objective function is min 𝑤 ′ =(sum of all the
artificial variables) (𝑤 ′ = σ𝑖 𝑎𝑖 )
◼ This is called the Phase I LP. The act of solving the Phase I LP will force
the artificial variables to be zero.

102/68
Two-Phase Simplex Method: Resulting Cases
 Case 1: The optimal value of 𝑤 ′ is greater than zero. In
this case, the original LP has no feasible solution.
 Case 2: The optimal value of 𝑤 ′ is equal to zero, and no
artificial variables are in the optimal Phase I basis.
◼ In this case, we drop all columns in the optimal Phase I tableau
that correspond to the artificial variables.
◼ We now combine the original objective function with the
constraints from the optimal Phase I tableau.
◼ This yields the Phase II LP.
◼ The optimal solution to the Phase II LP is the optimal solution to
the original LP.

103/68
Two-Phase Simplex Method: Resulting Cases
 Case 3: The optimal value of 𝑤 ′ s equal to zero
and at least one artificial variable is in the optimal
Phase I basis.
◼ In this case, we can find the optimal solution to the
original LP if at the end of Phase I we drop from the
optimal Phase I tableau all nonbasic artificial variables
and any variable from the original problem that has a
negative coefficient in row 0 of the optimal Phase I
tableau.

104/68
Example: Bevco
 x1 = number of ounces of orange soda in a bottle of Oranj
 x2 = number of ounces of orange juice in a bottle of Oranj

min z = 2x1 + 3x2


st 0.5x1 + 0.25x2 ≤ 4 (Sugar constraint )
x1 + 3x2 ≥ 20 (Vitamin C constraint )
x1 + x2 = 10 (10 oz in bottle of Oranj )
x1, x2 > 0

105/68
Solution: Standard LP

Row 0: Z - 2x1 - 3x2 =0


Row 1: 0.5x1 + 0.25x2 + s1 = 4
Row 2: x1 + 3x2 - e2 = 20
Row 3: x1 + x2 = 10

106/68
Solution- Cont.
 Add artifical variables (the 1-3 steps are same as Big M)
Row1: 0.5x1 + 0.25x2 + s1 = 4
Row 2: x1 + 3x2 - e2 + a2 = 20
Row 3: x1 + x2 +a3 = 10
 Step 4: The objective function is replaced with min 𝑤 ′
min 𝑤 ′ = a2 + a3
Row 0: 𝑤 ′ - a2 - a3 =0
 As in the Big M method, a2 and a3 must be eliminated from row
0 before we can solve Phase I.
 To eliminate a2 and a3 from row 0, simply add row 2 and row 3
to row 0:
107/68
Solution- Cont.
 Phase 1: Initial Tableau

 Phase 1: Iteration 1

108/68
Solution- Cont.
 Phase 1: The optimal tableau

 Since 𝑤 ′ =0 and there is no artificial variable in the basis,


the tableau is optimal. Phase II requires no pivots to find
an optimal solution. If the Phase II row 0 does not
indicate an optimal tableau, then simply continue with the
simplex until an optimal row 0 is obtained.
109/68
Two-Phase Simplex: Case I
 Modify Bevco’s problem so that 36 mg of vitamin
C are required.

110/68
Two-Phase Simplex: Case I

 No variable in row 0 has a positive coefficient, so


this is an optimal Phase I tableau, and since the
optimal value of 𝑤 ′ is 6 > 0, the original LP must
have no feasible solution.
111/68
Two-Phase Simplex: Case 3
 Use the two-phase simplex method to solve the
following LP:
Max Z = 40x1 +10x2 + 7x5 +14x6
x1 - x2 + 2x5 =0
-2x1 + x2 - 2x5 =0
x1 +x3 +x5 + x6 =3
2x2 +x3+ x4+2x5 + x6 =4
All xi ≥0

112/68
Two-Phase Simplex: Case 3

113/68
Two-Phase Simplex: Case 3

114/68
At the end of Simplex Algorithm we may have:
1. No feasible solution
2. Single optimum solution
3. Multiple optimum solution
4. Unbounded solution
5. Degenerate solution
6. Unbounded feasible reagion

115/68
No feasible solution
 If we can not find a starting BFS or in
optimum simplex tableau artificial variables
are not zero, then LP has no feasible solution.

116/68
Bevco Example
 Modify the Bevco problem by requiring that a 10-oz bottle of Oranj
contain at least 36 mg of vitamin C. Even 10 oz of orange juice contain
only 3(10) = 30 mg of vitamin C, so we know that Bevco cannot possibly
meet the new vitamin C requirement.

min z = 2x1 + 3x2


St. 0.5x1 + 0.25x2 ≤ 4 (sugar constraint)
x1 + 3x2 ≥ 36 (vitamin C constraint)
x1 + x2 = 10 (10 OZ constraint)
x1, x2, > 0

117/68
❑ Z zero
Row satırına bakıldığında
indicates tablonun
an optimal optimum
tableau. olduğu görülüyor.
However, the value Ancak
value of
𝑎2 yapay
artificial değişkeni
variable a2 ispozitif değer
positive. aldığı için,LP
Therefore, DP’nin
has nouygun çözümü
feasible yoktur
solution.
118/68
Single Optimal Solution
 If there is no nonbasic variable with a zero
coefficient in row 0 of the optimal tableau,
then the LP has a unique optimal solution.

119/68
Single Optimal Solution

 All coefficient of nonbsic variable are


nonzero. Therefore, there is single optimal
solution.
120/68
Alternative Optimal Solutions
 If in our optimal tableau, there is a
nonbasic variable has a zero coefficient
in row 0, there may be multiple optimum
solutions.
 It can be shown that any point on the line
segment joining two optimal extreme
points will also be optimal

121/68
Alternative Optimal Solutions

Although, X2 is nonbasic variable, coefficient in row 0 is 0.


122/68
Alternative Optimal Solutions

 𝑥2 becomes basic and 𝑥1 becomes nonbasic variable

123/68
124/68
Unbounded LPs
 An unbounded LP for a max problem occurs
when a variable with a negative coefficient in
row 0 has a nonpositive coefficient in each
constraint.
 If an LP is unbounded, one will eventually
come to a tableau where one wants to enter a
variable into the basis, but the ratio test will
fail.
 This is probably the easiest way to spot an
unbounded LP.
125/68
❑ We can see that 𝑥3 is the entering.
❑ But which basic variable will become nonbasic?

126/68
Degeneracy of the Simplex Algorithm
 An LP is degenerate if it has at least one bfs
in which a basic variable is equal to zero.

127/68
Degeneracy of the Simplex Algorithm

128/68
Unbounded Feasible Region
 This is not same as unbounded LP
 In oreder to understand if an LP has a unbounded
feasible region, we look at constraint rows of
simplex table.
 If any column has coeficient of zero or negative,
then feasible region is unbounded

129/68
 Row 0 indicates the solution is optimal.
 Elements of column 𝑠1 are negative or zero.
 This implies unbounded feasible region.

130/68

You might also like