Quadratic Programming
Quadratic Programming
1
Quadratic Programming
A quadratic programming problem is a non-linear
programming problem of the form
Maximize z CX X T DX
subject to AX b, X 0
where X x1 , x2 ,..., xn T , b b1 , b2 ,..., bn T , C c1 , c2 ,..., cn
2
Quadratic Programming
3
Quadratic Programming
am1 x1 am 2 x2 . . . amn xn bm
x1 , x2 ,. . ., xn 0
4
Wolfes Method to solve a Quadratic
Programming Problem:
The solution to this problem is based on the KKT
conditions. Since the objective function is strictly
concave and the solution space is convex, the KKT
conditions are also sufficient for optimum.
5
Wolfes Method
1. 1 , 2 , . . . , m , 1 , 2 , . . . , n 0
n m
2. c j 2 dij xi i aij j 0, j 1, 2,. . ., n
i 1 i 1
n
3. i aij x j bi 0, i 1, 2,. . ., m
j 1
j x j 0, j 1, 2,. . ., n
n
4. a x
j 1
ij j bi , i 1, 2,. . ., m and x j 0, j 1, 2,. . ., n
6
Wolfes Method
a
j 1
ij x j bi
7
Wolfes Method
j 1, 2,. . ., n
x j 0, j 1, 2,. . ., n
8
Wolfes Method
* * *
x
Thus we find the optimal solution 1 1 , x , . . . , xn is a
a
j 1
ij x j si bi , i 1, 2,. . ., m
10
Example-1:
subject to x1 x2 2
x1 , x2 0.
11
Example-1: Solution
Denoting the Lagrange multipliers by 1, 1, and 2,
the KKT conditions are:
1. 1 , 1 , 2 0
2. 8 2 x1 1 1 0
4 2 x2 1 2 0
i.e. 2 x1 1 1 8
2 x2 1 2 4
3. x1 x2 s1 2, 1s1 1 x1 2 x2 0
All variables 0.
12
Example-1: Solution
Introducing artificial variables R1, R2, we thus have to
Minimize r R1 R2
subject to the constraints
2 x1 1 1 R1 8
2 x2 1 2 R2 4
x1 x2 S1 2
1S1 1 x1 2 x2 0
13
Basic r x 1 x2 1 1 2 R1 R2 s1 Sol
2 2 2 -1 -1 0 0 0 12
r 1 0 0 0 0 0 -1 -1 0 0
R1 0 2 0 1 -1 0 1 0 0 8
R2 0 0 2 1 0 -1 0 1 0 4
S1 0 1 1 0 0 0 0 0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4 0 -1/4 1 0 1/4
S2 0 0 0 -1/2 -3/2 0 1/2 0 -1/2 0 1 5/2
r 1 0 0 1 2 -1 0 0 -1 -4 0 2
R1 0 0 0 1 2 -1 0 1 0 -4 0 2
x1 0 1 1 0 0 0 0 0 0 1 0 1
2 0 0 -2 -1 3 0 1 0 -1 4 0 1
20
S2 0 0 1 0 0 0 0 0 0 -2 1 2
Basic r x 1 x2 1 2 1 2 R1 R2 S1 S2 Sol
r 1 0 0 0 0 0 0 -1 -1 0 0 0
1 0 0 0 1 2 -1 0 1 0 -4 0 2
x1 0 1 1 0 0 0 0 0 0 1 0 1
2 0 0 -2 0 1 -1 1 1 -1 0 0 3
S2 0 0 1 0 0 0 0 0 0 -2 1 2
Maximize z 8x1 x 2 x2 x3
2
1
subject to
x1 3x2 2 x3 12
x1 , x2 , x3 0
22
Example-3: Solution
3. x1 3x2 2 x3 S1 12,
1S1 0
1 x1 2 x2 3 x3 0 All variables 0.
24
Basic r x1 x2 x3 1 1 2 3 R1 R2 R3 S1 Sol
2 0 0 6 -1 -1 -1 0 0 0 0 11
r 1 0 0 0 0 0 0 0 -1 -1 -1 0 0
R1 0 2 0 0 1 -1 0 0 1 0 0 0 8
R2 0 0 0 0 3 0 -1 0 0 1 0 0 2
R3 0 0 0 0 2 0 0 -1 0 0 1 0 1
S1 0 1 3 2 0 0 0 0 0 0 0 1 12
25
Basic r x1 x2 x3 1 1 2 3 R1 R2 R3 S1 Sol
r 1 0 0 0 5 0 -1 -1 -1 0 0 0 3
26
Basic r x 1 x2 x3 1 1 2 3 R1 R2 R3 S1 Sol
r 1 0 0 0 5 0 -1 -1 -1 0 0 0 3
27
Basic r x1 x2 x3 1 1 2 3 R1 R2 R3 S1 Sol
28
Basic r x1 x2 x3 1 1 2 3 R1 R2 R3 S1 Sol
r 1 0 0 0 0 0 0 0 -1 -1 -1 0 0
subject to
x1 x2 6
x1 4 x2 18
x1 , x2 0
Max z = 224
Using Excel solver, the opt solution is: x1=2, x2=4
30
Remark:
If the problem is a minimization problem, say, Minimize z,
we convert it into a maximization problem,
Minimize z = - Maximize ( -z ).
31