03 Linear Programming
03 Linear Programming
Linear programming
Examples
x1 + x2 =2
(2) Minimize Z
x2
unbounded
x1
Max Z is unbounded
3
Objective function
Z=2x1+2x2
Max occurs at (x1=1/2, x2=3/2)
Four possibilities:
(1) No solution
(2) Unbounded solution
(3) Finite optimal solutions
(4) Infinite no. of optimal solutions
4
The Simplex method will deal with all solutions. Why Simplex ?
n
Z = cjxj (3)
j=1
Subject to
n
∑ aij x j =bi ….(4) i=1,2,……..m
j=1
5
In matrix form
Min cx
Subject To
Ax=b
x≥0
A is a m x n matrix
Definition 1:
6
Definition 2:
Definition 3:
7
Definition 4:
A basic feasible solution is a basic solution in which all variables have non
negative values
(Note: By definition 3, at most m variables can be positive)
Definition 5:
A non degenerate basic feasible solution is a basic feasible solution with exactly
m positive .xi
Definition 6:
8
Example:
-x1+x2+x3 =1
x1+x2 +x4=2
x i≥ 0 i=1,…..4
A= -1 1 1 0
1 1 0 1
b= 1
2 The matrix B = 1 0
0 1
9
Formed from column 3&4 is a basic matrix
The corresponding basic solution
Bx=b
The objective function Z assumes its min at an extreme point of the constraint
set. If it assumes its min at more than one extreme point, then it takes the same
value at every point of the line segment joining any two optimal extreme
points.
Theorem 2:
10x2+6x2=6
10x1+7x2=20 …………………II
& subtract given from equation (2)
X2=14
10x1+7x2=20 ………………………III
& finally we get
X2= 14
X1= -7.8 ……………………………IV
13
INTUITIVE INTRODUCTION TO L.P.
Min Z = x1+6x2-7x3+x4+5x5
s.t. 5x1-4x2+13x3-2x4+5x5=20
x1-x2+5x3-x4+x5=8
-------------------------------------------------------------------------------------
Augment it with x1+6x2-7x3+x4+5x5-Z =0
Objective function
xj ≥ 0 j=1,2,………5
Pivoting we get
x5 -1/4x2 +3x3 -3/4x4 =5
x1 -3/4x2 +2x3- 1/4x4 =3
----------------------------------------------------------------------------------------
-Z +11x2 -25x3 -1/4x4 =-28
14
A basic solution is
x5=5 x1=3 x2=x3=x4=0 & Z=28
x5 = 5-3x3
x1 = 3-2x3
x3 = 3/2
15
New B.F.S pivoting on (2x3)
x5 =1/2-7/8x2
x3 = 3/2 + 3/8x2
Z= -8 –x2
X2 -12/7 x1 – 3/7x4 + 8/7x5 = 4/7
X3 -1/7x1 - 2/7x4 + 8/7x5 = 12/7
-Z +72/7 x1 + 11/7x4 +8/7x5= 60/7
16
Problem 1:
Max x1+x2 =Z
s.t. x1+3x2≤1
3x1+x2≤1
x1, x2≥0
(0,1)
(a) Show the feasible region
(b) Find all basic solutions
(c) Find all B.F.S.
(d) Find the optimal solution by:
(i) graphical method
(ii) using the B.F.S (0,1/3)
(iii) simplex method (1/4,1/4)
(e) Are any solutions Degenerate?
(1,0)
(0,0)
(1/3,0)
17
Solution using Simplex method
Iteration 1:
x1 x2 x3 x4 -Z t
1 3 1 0 0 1
3 1 0 1 0 1
1 1 0 0 1 0
18
Iteration 2:
x1 x2 x3 x4 -Z t
0 8/3 1 -1/3 0 2/3
1 1/3 0 1/3 0 1/3
0 2/3 0 -1/3 1 -1/3
19
Iteration 3:
x1 x2 x3 x4 -Z t
0 1 3/8 -1/8 0 1/4
1 0 -1/8 3/8 0 1/4
0 0 -1/4 -1/4 1 -1/2
This is the optimal solution
20
Canonical system:
Assume that the first m equations of the linear system of equations from a
basic matrix B i.e.
nX
mA =b
n
m[ B, B ] X = b
−1
Then pre-multiplying both side by B yields
−1 n −1
m [ I,B B ] x=B b
21
Such a system is called canonical & has the form shown below
22
All Ь’s are always ≥ 0
(x1, x2……xm) are dependent because by fixing values of other x’s their value
gets fixed
In particular if xm+1…….xn =0
We get
x 1 = Ь1 x2 = Ь2 ………….xm= Ьm
& this is a B.F.S
23
Def.
To start the simplex method we must first get the system of equations into their
canonical form (in other words we must get the B.F.S.- an extreme point)
This extreme point is used to begin the Simplex method
24
(3) the simplex algorithm can begin with this augmented system is in canonical
form i.e.
out of rows corresponding to the sth column which have positive coefficients
corresponding to xs choose that row ‘r’ such that
These two checks give us the sth column and rth row which enable us to locate
the pivot term.
(5) Pivot on the pivot term & reduce to new B.F.S and repeat 26
REVISED SIMPLEX METHOD
Much information of simplex tableau is not used. Only the following are
needed
(1) Relative cost factorcj
We compute
P x +P
j=1
j j n+1 ( z) = b
^ ^ ^ ^
consider B = [ P j1 ,............ P jm , P n+1 ] = B 0
^ 1 c B 1
B obviously = B 1 0
c B
B 1
1
29
Def. The row vector
Multiply system (1) by π1, π2, …….. πm & sum and subtract from the
Z equation
We get πB = cB
30
x j1 = b1
x jm + Pj x j = bm
non basic
Z+ c j x j = Z 0
non basic
p B1 0 p j
j =
c π 1 c j
j
Update column is p j = B 1 p j
cj = cj π pj 31
Relative cost factor is
Only B1 and π are needed to perform the simplex iteration
^ ^ ^
P j1 .......... ..... P jm P n + 1 u1.......... u m + 1 a rs
a rs
am
righ
32
−1
Multiply by B , we get
u1 .......... ..... u r .......... .......... u m+1 B 1 a rs
a rs
a ms
cs
righ
[]
Pivot on ārs yield
^ 1
u1........ u r 1 , α,u r+1 .......... u m+1 B new | u r
33
Summary of Revised Simplex Method
^ 1
At any iteration assume current basis matrix is
B
associate solution is xB = B-1b
& the data of the original problem A, b & c are available.
or cB = cB cB B 1.B
The pricing out of column Pj
34
(2) Std column selective rule
36
Max Z = x1+3x2
S.t. -x1+x2≤1
x1+x2≤2
x1≥0 , x2 ≥ 0
^ ^
Solution: A = 1 +1 +1 0 0 b = 1
+1 +1 0 +1 0 2
1 3 0 0 +1 0
^ ^ 1
B= I = B
37
pivoting element are circled
Step :- 1
1 0 0 | 1 pivoting 1 0 0 |1
0 1 0 1 1 1 0 0
0 0 1 3 +3 0 1 0
1
New B
38
c1 = + 3 0 1 1 = 4
+1
1
c3 = + 3 0 1 1 = +3
0
0
Primal Dual
Min ćx Max πb
St. Ax ≥ b St. A’π’ ≤ c
x≥0 π≥0
Min ćx Max πb
St. Ax = b St. A’π’ ≤ c
x≥0 π unconstrained in sign
40
Primal Quantity Corresponding dual Quantity
Objective c’x→ min Objective πb→ max
Variable xj ≥ 0 Constraint π pj ≤ cj (inequality)
Variable xj unconstrained in sign Constraint π pj = cj (equality)
Constraint Aix = bi (equality) Variable πj unconstrained in sign
Constraint Aix ≥ bi (inequality) Variable πj ≥ 0
Coefficient matrix A Coefficient matrix A’
Right hand side b Right hand side c
Cost coefficient c Cost coefficient b
As you may have noticed there is a direct connection between the variable of
any one of the two problems with the constraints of the other
41
The most general Primal Primal dual formulation
n n
Min Z= ∑ c i x i Max v= ∑ π i bi
S .t. i=1 i=1
S .t.
EU E = 1,2,.....n m
a ij x j = bi i E π a i ij = cj j p
a ij x j bi i E i=1
m
π a i ij cj j p
PU P = 1,2,....n
i=1
πi 0 i E
xi 0 i P
πi unconstrained in
xi unconstrained
sign i
in sign i p
42
Or in matrix form
Min Z = c' x
Max v = πb
' '
s.t . A π c
s.t . Ax b
π 0 iE
x b i p i
i
43
The Dual constraints have the structure
Theorem 1:
If x & π are feasible primal & dual solution, then
Z = c' x > πb = v
Proof : By feasibility hypothesis
x 0, Ax = b, A' π' c
Then c' x πb,
∴ Z v 44
Theorem 2:
If both primal & dual have feasible solution & both have optimum
solutions, then
min Z = max v
let xo solve the primal with optimal basis Bo & vector of basic variables xB0
Thus, B0 xB0 = b, xB0 ≥ 0
since this is an upper band for v, π0 solve the dual & the theorem is prove
z Z
Min Z = Max v
v v
46
Theorem 3:
If either primal or dual prob. has an unbounded solution then the other prob. is
infeasible.
Proof:
Assume primal unbounded
Then by theorem
π b ≤ - ∞ for all dual feasible π
Existence of a solution to the dual constraints would imply a finite value of
dual objective contradicting the above.
Hence dual is feasible
47
Theorem 4:
A pair (x0, π0) with x0 & π0 primal and dual feasible respectively, are optimal if
and only if:
(c’ – π0 A) x0 = 0………(1)
Proof: For any primal feasible x ,
A x = b .....................( 2 )
c' x = z .....................( 3 )
Multiply (2) by some dual feasible & subtract the result from (3) to get,
c' x π A x = z πb
or, setting πb = v
(c' π A)x = z v
If (x0, π0)
are primal dual optimal,
Then z0 – v0 = 0 = (c’ – π0A)x0
Conversely if (x0, π0) satisfy
(c’ – π0 A)x0 = z0 - v0 = 0
Then by theorem 2, z attains lower bounds at x0 & v upper bound at π0.
So x0, & π0 are optimal
For optimality
→ Positive variable in primal solution implies the corresponding constraint holds with
equality while a slack constraint implies zero level for the corresponding variables.
Most algorithms enforce two of these conditions throughout while relaxing the third,
enforcing it as the iteration progresses:
49
Algorithm Primal feasibility Dual feasibility Complementary
Slackness
Dual Simplex X √ √
Primal Dual X √ √
The later two methods make use of different means to reduce primal
infeasibility. The dual simplex method increases the value of dual objective at
each step while the primal dual algorithm minimizes the infeasibility form.
50
DUAL SIMPLEX METHOD
But the relative cost factor are all non-negative → Dual feasible
(This is necessary condition to start dual simplex method)
51
Case 1:
Constraints added to a problem whose solution is known
x1 x2 s x3 x4 (-Z) b
52
Case 2:
A linear programming is given whose solution for a number of different right
hand side vector bj is desired.
It would be insufficient to apply the two phases for each bj .Desired solution
for b’ may be close to that for b2
Procedure- Solve for b’ obtaining an optimal basis B if this is feasible for all
other right hand sides i.e. if
B-1 bj ≥ 0 all j
Then it is optimal for these as well
If not so that
B-1 br < 0 for some r
Then π = cB B-1
is dual feasible since
c j =c j − πp j ≥ 0
is independent of RHS
only primal feasible is not there.
53
DUAL SIMPLEX METHOD
54
(1) Choose row ‘r’ as pivot row where
br = min bi < 0
(2) Choose column ‘S’ as pivod column, where
cj
Choosethe min of
a rj
If all a rj > 0 primal is in feasible
(3) Pivot on ars
(4) If bi ≥ 0 all i
Stop → optimal
Otherwise return to 1
55