Transcript Document

Chapter 3
The Simplex Method and Sensitivity
Analysis
Doua Nassar
1
Simplex Method
- Also called simplex technique or simplex algorithm
- It is universal that is any linear model for which the
solution exists can be solved by simplex method
- The simplex method attempts to move from one
corner point of the solution space to a better corner
point until the optimum is found
Doua Nassar
2
3.1 LP model in equation form (standard
form)
- All variables are non-negative
- The right-hand side of each constraint is
non-negative
- All constraints are expressed as equations (=)
- Objective function may be of maximization or
minimization type
- Unrestricted variables or unconstrained variables
Doua Nassar
3
3.1.1 Converting Inequalities into Equations
with Non-negative Right-hand side
Two types of variables:
i) Slack or unused variable (inequality <)
ii) Surplus or extra variable (inequality >)
Doua Nassar
4
i) Slack or unused variable (inequality <):
- The difference between the Right-Hand Side (R.H.S) and Left-Hand Side (L.H.S) of
the (inequality <) constraint thus yields the unused or slack amount of the resource.
R.H.S - L.H.S = slack or unused amount
- To convert the (inequality <) to an equation (=), a non-negative slack variable is
added to the left-hand side of the constraint.
Example of Reddy Mikks model:
Constraint of raw material M1,
(L.H.S) 6x1 + 4x2 < 24 (R.H.S)
Let s1 be the slack or unused amount of raw material M1,
(L.H.S) 6x1 + 4x2 + s1 = 24 (R.H.S)
s1 > 0 (non-negative slack variable)
or 24 - (6x1 + 4x2 ) = s1
Doua Nassar
5
ii) Surplus or extra variable (inequality >):
- The difference between the Left-Hand Side (L.H.S) and Right-Hand Side(R.H.S)
of the (inequality >) constraint thus yields the surplus or extra amount of the
resource.
L.H.S - R.H.S = surplus or extra amount
- To convert the (inequality >) to an equation (=),a non-negative surplus variable is
subtracted from the left-hand side of the constraint.
Example:
(L.H.S) 5x1 + 7x2 > 30 (R.H.S)
Let s2 be the surplus or extra amount ,
(L.H.S) 5x1 + 7x2 - s2 = 30 (R.H.S)
s2 > 0 (non-negative surplus variable)
or 5x1 + 7x2 - 30 = s2
Doua Nassar
6
Right-hand side of the constraint to be non-negative:
Example:
First method:(L.H.S) - 3x1 + 2x2 > -15 (R.H.S)
Convert to equation (=),
(L.H.S) - 3x1 + 2x2 - s1 = -15 (R.H.S)
s1
> 0
Multiply both sides of the equation by -1 to get non-negative right-hand side ,
3x1 - 2x2 + s1 = 15
1
Second method:(L.H.S) - 3x1 + 2x2 > -15 (R.H.S)
Multiply both sides of the constraint by -1 to get non-negative right-hand side ,
(L.H.S) 3x1 - 2x2 < 15 (R.H.S)
Convert to equation (=),
3x1 - 2x2 + s1 = 15
2
s1
Both equation
> 0
1 and equation
2 are same.
Doua Nassar
7
3.1.2 Dealing with unrestricted or unconstrained variables
- Unrestricted or unconstrained variables can be either positive ,
negative or zero.
- If a variable is unrestricted or unconstrained, it is expressed as the
difference between two non-negative variables.
- If x2 is unrestricted variable then it can be expressed as the
difference between y1 non-negative variable and y2 non-negative
variable,
x2 = y1 – y2 where y1 > 0 and y2 > 0
Value of x2 unrestricted variable is either positive ,
zero or negative depending upon whether y1 is larger , equal to or
smaller than y2 .
Doua Nassar
8
Example:
Express the following LP problem in the standard form:
Maximize z = 4x1 + 6x2 + 2x3
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7x3 < 8
4x1 - 10x2 + 2x3 > 3
x1 > 0 , x 2 > 0
Solution:
x1 and x2 are restricted to be non-negative variables while x3 is unrestricted variable.
Let x3 = y1 – y2 where y1 > 0 and y2 > 0 , then above LP problem can be written as,
Here
Maximize z = 4x1 + 6x2 + 2(y1 – y2)
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7(y1 – y2) < 8
4x1 - 10x2 + 2(y1 – y2) > 3
x1 > 0 , x2 > 0, y1 > 0, y2 > 0
Doua Nassar
9
or
Maximize z = 4x1 + 6x2 + 2y1 – 2y2
subject to
2x1 + 5x2 < 6
x1 + 9x2 - 7y1 + 7 y2 < 8
4x1 - 10x2 + 2y1 –2 y2 > 3
x1 > 0 , x2 > 0, y1 > 0, y2 > 0
Including slack and surplus variables, the standard form is ,
Maximize z = 4x1 + 6x2 + 2y1 – 2y2
subject to
2x1 + 5x2 + s1 = 6
x1 + 9x2 - 7y1 + 7 y2 + s2
= 8
4x1 - 10x2 + 2y1 –2 y2 - s3 = 3
x1 > 0 , x2 > 0, y1 > 0, y2 > 0 , s1 > 0 , s2 > 0 , s3 > 0
Doua Nassar
10
3.2 Transition from Graphical to Algebraic
Solution
- LP Solution by Graphical method is obtained
by the corner points of the feasible space
satisfying all the constraints.
- For transition from graphical to algebraic
method , the solution space is represented by
m simultaneous linear equations and
n non- negative variables.
Doua Nassar
11
In algebraic representation:
• The number of equations m is always less than or equal to the
number of variables n .
• If m=n , and the equations are consistent, the system has only one
solution.
e.g. The equation x = 2 has m=n=1 , the solution is
unique.
• If m < n (which represents the majority of LPs), then the system of
equations , again if consistent, will yield an infinite number of
solutions .
e.g. The equation x + y =1 has m=1 and n=2, it yields an
infinite number of solutions (any point on the line
x + y = 1 is a solution).
• If the number of equations m is larger than the number of variables
n, then at least m – n equations must be redundant.
Doua Nassar
12
Below gives a parallel steps for the algebraic
and graphical method of solutions:
Doua Nassar
13
Algebraic Determination of Corner Points
- The LP solution space is represented algebraically by finding the
candidates (corner points) for the optimum.
- The corner points are determined by the simultaneous linear
equations as follows:
In a set of m x n (m < n) where m = number of equations and n =number of
non-negative variables) ,
* set (n – m) variables equal to zero
* solve the m equations for the remaining from n variables
* if solution is unique, or there may be more
solutions , it is called basic solution , but they
must correspond to the corner points (feasible
or infeasible) of the solution space.
* the maximum number of Corner Points or basic solutions (feasible or
infeasible) can be determined by the formula,
Doua Nassar
14
To understand the above points, let us solve.
Example 3.2-1
Consider the following LP with two variables:
Maximize
subject to
z = 2x1 + 3x2
2x1 + x2 < 4
X1 + 2x2 < 5
X1 , x2 > 0
Note:
Example 3.2-1 is explained by the file names Example
3.2-1 part 1 , Example 3.2-1 part 2 and Example 3.2-1
part 3 .
Doua Nassar
15
Some important definitions:Solution:
A set of variables xj (j = 1,2,3,4,……n) is called a
solution to the LP problem if it satisfies the constraints.
Feasible Solution:
A set of variables xj (j = 1,2,3,4,……n) is called a
feasible solution to the LP problem if it satisfies the constraints
as well as non-negativity restrictions xj > 0 (j = 1,2,3,4,……n) , si >
0 (i = 1,2,3,4,……m) .
Non-Basic Variables:
Set (n – m) variables equal to zero are called non-basic variables.
Basic Variables:
The values of remaining from n variables (some of them may be
zero) are called basic variables.
Doua Nassar
16
Basic Solution:
A solution obtained by setting (n – m) variables equal to zero
and solving of remaining from n variables (some of them may
be zero) is called a basic solution . (Together non-basic variables
and basic variables give a basic solution).
Basic Feasible Solution:
A basic solution which is feasible, is said to be a basic feasible
solution.
Non-Degenerate Basic Feasible Solution:
It is a basic feasible solution in which all the basic variables are
positive or non-zero ( value of basic variable > 0) .
Degenerate Basic Feasible Solution:
It is a basic feasible solution in which one or more of the basic
variables are equal to zero ( value of basic variable = 0) .
Doua Nassar
17
Optimal Solution:
A basic feasible solution is said to be optimal if it optimizes the
objective function.
Convex Set in Linear Programming (LP):
The feasible solution space is said to form a convex set, if for any
two feasible points in the set ,the line segment joining any two
feasible points lies entirely in the set.
Extreme Point (Corner Point):
Every basic feasible solution of a LP is an extreme point of the
convex set of feasible solutions and every extreme point is a basic
feasible solution of the set of the constraints.
Doua Nassar
18
Convex set
Doua Nassar set
Non-convex
19
3.3 The Simplex Method
- Algebraically method finds all the basic
solutions or corner points of the LP problem.
- The Simplex method only finds few of the
basic solutions or corner points of the LP
problem.
Doua Nassar
20
3.3.1 Iterative Nature of the Simplex Method
For maximize z:
-Normally , the simplex method starts at the origin (0,0)
where x1 = 0 , x2 = 0 . Both x1 and x2 are non-basic
variables.
- At this starting point the value of the objective
function z = 0 .
- In an objective function z it is to be decided which of
the two non-basic variables above their current zero
values can improve (increase) the value of z.
- In simplex method one non-basic variable is increased
at a time.
- The non-basic variable which has the largest rate of
improvement in z is selected.
Doua Nassar
21
For minimize z:
- Both x1 and x2 are non-basic variables.
- In an objective function z it is to be decided
which of the two non-basic variables can improve
(decrease) the value of z.
- In simplex method one non-basic variable is
decreased at a time.
- The non-basic variable which has the smallest
rate of improvement in z is selected.
- Either x1 or x2 will be selected in the objective
function z which has the smallest rate of
improvement .
Doua Nassar
22
Example 3.2-1:
Maximize z = 2x1 + 3x2
- The objective function z shows that an increase
in either x1 or x2 or both above their current
zero values will improve(increase) the value of z.
- The rate of improvement in z is 2 for x1 and 3 for
x2 .
- We therefore select to increase x2 , the variable
with the largest rate of improvement.
Doua Nassar
23
Doua Nassar
24
Figure 3.4
Iterative process of the simplex method of Example 3.2-1
Doua Nassar
25
- The figure 3.4 shows that the value of x2 will be increased
from point A origin until corner point B is reached.
- At point B simplex method will then increase the value of
x1 to reach the improved corner point C, which is the
optimum.
- The path of the simplex method is thus defined
as A
B
C .
- Each corner point along the path is associated
with an iteration.
- Simplex method moves alongside the edges of the solution
space which means that the method cannot cut across the
solution space, for example going from A to C directly
cannot be done.
Doua Nassar
26
- We need to make transition from graphical solution
to the algebraic solution by showing how the points
A , B and C are represented by their basic and nonbasic variables .
- The following table summarizes these
representations:
Corner point
A
B
C
Basic variables
s1 , s2
s1 , x 2
x1, x2
Non-basic (zero) variables
x1, x2
x1, s2
s1 , s2
Doua Nassar
27
- We can notice that there is a change pattern in the
basic and non-basic variables as the solution
moves along the path A
B
C.
- In simplex method there are entering and leaving
variables.
- Entering variable means that variable which is
going from non-basic variable to basic variable.
- Leaving variable means that variable which is
going from basic variable to non-basic variable.
Doua Nassar
28
- From A to B
solution .
- From A to B
solution .
- From B to C
solution .
- From B to C
solution .
Corner point
A
B
C
x2 is the entering variable because it enters the basic
s2 is the leaving variable because it leaves the basic
x1 is the entering variable because it enters the basic
s1 is the leaving variable because it leaves the basic
Basic variables
s1 , s2
s1 , x2
x1, x2
Non-basic (zero) variables
x1, x2
x1, s2
s1 , s2
Note:
Path of three examples has been explained by the file name Three
examples of path .
Doua Nassar
29
3.3.2 Computational Details of the Simplex
Algorithm
- The computational details of a simplex iteration explains rules
for determining the entering and leaving variables as well as
for stopping the computations when the optimum solution has
been reached.
Example 3.3-1
Note:
Example 3.3-1 has been explained by the file names Example
3.3-1 part 1 , Example 3.3-1 part 2 , Example 3.3-1 part 3 ,
Example 3.3-1 part 4 and Example 3.3-1 part 5 .
Doua Nassar
30
Example 3.3-2
Find all the basic solutions to the following
problem. Also find which of the basic solutions
are (i) basic feasible solution (ii) non-degenerate
basic feasible solution (iii) optimal basic feasible
solution.
Maximize z = x1 + 3x2 + 3x3
subject to
1
x1 + 2x2 + 3x3 = 4
2
2x1 + 3x2 + 5x3 = 7
x1 , x2 , x3 > 0
Doua Nassar
31
Solution:
- Here m = 2 ( number of equations) , n = 3
(number of non-negative variables) .
- Total number of corner points or basic solutions are,
C = 3!___ =
3!___ = 3 X 2 X 1_ = 3
2!(3-2)!
2! 1!
2X1X1
- Number of non-basic variables are,
n–m =3–2=1
- When x1 = 0 (non-basic variable), then x2 and x3 are basic
variables.
1 and
2to
Put x1 = 0 in equations
get values of x2 and x3 ,
1
x1 + 2x2 + 3x3 = 4
2
2x1 + 3x2 + 5x3 = 7
Doua Nassar
32
Now equations become,
1’
2x2 + 3x3 = 4
2’
3x2 + 5x3 = 7
2’ by 2 ,
Multiply eq 1’ by 3 and eq
1’’
6x2 + 9x3 = 12
2’’
6x2 + 10x3 = 14
Subtract eq 1’’ from eq
2’’ ,
2’’
6x2 + 10x3 = 14
+ 6x2 + 9x3 = +12 1’’
___________________
x3 = 2
Doua Nassar
33
Put x3 = 2 in eq 1’ to get value of x2,
1’
2x2 + 3x3 = 4
2x2 + 3(2) = 4
2x2 + 6 = 4
2x2 = 4 – 6
x2 = -2
2
x2 = -1
Therefore x1 = 0 , x2 = -1 and x3 =2
Doua Nassar
34
- When x2 = 0 (non-basic variable), then x1 and x3 are
basic variables.
1 and
2to
Put x2 = 0 in equations
get values of x1 and x3 ,
1
x1 + 2x2 + 3x3 = 4
2
2x1 + 3x2 + 5x3 = 7
Now equations become,
1’
x1 + 3x3 = 4
2’
2x1 + 5x3 = 7
Doua Nassar
35
Multiply eq 1’ by 2 ,
2x1 + 6x3 = 8
1’’
Subtract eq
2’ from eq
1’’,
1’’
2x1 + 6x3 = 8
+ 2x1 + 5x3 = + 7
2’
___________________
x3 = 1
Put x3 = 1 in eq
1’to get value of x1,
1’
x1 + 3x3 = 4
x1 + 3(1) = 4
x1 + 3 = 4
x1 = 4 – 3
x1 = 1
Therefore x1 = 1 , x2 = 0 and x3 = 1
Doua Nassar
36
- When x3 = 0 (non-basic variable), then x1 and x2 are
basic variables.
1 and
2 to
Put x3 = 0 in equations
get values of x1 and x2 ,
1
x1 + 2x2 + 3x3 = 4
2
2x1 + 3x2 + 5x3 = 7
Now equations become,
1’
x1 + 2x2 = 4
2’
2x1 + 3x2 = 7
Multiply eq 1’ by 2 ,
1’’
2x1 + 4x2 = 8
Doua Nassar
37
Subtract eq 2’ from eq
1’’,
1’’
2x1 + 4x2 = 8
+ 2x1 + 3x2 = + 7
2’
__________________
x2 = 1
Put x2 = 1 in eq
1’to get value of x1,
1’
x1 + 2x2 = 4
x1 + 2(1) = 4
x1 + 2 = 4
x1 = 4 – 2
x1 = 2
Therefore x1 = 2 , x2 = 1 and x3 = 0
Doua Nassar
38
Serial Non-basic Basic
Basic
Basic Non-degenerate
number variables variables solution feasible basic feasible
solution solution
Objective
value
z_____
1
x1
(x2, x3) (-1,2)
No
No
-
2
x2
(x1, x3) (1 ,1)
Yes
Yes
4
3
x3
(x1, x2) (2, 1)
Yes
Yes
5
Optimal basic feasible solution is number 3 which gives
maximize z = 5 where x1 = 2 , x2 = 1 and x3 = 0 .
Doua Nassar
39
Example: Find the solution of the LP problem
algebraically.
Max Z=2x1+3x2
ST.
2x + x 2 < 4
1
x1 + 2x2 < 5
x1 , x2 > 0
Doua Nassar
40
Doua Nassar
41
Example:
Solve the following LP problem by simplex
method.
Max z = 5x1
-
4x2
subject to
6x1 + 4x2 < 24
x1
-x1
- 2x2
+ x2
<6
<1
x2 < 2
x1 , x 2 > 0
Doua Nassar
42
Solution:
1- Convert constraints to equation or standard form.
Max z = 5x1
- 4x2
subject to
6x1 + 4x2 + s1 = 24
x1 - 2x2 + s2 = 6
-x1 + x2 + s3 = 1
x2 + s4 = 2
x1 , x2 , s1 , s2 , s3 , s4 > 0
Doua Nassar
43
2- Put the coefficient of equation in a table
Basic
X1
X2
S1
S2
S3
S4
Sol.
RH
S
S1
6
4
1
0
0
0
24
S2
1
2
0
1
0
0
6
S3
-1
1
0
0
1
0
1
S4
0
1
0
0
0
1
2
z
-5
-4
0
0
0
0
0
Doua Nassar
44
3- Determine Entering variable.
Entering variable - max negative number in the objective
Entering variable
Basic
X1
X2
S1
S2
S3
S4
Sol.
RH
S
S1
6
4
1
0
0
0
24
S2
1
2
0
1
0
0
6
S3
-1
1
0
0
1
0
1
S4
0
1
0
0
0
1
2
z
-5
-4
0
0
0
0
0
Doua Nassar
45
4- Find the Leaving variable
Calculate Sol col. / Pivot col. (entering variable)
Take the smallest positive value
Entering variable
Basic
Sol/
Sol.
RH Pivot col.
S
X1
X2
S1
S2
S3
S4
S1
6
4
1
0
0
0
24
4
S2
1
2
0
1
0
0
6
6
S3
-1
1
0
0
1
0
1
-1
S4
0
1
0
0
0
1
2
z
-5
-4
0
0
0
0
0 No Need
Doua Nassar
Leaving variable
46
5- Find the Pivot value , Pivot Element
Pivot Value= Entering Variable Col
Leaving Variable Row
Pivot Element = Leaving variable Row / Pivot value
Pivot Value = 6
Pivot Element = (6, 4, 1, 0, 0, 0, 24) / 6
=( 1, 4/6, 1/6, 0, 0, 0, 4)
Doua Nassar
47
6- Gauss-Jordan row operations:
1. Replace the leaving variable in the Basic column with the
entering variable.
2. All other rows , including z:
New row = Current row
row)}
– {(Pivot column co-efficient) X (New pivot
- s2 -row:
(1, 2, 0, 1, 0, 0, 6) – (1)(1 , 4/6, 1/6, 0,0,0,4)
= (0, 4/3, -1/6, 1, 0, 0, 2)
Make it for all rows THE RESULT…..
Doua Nassar
48
Basic
X1
X2
S1
S2
S3
S4
Sol.
RHS
X1
1
2/3
1/6
0
0
0
4
S2
0
4/3
-1/6
1
0
0
2
S3
0
5/3
1/6
0
1
0
5
S4
0
1
0
0
0
1
2
z
0
-2/3
5/6
0
0
0
20
Now take a look to Z row if you get a positive and zero values stop work
IF not Repeat all steps from step 3 until you reach positive or zeros values
Doua Nassar
49
Entering variable
Basic
X1
X2
S1
S2
S3
S4
Sol.
RHS
Sol/
Pivot
col.
X1
1
2/3
1/6
0
0
0
4
6
S2
0
4/3
-1/6
1
0
0
2
1.5
S3
0
5/3
1/6
0
1
0
5
3
S4
0
1
0
0
0
1
2
2
z
0
-2/3
5/6
0
0
0
20
No
need
Doua Nassar
Leaving variable
50
Basic
X1
X2
S1
S2
S3
S4
Sol.
RHS
X1
1
0
1/4
-1/2
0
0
3
X2
0
1
-1/8
3/4
0
0
3/2
S3
0
0
3/8
-5/4
1
0
5/2
S4
0
0
1/8
-3/4
0
1
½
z
0
0
3/4
1/2
0
0
21
Now let see Z Row we find all values is positive and zeros
SO Stop work
We reach the optimal solution
X1= 3
X2= 3/2
Z= 21
Doua Nassar
51
What about Minimization??
Simplest way to solve SEE the
attached pdf file for minimization
objective
Doua Nassar
52
3.3.3 Summary of the Simplex Method
Optimality condition for maximization objective:
- The entering variable in a maximization
objective problem is the non-basic variable
having the most negative co-efficient in the
z-row.
- The optimum is reached at the iteration where
all the z-row co-efficients of the non-basic
variables are non-negative (all co-efficients of the
non-basic variables in the z-row > 0) .
Doua Nassar
53
Optimality condition for minimization objective:
- The entering variable in a minimization
objective problem is the non-basic variable
having the most positive co-efficient in the
z-row.
- The optimum is reached at the iteration where
all the z-row co-efficients of the non-basic
variables are non-positive (all co-efficients of the
non-basic variables in the z-row < 0) .
Doua Nassar
54
Feasibility condition:
For both the maximization and the minimization
problems the leaving variable is the basic
variable associated with the smallest
non-negative ratio.
Gauss-Jordan row operations:
1. Pivot row:
(a) Replace the leaving variable in the Basic column with the
entering variable.
(b) New pivot row = Current pivot row ÷ Pivot element
2. All other rows , including z:
New row = Current row
– {(Pivot column co-efficient) X (New pivot row)}
Doua Nassar
55
The steps of the Simplex method are:
Step 1
- Determine a starting basic feasible solution.
Step 2
- Select an entering variable using the optimality condition . Stop
if there is no entering variable , then the last solution is optimal.
- Else go to step 3.
Step 3
- Select a leaving variable using the feasibility condition.
Step 4
- Determine the new basic solution by using the appropriate
Gauss-Jordan computations.
- Go to step 2.
Doua Nassar
56