LinearProgramming II
LinearProgramming II
Linear Programming - II
Shirish Shevade
Computer Science and Automation
Indian Institute of Science
Bangalore 560 012, India.
Shirish Shevade
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
Shirish Shevade
Numerical Optimization
cT x
cTB xB + cTN xN
cTB B1 b cTB B1 NxN + cTN xN
z + cTB xB + cTN xN
where cTB = 0T and cTN = cTN cTB B1 N are the relative cost
factors corresponding to the basis matrix B and z denotes the
current objective function value.
Shirish Shevade
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
Convex Programming Problem
Assumption:
Feasible set is non-empty
Slaters condition is satisfied
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
Define the Lagrangian function:
L(x, , ) = cT x + T (b Ax) T x
First Order KKT Conditions at optimality:
Primal Feasibility: Ax = b, x 0
x L(x, , ) = 0 AT + = c
Complementary Slackness Condition: i xi = 0 i
Non-negativity: i 0 i
Shirish Shevade
Numerical Optimization
cN
N
NT
cN = NT + N
B = 0 cB = BT = BT
N 0 requires that
cB
N = cN (B1 N)T cB 0
The current basic feasible solution x is not optimal if there
exists xq N such that q < 0.
Shirish Shevade
Numerical Optimization
x is feasible Ax = b, x 0.
BxB + NxN = b xB = B1 b B1 NxN
cT x
cTB xB + cTN xN
cTB (B1 b B1 NxN ) + cTN xN
cTB B1 b + (cTN cTB B1 N) xN
|
{z
}
T
N
T 1
= cB B b
( xN = 0)
Objective Function at x =
=
=
=
Numerical Optimization
x1
b1
..
..
.
.
1
xp = b
p (B N),q xq
.
.
..
..
xm
bm
Note: b > 0
How to choose xp ?
Require (B1 N)p,q > 0 so that xp can decrease if xq increases.
Shirish Shevade
Numerical Optimization
x1
b1
..
..
.
.
xp = bp (B1 N),q xq
.
.
..
..
xm
bm
q
xj B
bj
(B1 N) jq
bp
(B1 N) pq
Numerical Optimization
Summary of steps:
Given a basic feasible solution, (xB xN )T w.r.t. B.
If N = cN (B1 N)T cB 0
1
Choose xq N such that q < 0
q = {xj B : (B1 N)jq > 0}.
2
B
q 6= , find the basic variable xp to be made non-basic.
3
If B
xq = min
q
xj B
4
5
bj
(B1 N) jq
bp
(B1 N) pq
xi = bi (B1 N)iq xq , xi B
Swap xp and xq from the sets B and N
Numerical Optimization
Example:
min 3x1 x2
s.t. x1 + x2 2
x1 1
x1 , x2 0
Shirish Shevade
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
Given a basis matrix B w.r.t. the basis vector set B,
Basic Feasible Solution: xB = B1 b, xN = 0
Objective function = cTB B1 b
Relative cost factors, N = cN (B1 N)T cB
Shirish Shevade
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
I
0T
I
cTB
B1 b
0
B1 N
cTN
B1 N
cTN cTB B1 N
Shirish Shevade
B1 b
- cTB B1 b
Numerical Optimization
Example:
min 3x1 x2
s.t. x1 + x2 2
x1 1
x1 , x2 0
Given problem in the standard form:
min
3x1 x2
s.t. x1 + x2 + x3 = 2
x1 + x4 = 1
x1 , x2 , x3 , x4 0
Initial Basic Feasible Solution:
xB = (x3 , x4 )T = (2, 1)T , xN = (x1 , x2 )T = (0, 0)T
Shirish Shevade
Numerical Optimization
min
3x1 x2
s.t. x1 + x2 + x3 = 2
x1 + x4 = 1
x1 , x2 , x3 , x4 0
x1 x2 x3 x4 RHS
1 1 1 0
2
1 0 0 1
1
-3 -1 0 0
0
Shirish Shevade
Numerical Optimization
Shirish Shevade
Numerical Optimization
x1 x2 x3
1 1 1
1 0 0
-3 -1 0
x4
0
1
0
RHS
2
1
0
Shirish Shevade
Numerical Optimization
x1 x2
1 1
1 0
-3 -1
Incoming nonbasic variable:
x1 x2
1 1
1 0
-3 -1
Outgoing basic variable: x4
x1 x2
0 1
1 0
0 -1
x3 x4
1 0
0 1
0 0
x1
RHS
2
1
0
x3
1
0
0
x4
0
1
0
RHS
2
1
0
x3
1
0
0
x4
-1
1
3
RHS
1
1
3
Shirish Shevade
Numerical Optimization
x1
0
1
0
x2
1
0
-1
x3
1
0
0
x4
-1
1
3
RHS
1
1
3
Shirish Shevade
Numerical Optimization
Shirish Shevade
Numerical Optimization
x1
0
1
0
x2 x3
1 1
0 0
-1 0
x4
-1
1
3
RHS
1
1
3
Shirish Shevade
Numerical Optimization
x1 x2
0 1
1 0
0 -1
Incoming nonbasic variable:
x1 x2
0 1
1 0
0 -1
Outgoing basic variable: x3
x1 x2
0 1
1 0
0 0
x3 x4
1 -1
0 1
0 3
x2
RHS
1
1
3
x3
1
0
0
x4
-1
1
3
RHS
1
1
3
x3
1
0
1
x4
-1
1
2
RHS
1
1
4
Shirish Shevade
Numerical Optimization
Shirish Shevade
Numerical Optimization
x1
0
1
0
x2
1
0
0
x3
1
0
1
x4
-1
1
2
RHS
1
1
4
Numerical Optimization
Shirish Shevade
Numerical Optimization
x1 x2
1 1
1 0
-3 -1
Incoming basic variable: x2
x3
1
0
0
Shirish Shevade
x4
0
1
0
RHS
2
1
0
Numerical Optimization
LP in Standard Form:
min
cT x
s.t. Ax = b
x0
where A Rmn and rank(A) = m.
Simplex Algorithm to solve an LP [Dantzig]1
Numerical Optimization
else
(i) xq = minxj Bq
bj
bp
(B1 N) jq
(B1 N) pq
(ii) xi =
bi (B N)iq xq , xi B
(iii) Swap xp and xq between B and N, update B and
1
endif
endwhile
Output : x = (xB , xN )T if Unbounded == FALSE
Shirish Shevade
Numerical Optimization
Remarks:
How to select a non-basic variable xq N in Step 3(a) of
the Simplex Algorithm?
xq = argmin j
xj N:j <0
If the basic feasible solution is nondegenerate at each
iteration, then the Simplex Algorithm terminates in a finite
number of iterations.
Objective Function = cTB xB + cTN xN
= cTB B1 b cTB B1 NxN + cTN xN
= z + cTB xB + cTN xN
where cTB = 0T , cTN = cTN cTB B1 N and z denotes the
current objective function value. If the basic feasible
solution is nondegenerate, then the objective function
decreases in each iteration. Since the number of basic
feasible solutions is finite, the algorithm has finite
convergence.
Shirish Shevade
Numerical Optimization
x
Ax + y = b
(A I)
=b
y
x, y 0
x, y 0.
Use Basic feasible solution, (x, y)T = (0, b)T , to solve
min cT x + 0T y
s.t. Ax + y = b
x, y 0
Shirish Shevade
Numerical Optimization
Numerical Optimization
x
Ax z + y = b
(A I I) y = b
z
x, y, z 0
x, y, z 0.
Solve an artificial linear program (similar to Case 2)
Shirish Shevade
Numerical Optimization
Numerical Optimization
Example:
min
s.t.
2x1 x2
x1 + x2 3
x1 + x2 1
x1 , x2 0
Shirish Shevade
Numerical Optimization
min
s.t.
Example:
2x1 x2
x1 + x2 3
x1 + x2 1
x1 , x2 0
x3 + x5
x1 + x2 + x3 = 3
x1 + x2 x4 + x5 = 1
x1 , x2 , x3 , x4 , x5 0
Numerical Optimization
min
s.t.
Initial Tableau:
x1
1
-1
0
x3 + x5
x1 + x2 + x3 = 3
x1 + x2 x4 + x5 = 1
x1 , x2 , x3 , x4 , x5 0
x2
1
1
0
x3
1
0
1
x4 x5
0 0
-1 1
0 1
RHS
3
1
0
x1 x2 x3 x4 x5 RHS
1 1 1 0 0
3
-1 1 0 -1 1
1
0 -2 0 1 0
-4
Shirish Shevade
Numerical Optimization
x1 x2 x3
1 1 1
-1 1 0
0 -2 0
x4 x5
0 0
-1 1
1 0
x1 x2 x3 x4
1 1 1 0
-1 1 0 -1
0 -2 0 1
Outgoing basic variable: x5
x1 x2 x3
2 0 1
-1 1 0
-2 0 0
Shirish Shevade
RHS
3
1
-4
x5
0
1
0
RHS
3
1
-4
x4 x5
1 -1
-1 1
-1 2
RHS
2
1
-2
Numerical Optimization
x1 x2 x3 x4 x5
2 0 1 1 -1
-1 1 0 -1 1
-2 0 0 -1 2
Incoming non-basic variable: x1
x1 x2 x3 x4 x5
2 0 1 1 -1
-1 1 0 -1 1
-2 0 0 -1 2
Outgoing basic variable: x3
x1 x2 x3
1 0 1
2
0 1 1
2
0 0 1
x4
1
2
21
0
x5
12
1
2
RHS
2
1
-2
RHS
2
1
-2
RHS
1
2
0
Numerical Optimization
x1 x2 x3 x4
x5 RHS
1
1
1 0
12
1
2
2
1
0 1 1 1
2
2
2
2
0 0 1
0
1
0
Basic feasible solution: x1 = 1, x2 = 2, x3 = x4
Shirish Shevade
Numerical Optimization
= 0.
2x1 x2
x1 + x2 + x3 = 3
x1 + x2 x4 = 1
x1 , x2 , x3 , x4 0
Initial Tableau:
x1
1
0
2
x2
0
1
-1
x3
x4
1
2
1
2
1
2
21
0
RHS
1
2
0
x1 x2 x3
x4 RHS
1
1
1 0
1
2
2
1
1
0 1
2
2
2
0 0 12 23
0
Shirish Shevade
Numerical Optimization
12
32
RHS
1
2
0
x1 x2 x3
x4
1
1
1 0
2
2
1
1
0 1
2
2
1
0 0 2 32
RHS
1
2
0
x1
1
0
0
x2
0
1
0
x1 x2
2 0
1 1
3 0
x3
x4
1
2
1
2
1
2
12
x3
1
1
1
x4
1
0
0
RHS
2
3
3
Numerical Optimization
x1
2
1
3
x2
0
1
0
x3
1
1
1
Shirish Shevade
x4
1
0
0
RHS
2
3
3
Numerical Optimization
Example:
Numerical Optimization
min
x4 + x5
s.t. 3x1 2x2 x3 + x4 = 4
2x1 + x2 + x5 = 2
x1 , x2 , x3 , x4 , x5 0
Initial Tableau:
x1 x2
3 -2
-2 1
0 0
x3
-1
0
0
x4
1
0
1
x5
0
1
1
RHS
4
2
0
x1 x2 x3 x4 x5 RHS
3 -2 -1 1 0
4
-2 1 0 0 1
2
-1 1 1 0 0
-6
Shirish Shevade
Numerical Optimization
x1 x2 x3 x4
3 -2 -1 1
-2 1 0 0
-1 1 1 0
Incoming non-basic variable: x1
x1 x2 x3 x4
3 -2 -1 1
-2 1 0 0
-1 1 1 0
x5
0
1
0
RHS
4
2
-6
x5
0
1
0
RHS
4
2
-6
x1 x2 x3
1 2 1
3
3
0 1 2
3
3
1
2
0
3
3
x5
0
1
0
RHS
x4
1
3
2
3
1
3
4
3
14
3
- 143
Numerical Optimization
Shirish Shevade
Numerical Optimization
Cycling
Possible in the presence of degenerate basic feasible
solution
Consider the example given by Beale2
min
s.t.
34 x1 + 20x2 12 x3 + 6x4
1
4 x1
1
2 x1
8x2 x3 + 9x4 = 0
12x2 12 x3 + 3x4 = 0
x3 + x5 = 1
xj 0 j
Numerical Optimization