Nonlinear Programming Only
Nonlinear Programming Only
Presented by
Maximum/ Minimum f ( X )
subject to: g i ( X ) = bi i = 1,2,..., n
For examples
Maximum f ( X ) = x1 + x2 − x1 x2 + 5
2 2
subject to: x1 + 2 x2 = 5
x1 , x2 0
x +2 x −4
Maximum f ( X ) = 2 x1 + 2 x2 − 3 x3 Minimize f ( X ) = e 1 + e 2
x12 + x22 = 1 subject to: x1 + 4 x2 = 11
2
subject to:
2 x1 − 4 x2 + 3x3 5 x1 , x2 0
x1 , x2 , x3 0
Quadratic form/ function
Suppose, we have n variables, the quadratic form or quadric form can be written
as
f ( X ) = a11 x12 + a22 x22 + .....+ ann xn2
+ a12 x1 x2 + a13 x1 x3 + ... + a1n x1 xn
...........
+ an1 xn x1 + an 2 xn x2 + ... + an −1n xn −1 xn
We can express the given quadric form into
f ( X ) = X T AX
aij ; i= j
aij = a ji
aij = aij and
; i j
2
For example 1:
Example 2: Example 3:
f ( X ) = [ x1 x2 x3 ] 0 2 0 x2 1 0 x1
f ( X ) = [ x1 x2 ] x
0 0 − 3 x3 0 0 2
x1
+ [1 − 2] + 10
x2
Definiteness
Indefinite: A function which is neither positive nor negative definite is called Indefinite.
Positive Definite
If X T AX 0 for all X 0
For example:
Negative Definite
If X T AX 0 for all X 0
For example:
f ( X ) = − x12 − 2 x22 − 3 x32 is negative definite
since f ( X ) 0 for all X = ( x1 , x2 , x3 ) (0,0,0)
Positive semi-definite
If X T AX 0 for all X 0
and at least one X 0 for which X T AX = 0
For example:
Negative semi-definite
If X T AX 0 for all X 0
and at least one X 0 for which X T AX = 0
For example:
For example:
f ( X ) = x12 − 2 x22
X = (1, 1) ; f ( X ) = −1 0
X = (3,−1) ; f ( X ) = 7 0
Hence it is indefinite.
Remark: Sometimes, it is not easy to check the definiteness of the function quickly
For example:
f ( X ) = 3 x12 + 2 x22 − 6 x32 + x1 x2 − 2 x2 x3 + 9 x1 x3 + 100
Clearly, the definiteness of the function f ( X ) depends on the nature of Matrix A in X T AX .
So, there are two methods to check the definiteness of the function:
1. Matrix Minor Test: For any square matrix A, we define the principle matrix
minor (any submatrix of order m) which contains first m elements of the principle
diagonal
D1 0; D2 0; D3 0;.... D1 0; D2 0; D3 0;....
and at least one Di = 0 for i = 2,3,..., n
D1 0; D2 0; D3 0;.... D1 0; D2 0; D3 0;....
i.e. alternative sign, but first i.e. alternative sign, and at least one Di = 0 for
principal minor should be negative i = 2,3,..., n
If all i 0 If all i 0
and at least one i = 0
− 3 − 5 3 x1
f ( X ) = [ x1 x2 x3 ] − 5 2 2 x2
3 2 − 3 x3
T − 3 − 5 3
A = − 5 2
X A X
2
Hence, the principal minors are:
3 2 − 3
D1 = −3
−3 −5
D2 = = − 31 0 Since, D1 0; D2 0; D3 0
−5 2
So, the function is indefiniteness.
−3 −5 3
D3 = − 5 2 2 = 27 0
3 2 −3
Example:
f ( X ) = − x12 − x22 + 2 x1 + 3 x2 + 2
So, we get
− 1 0 x1 x1
f ( X ) = [ x1 x2 ] + [2 3] + 2
0 − 1 x2 x2
1. Matrix Minor Test
D1 = −1 0 Since, D1 0; D2 0
−1 0
D2 = = 1 0 So, the function is negative definite.
0 −1
2. Eigen Value Test
The eigen values are -1, -1. As both are negative. Hence it is negative definite.
f ( X ) = 3e 2 x1 +1 + 2e x2 +5
We are unable to compute the quadratic form of this f ( X ) . We can’t define A.
Hessian Matrix
For a function f ( X ) of n variables such that f ( X ) C , where C 2 is the space of
2
all real functions whose second order partial derivatives are continues. Then Hessian
matrix of f ( X ) is n n symmetric matrix of second order partial derivatives
defined by
2 f 2 f 2 f
. . .
x12 x1x2 x1xn
2 f 2 f 2 f
. . .
x2 x1 x22 x2 xn
H = . . .
. . .
. . .
f2
2 f 2 f
. . .
xn x1 xn x2 xn2
H = 2A
So, we can check the definiteness of the function based on the Hessian matrix
H by using principal matrix minors as well as eigen value test, as similar to A.
Example: Construct the Hessian matrix for the function & check its definiteness
f ( X ) = 3e 2 x1 +1 + 2e x2 +5
We know:
2 f 2 f
x12 x1x2 12e 2 x1 +1 0
H= =
2 f f 0
2
2e x2 +5
x2 x1 x22
D1 = 12e 2 x1 +1 0 Since, D1 0; D2 0
4 0 0
H = 0 2 0
0 0 6
Do it by yourself
Convex Function
A function f : S → R is said to be convex if
f ( X 1 + (1 − ) X 2 ) f ( X 1 ) + (1 − ) f ( X 2 )
f ( X ) is convex D1 0; D2 0; D3 0;....
H is positive semi-definite and at least one Di = 0 for i = 2,3,..., n
f ( X ) is strictly convex
D1 0; D2 0; D3 0;....
H is positive definite
f ( X ) is concave D1 0; D2 0; D3 0;....
− f (x ) is convex i.e. alternative sign, but first
principal minor should be negative
Remark:
Example: Construct the Hessian matrix for the function & check its definiteness
f ( X ) = x12 + x22 + x1 + x2 − 1
2 f 2 f
x 2
x1x2 2 0
H = 2 1
=
f 2 f 0 2
x2 x1 x22
Hence, the principal minors of H are:
D1 = 4 0 Since, D1 0; D2 0 The function is positive definite.
2 0
D2 = = 40 Thus, f ( X ) is strictly convex. Hence it will give
0 2 Minimum.
Example: Construct the Hessian matrix for the function & check its definiteness
f ( X ) = 4 x1 + 6 x2 − 2 x12 − 2 x1 x2 − 2 x22 + 41
2 f 2 f
x12 x1x2 − 4 − 2
H= =
2 f 2 f − 2 − 4
x2 x1 x22
Hence, the principal minors of H are:
D1 = −4 0 Since, D1 0; D2 0 The function is negative definite.
−4 −2
D2 = = 12 0 Thus, f ( X ) is strictly concave. Hence it will give
−2 −4 Maximum.
Remark/ Properties
Every U-shape function is convex function. eg. x2
A function which is both convex and concave, then it has to be linear
function.
A convex/ concave function need not to be differential.
For example: f ( x ) =| x |: x R is convex but not differentiable.
If f and g are two convex functions over the convex set, then
f + g ; f ( 0) ; max( f , g ) are also convex function.
For example f ( x ) = − x + 2 x + | x | is convex function.
2
Necessary Condition:
Sufficient Condition:
( n −1)
Let, f '
( x *
) = f ''
( x *
) = ... = f ( x *
) = 0 but, f (n)
( x *
) 0 . Then f ( x *
) is
We have:
f ' ( X ) = 4x3 f ' ( X ) = 0 x=0
f 3 ( X ) = 24 x f 3 ( x* ) = 0
f 4 ( X ) = 24 x f 4 ( x* ) = 24 0
Hence, x = 0 is the minimum point.
Example: Find the maximum or minimum of the function
f ( X ) = 12 x 5 − 45 x 4 + 40 x 3 + 5
Necessary Condition:
f 1 ( X ) = 60 x 4 − 180 x 3 + 120 x 2
f 1 ( X ) = 60 x 2 ( x 2 − 3 x + 2) f 1 ( X ) = 60 x 2 ( x − 1)( x − 2)
Hence f 1 ( X ) = 0 x = 0, 1, 2
Sufficient Condition:
At x=0
f 2 ( X ) = 60(4 x 3 − 9 x 2 + 4 x) f 2 ( 0) = 0 At x=1
f 2 (1) = −540 0
f 3 ( X ) = 60(12 x 2 − 18 x + 4) f 3 ( 0) = 0
So, Maximum i.e. f ( X ) = 12
f 4 ( X ) = 60(24 x − 18) f 4 ( 0) = 0
f ( X ) = 1440
5 f 5 (0) = 1440 0 At x=2
f 2 ( 2) = 240 0
Since, n is odd so neither
So, Minimum i.e. f ( X ) = −11
minimum nor maximum
For Higher-dimensional functions: We will use Hessian Matrix H.
f f f
=0; = 0 ......... =0
x1 x2 xn
and find the stationary points.
f ( X ) is convex D1 0; D2 0; D3 0;....
H is positive semi-definite
and at least one Di = 0 for i = 2,3,..., n
Minimum Point
f ( X ) is strictly convex
H is positive definite D1 0; D2 0; D3 0;....
Minimum Point
f ( X ) is concave D1 0; D2 0; D3 0;....
− f (x ) is convex
i.e. alternative sign, but first
Maximum Point principal minor should be negative
Example: Find the maximum or minimum of the function
f ( X ) = 4 x1 + 6 x2 − 2 x12 − 2 x1 x2 − 2 x 2 + 41
Necessary Condition:
f
= 0 4 − 4 x1 − 2 x2 = 0
x1
Thus the stationary point is ( x1 , x2 ) = (1 / 3,4 / 3) .
f
= 0 6 − 2 x1 − 4 x2 = 0
x2
Sufficient Condition:
− 4 − 2
The Hessian matrix will be H =
− 2 − 4
Hence, the principal minors of H are:
D1 = −4 0 Since, D1 0; D2 0 The function is negative definite.
−4 −2
D2 = = 12 0 Thus, f ( X ) is strictly concave. Hence it will give
−2 −4 Maximum.
Example: Find the maximum or minimum of the function
Necessary Condition:
f
= 0 x1 (3x1 + 4) = 0 Thus the stationary points are
x1 (.0,0) (0,−8 / 3)
f
= 0 x2 (3x2 + 8) = 0 (−4 / 3,0) (−4 / 3,−8 / 3)
x2
Sufficient Condition:
6 x1 + 4 0
The Hessian matrix will be H =
0 6 x 2 + 8
Hence, the principal minors of H are:
D1 = 6 x1 + 4
6 x1 + 4 0
D2 =
0 6 x2 + 8
Point X Value of D1 Value of D2 Nature of H Nature of X f(x)
Positive
(0,0) 4 32 Minimum 6
definite
Hence,
Minimum at (0,0) i.e. 6
Maximum z = x1 + 3x2 + 5 x3
2 2 2
Example
subject to: x1 + x2 + 3x3 = 4 only one equality constraint
Example
Maximum z = x12 + 3 x22 + 2 x32 − 2 x1 x2 + 3 x1 x3 − 100
Minimize f (X )
subject to: g(X ) = b
can be converted to
Minimize L( X , ) = f ( X ) + ( g ( X ) − b)
Necessary Conditions:
L L
=0 & =0
X
After solving these equations, we get a stationary point(s) ( X * , * ) .
Sufficient Conditions:
We first compute the bordered Hessian matrix H B as
0 U
H = t
B
is a (m + n) (m + n) matrix. mn
U V
m is number of constraints
n is number of variables g g 2L
where X X X X
g g g g 2L
1 2 1 n
U = = .... V = 2 =
X x1 x2 xn mn X 2
L L
2
L
2
X X X X
0 mm : Null matrix of size m m . n 1 n 3 X n2 nn
At a stationary point ( X * , * )
Starting with principal minor of order 2m+1. Compute the last n-m principal minors of H B
at the point ( X * , * ) is
Maximum point if the principal minors form on alternative sign starting with ( −1) .
m+ n
Minimum point if the principal minors form of H B have the sign of (−1) m .
Example: Min f ( X ) = Z = x 21 + x 22 + x 23
subject to: x1 + x 2 +3 x3 = 2
5 x1 + 2 x2 + x3 = 5
37 16 13 2 7
( x1 , x 2 , x 3 , 1 , 2 ) = , , , ,
46 46 46 23 23
Sufficient Conditions:
So, we will find the necessary and sufficient conditions for solving the NLPP with
inequality constraints.
Consider the each i th inequality constraints into equations by adding the non-negative
slack variables S i2
g i ( X ) + S i2 = bi
or hi ( X ) = g i ( X ) + S i2 − bi
Thus, given NLPP reduces to
Maximum f ( X )
subject to: hi ( X ) = 0
h (X )
L( X , S , ) = f ( X ) −
i
i i
= f ( X ) − (g ( X ) + S
i i i
2
− bi )
i
Necessary Condition:
L f g i
X
=0
X
− i
i X
=0 (1)
L
= 0 g i ( X ) + Si2 − bi = 0 (2)
i
L
= 0 − 2i Si = 0 (3)
Si
1
In (3), multiply by Si , we get
2
i S i2 = 0
or
i (− g i ( X ) + bi ) = 0 (4)
From equation 3, we have either i = 0 or S i = 0 or both vanish at the optimal conditions:
Case 1: when S i 0
g i ( X ) + S i2 = bi
g i ( X ) bi when S i 0
Maximum f ( X ) Minimum f ( X )
f g i
f
−
g
i i = 0 X
− i X
=0
X i X i
i ( gi ( X ) − bi ) = 0 i ( gi ( X ) − bi ) = 0
g i ( X ) bi gi ( X ) bi
i 0 i 0
Sufficient Conditions:
The Kuhn-Tucker conditions which are necessary by Kuhn-Tucker condition are also
sufficient if
f ( X ) is Concave and (for maximization)
The feasible space i.e. g i ( X ) is convex.
or
f ( X ) is Convex and (for minimization)
The feasible space i.e. g i ( X ) is convex.
Hence, the KKT necessary conditions are also sufficient for on global maximum of f ( X )
*
at x .
Example: Find the maximum of the function
Case 1: = 0 Case 2: 0
From 1 and 2 From equation 3
x1 = 4.5, x2 = 4 2 x1 +x 2 −10 = 0 (7)
But using equation (5) From equation 1 & 2
3.6 − 2 1.6 −
2 x1 +x 2 10 2(4.5) + 4 10 x1 = x2=
0.8 0.4
13 10 Therefore using (7)
which is not true. Hence this point 3.6 − 2 1.6 −
will be rejected. 2( )+( ) = 10 = 0.4
0.8 0.4
Hence
x1 = 3.5, x2= 3
The sufficient conditions
Also, the constraints 2 x1 +x 2 10is in linear form and we know that every linear function is
convex.
Hence, the KKT necessary conditions are also sufficient conditions for the maximum.
Example: Find the maximum of the function
Max f ( X ) = Z = 12 x1 +21x 2 +2 x1 x 2 −2 x 21 −2 x 22
subject to: x1 +x 2 10 , x 2 8
x1 , x 2 0
First, define the Lagrangian function as:
L( X , ) = f ( X ) − 1g 1( X ) − 2 g 2 ( X )