1
• LPPs in Standard Form • Algebraic Solutions • Simplex Method • Algebra of Simplex Method • Examples
Manoj Kumar Pandey,
OPTIMIZATION OPTIM IZATION
Algebraic Solution of LPPs
To solve an LPP algebraically, we first put it in the s an an ar orm. a sa e va var a es ar are no nonnega ve an an all constraints (other than the non-negativity restrictions) are equations with nonnegative RHS.
Manoj Kumar Pandey,
OPTIMIZATION OPTIM IZATION
2
Standard algebraic form of LPP
• Chan Change ge all constra constraints ints to equations equations with non negat negative ive RHS. .
Manoj Kumar Pandey,
OPTIMIZATION OPTIM IZATION
3
Changing inequalities into equations (using SLACK and SURPLUS variables) SLACK VARIABLE: A slack variable is used to change a ( ineq in equa uali lity ty to eq equa uati tion on..
≤
)
SURPLUS VARIABLE: A surplus variable to change a (≥) ineq in equa uali lity ty to eq equa uati tion on.. Note : the slack and surplus variables are always alw ays non-negative non-negative
If the RHS of the equation is negative then multiply both sides of the equation by -1.
Manoj Kumar Pandey,
OPTIMIZATION OPTIM IZATION
4
Example 1: Write the following LPP in the standard form : Maxi Ma ximi mize ze z = x1 + x2 subject to x1 + x2
---
2x1 + x2 ≥ 1 16 6
--- (2 ( 2)
x1 , x2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION OPTIM IZATION
5
Change all inequalities into equations by using slack or surplus variables Slack variable
x1 + 2x2 + s1 = 6 2x1 + x2 – s2 = 16 Surplus variable
Maximize z = x1 + x2 subject to x1 + 2x2 + s1 = 6 2x1 + x2 – s2 = 16 x1 , x2 , s1 , s2 Manoj Kumar Pandey,
OPTIMIZATION
6
≥ 0
Example 2 Write the following Linear programming problem in the standard form: Min u ec
z = 3x1 + x2 – x3 o 2x1 – x2+x3 ≤ 6 x1 + 3x2 -7x3 ≥ -16 x1 ≥ 0,
Manoj Kumar Pandey,
OPTIMIZATION
x2 ≤ 0
7
Standard Form x2 ≤ 0 We will introduce a new variable y2 , defined by y2 = -x2 , and we will replace x2 by –y2 in the LPP
since x2 ≤ 0
⇒
y2 ≥ 0
nres r c e var a es The unrestricted variables can be written as a function of two non negative variables.
Here x3 is unrestricted in sign, we introduce two new variables x3+ ≥ 0 and x3- ≥ 0, and define x3= x3+- x3Manoj Kumar Pandey,
OPTIMIZATION
8
Objective function :
3x1 - y2 – (x3+- x3-)
Constraints:
⇒
2x1 – x2+x3 ≤ 6 2x1 + y2 + (x3+- x3-) + s1 = 6 x1 + 3x2 -7x3 ≥ -16 -x1 - x2 + x3 -x1 + 3y2 +7(x3+- x3-) + s2 = 16
⇒ ⇒
with x1 ≥ 0, y2 ≥ 0, x3+ ≥ 0, x3- ≥ 0, s1 ≥ 0, s2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
9
The LPP in the standard form is: Min.
Z = 3x1 - y2 – (x3+- x3-)
Subject to 2x1 + y2 + (x3+- x3-) + s1 = 6 -x1 + y2 +7 x3+- x3- + s2 = 1 x1 ≥ 0, y2 ≥ 0, x3+ ≥ 0, x3- ≥ 0, s1 ≥ 0, s2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
10
Basic Variables, Basic Feasible Solutions Consider an LPP (in standard form) with m constraints and n variables. We assume m ≤ n. We choose n – m variables and set them equal to zero. Thus we will be left with a system of m equations in m variables. If this square system has a unique solution, this solution is called a basic solution. Further if it is feasible, it is called a Basic Feasible Solution (BFS). Note that a system may have a maximum of nCm basic solutions Manoj Kumar Pandey,
OPTIMIZATION
11
The n – m variables set to zero are called nonbasic and the m variables which we are solving for are known as basic variables. Thus a basic solution is of the form x = (x1, x2, … , xn) where n – m “components” are zero and the remaining m variables form the unique solution of the square system (formed by the m constraint equations).
Nondegenerate BFS: If all the m basic variables in a BFS are strictly positive than it is called nondegenerate basic feasible solution.
Manoj Kumar Pandey,
OPTIMIZATION
12
Any values of variables that satisfy all the constraints of the model is called a feasible solution. Optimum feasible solution is the one that gives the optimum value while satisfying all the constraints. The set of all feasible solutions is known as the feasible region.
Manoj Kumar Pandey,
OPTIMIZATION
13
Manoj Kumar Pandey,
OPTIMIZATION
14
Manoj Kumar Pandey,
OPTIMIZATION
15
(2, 0, 4, 0) (6/7, 12/7, 0, 0) Manoj Kumar Pandey,
OPTIMIZATION
16
Graphical Solution
Feasible Region (P F)
Manoj Kumar Pandey,
OPTIMIZATION
17
Theorem: A point X∈ PF is a vertex of PF ⇔ X is a BFS. F
:
eas
Manoj Kumar Pandey,
e
OPTIMIZATION
eg on
18
Example 2 Without sketching the feasible region find the vertices for the system, hence find the optimal solution Max z = 3x1 + x2 u ec o -x1 + x2 ≤ 1
2x1 + x2 ≤ 2 x1 , x2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
19
Here n=4, m=2 , hence there are nC m
=6
basic solutions.
To find all basic solutions we take any of the two variables (at a time) as basic variables from the 1, 2 , 1, 2 ( 1/3, 4/3, 0, 0), (1, 0, 2, 0), (-1, 0, 0, 4), (0, 2, -1, 0), (0, 1, 0, 1), (0, 0, 1, 2). The system has 6 basic solutions, and out of these, 4 are basic feasible solutions Manoj Kumar Pandey,
OPTIMIZATION
20
Remark: In the absence of degeneracy there exists a one-one correspondence between the set of basic feasible solutions and the set of vertices of the feasible region . Degeneracy makes the simplex algorithm slower.
Example 3 Min.
z
Subject to
Find all the basic solutions = 3x1 + x2 x1 + x2 ≤ 8 -x1 + x2 ≤ 0 x1 , x2
Manoj Kumar Pandey,
OPTIMIZATION
≥ 0 21
Important Results: If an optimal solution exists, there is always a corner point optimal solution. Ever basic feasible solution corres onds to a vertex of the feasible region. Degeneracy makes the simplex algorithm slower.
Manoj Kumar Pandey,
OPTIMIZATION
22
Transition from Graphical to Algebraic Solution 23
Graphical Method
Algebraic Method
Graph all constraints, solution space has infinity of feasible solutions
Represent the solution space in the equation form, the system has infinity of feasible solution.
Candidates for the optimum solution are given by a finite number of feasible corner points
Candidates for the optimum solution are the finite number of basic feasible solution
Using the objective function determine the optimal solution.
Using the objective function determine the optimal solution.
Manoj Kumar Pandey,
OPTIMIZATION
Simplex Method 24
In optimization theory, the simplex algorithm, is a popular algorithm for numerically solving linear programming problems. The algorithm was created by the American Mathematician George B. Dantzig in 1947. The journal “Computing in Science and Engineering” Listed as one of the top 10 algorithms of the century. The method uses the concept of a simplex, which is a polytope (such as polygon, polyhedron etc.,) with finite number of vertices. Manoj Kumar Pandey,
OPTIMIZATION
How to Solve an LPP of higher dimension ?
The constraints of a Linear Programming Problem give rise to a polytope with finite number of vertices .
If we can determine all the vertices of the polytope, then we can calculate the value of the objective function at these points and take the best one as our optimal solution.
The Simplex Method is an iterative method which moves from one vertex to another vertex (in the direction of optimum improvement) until the optimal solution is reached
Manoj Kumar Pandey,
OPTIMIZATION
25
Manoj Kumar Pandey,
OPTIMIZATION
26
Simplex Method An iterative procedure
Initialization (Find initial BFS)
Is the current BFS optimal?
Move to a better adjacent BFS Manoj Kumar Pandey,
OPTIMIZATION
27
Stop
Initial Assumptions • All constraints are of the form be non-negative
Manoj Kumar Pandey,
OPTIMIZATION
j,
28
≤
type
= , …,
Algebra of the Simplex Method 29
Let us consider the following LPP Maximize subject to
Z=
3x1+ 5x2
x1 2x2 3x1+ 2x2 x1, x2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
≤ 4
12 ≤18 ≤
Standard form : Maximize
Z=
3x1+ 5x2
subject to
x1
+s1 2
=4 2
+s3
3x1+ 2x2
x1,x2, s1, s2, s3 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
30
= 18
Initialization • Find an initial basic feasible solution “If possible, use the origin as the initial BFS” • Equivalent to:
Choose original variables to be nonbasic (xi=0, i=1,…n) and let the slack variables be basic (s j=b j, j=1,…m)
Manoj Kumar Pandey,
OPTIMIZATION
31
Optimality Test
• Are any adjacent BFS better than the current one? • Rewrite Z in terms of nonbasic variables and investigate rate of improvement •
1
OPTIMIZATION
2
Z = 3x1 + 5x2
• Corresponding Z:
Manoj Kumar Pandey,
,
32
Direction of Movement
• Which edge to move on? • Determine the direction of movement by selecting the entering variable (variable ‘entering’ the basis) • Choose the direction of stee est ascent – x1: Rate of improvement in Z = 3 – x2: Rate of improvement in Z = 5 • Entering basic variable = x2
Manoj Kumar Pandey,
OPTIMIZATION
33
The nonbasic variable that will become basic is referred to as “entering” variable. The basic variable that will become nonbasic is referred to as “leaving” variable.
Criterion for “enterin ” ariable Choose that variable as the “entering” variable which has the most –ve coefficient in the z-row in case it is a maximization problem (most +ve coefficient in the z-row in case it is a minimization problem).
Manoj Kumar Pandey,
OPTIMIZATION
34
Criterion for “leaving” variable (Feasibility Condition) Let bi be the RHS of the ith row. Let aij be the coefficient of the entering variable x j in the ith row. The following “minimum ratio test” decides the leaving variable index i for which the ratio
bi , aij aij Manoj Kumar Pandey,
> 0
OPTIMIZATION
is Minimum
35
Simplex Method in Tabular form 36
Let us consider the following problem Maximize
Z=
3x1+ 5x2
subject to x1 2x2 3x1+ 2x2 x1, x2 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
≤ 4
12 ≤18 ≤
Write as system of equations
Zx1
3x1 - 5x2 +s1 2
3x1+ 2x2
Manoj Kumar Pandey,
OPTIMIZATION
=0 =4 2
+s3
= 18
37
Basic variable
Z
x1
x2
s1
Z
s2 s3
Manoj Kumar Pandey,
OPTIMIZATION
38
s2
s3
Solution
Z-row is the objective equation row.
The remaining 3 rows are the basic variable rows.
Each row corresponds to a basic variable
Manoj Kumar Pandey,
OPTIMIZATION
39
Iteration 1 : Basic variable
Z
x1
x2
s1
s2
s3
Solution
Z
1
-3
-5
0
0
0
0
s2
0
0
2
0
1
0
12
s3
0
3
2
0
0
1
18
s1
Manoj Kumar Pandey,
OPTIMIZATION
40
Choose that variable as the “entering” variable which has the most –ve coefficient in the z-row in case it is a maximization
x2 enters the basis Basic variable
Z
x1
x2
s1
s2
s3
Solution
Min. Ratio
Z
1
-3
-5
0
0
0
0
No Ratio
s1
0
1
0
1
0
0
4
-------- =
s3
0
3
2
0
0
1
Minimum Ratio is corresponding to S 2 S2 leaves the basis
Manoj Kumar Pandey,
OPTIMIZATION
41
18
18/9 =9
The entering variable column is called the pivot column. The leaving variable row is called the pivot row. The coefficient in the intersection of the two is referred to as the pivot element.
Apply elementary row operations to modify the simplex tableau so that the pivot column has 1 at the pivot element and zero in all other places.
Manoj Kumar Pandey,
OPTIMIZATION
42
Iteration 2 : Min. Ratio
Basic variable
Z
x1
x2
s1
s2
s3
Solution
Z
1
-3
0
0
5/2
0
30
s1
0
1
0
1
0
0
4
4/1 = 4
x2
0
0
1
0
1/2
0
6
-------
s3
0
3
0
0
-1
1
6
6/3 =2
No Ratio
Stop: If all the entries in the Z-row are ≥ 0 ( or ≤ 0 ) in Max. (or Min.) then stop else repeat the iteration. Manoj Kumar Pandey,
OPTIMIZATION
43
Basic variable
Z
x1
x2
s1
s2
s3
Solution
Z
1
0
0
0
3/2
1
36
s1
0
0
0
1
1/3
-1/3
2
x1
0
1
0
0
-1/3
1/3
2
All the entries in the Z-row are ≥ 0, hence we have reached the optimal solution. Optimal Solution: Manoj Kumar Pandey,
OPTIMIZATION
x1 = 2, x2 = 6, Z=36 44
(0, 6)
(2, 6)
Feasible
(0, 0)
Manoj Kumar Pandey,
Optimal Solution
(4, 3)
(4, 0)
OPTIMIZATION
45
Example 2:
Min Z = x1 -2x2 + x3 subject to x1 + x2 - x3 x1 -x3 2x1 -x2 +2x3 x1, x2, x3 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
46
3 ≤2
≤
Standard Form Min Z = x1 -2x2 + x3 subject to x1 + x2 - x3 + s1 = =3 x1 -x3 + s2 2x1 -x2 +2x3 + s3 = 2 x1, x2, x3 , s1, s2, s3 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
47
System of equations
Z -
x1 + 2x2 - x3 x1 + 2x2 -2x3 + s1 x1 - x3 + s2 2x1 - x2 + 2x3 + s3
Manoj Kumar Pandey,
OPTIMIZATION
48
=0 =4 = =2
BV Z
x1
x2
x3
S1
S2
S3
Solution
Ratio
Z
1
-1
2
-1
0
0
0
0
---
S1
0
1
2
-2
1
0
0
4
4/2=2
S2
0
1
0
-1
0
1
0
3
-----
S
0
2
-1
2
0
0
1
2
-----
Z
1
-2
0
1
-1
0
0
-4
---
x2
0 1/2
1
-1
½
0
0
2
-----
S2
0
0
-1
0
1
0
3
-----
S3
0 5/2
0
1
½
0
1
4
4/1=1
1
Manoj Kumar Pandey,
OPTIMIZATION
49
BV Z
x1
x2
x3
S1
S2
S3
Solution Ratio
Z
1 -9/2
0
0
-3/2
0
-1
-8
---
x2
0
3
1
0
1
0
1
6
-----
2
0
7 2
0
0
1
1
7
-----
x3
0
5/2
0
1
0
1
4
-----
½
The table is Optimal, since all the coefficient in Z-row are ≤ 0 (Minimization Problem).
Optimal solution Manoj Kumar Pandey,
:
OPTIMIZATION
x1= 0, x2 = 6, x3 = 4, Z = -8 50
Example 3:
Max Z = subject to
-x1 +3x2 -3x3
x1 -x2 +x3 ≤6 -x1 +2x2 -4x1 +3x2 +8x3 ≤ 10 x1, x2, x3 ≥ 0
Manoj Kumar Pandey,
OPTIMIZATION
51
Points to Remember in Simplex Algorithm All
the constraints should be ≤ type.
All variables should be ≥ 0.
Coefficients of basic variables in z-row should be zero.
The coefficients matrix corresponding to initial basic variables forms an identity matrix.
The entering variable will be the one which has most negative (most positive) z-row coefficient in case of max. (min.) problem.
Manoj Kumar Pandey,
OPTIMIZATION
52