In the unconstrained optimization we considered the problem of solving for the minimum of a function
minf(x) where f:RD→R
In the constrained optimization we have additional constraints. That is, for real-valued functions gi:RD→R for i=1,…,m, we consider the constrained optimization problem
minf(x)
subject to gi(x)≤0 for all i=1,…,m.
In general the functions f and gi could be non-convex in general.
One obvious, but not very practical, way of converting the constrained problem into an unconstrained one is to use an indicator function
J(x)=f(x)+∑mi=11(gi(x))
where 1(z) is an infinite step function
1(z)={0ifz≤0∞otherwise}This gives infinite penalty if the constraint is not satisfied and hence would provide the same solution.However, this infinite step function is equally difficult to optimize. We can overcome this difficulty by introducing Lagrange multipliers. The idea of Lagrange multipliers is to replace the step function with a linear function.
We associate to problem the Lagrangian by introducing the Lagrange multipliers λi≥0 corresponding to each inequality constraint respectively so that
=f(x)+λTg(x)
We now introduce the idea of Lagrangian duality. In general, duality in optimization is the idea of converting an optimization problem in one set of variables x(called the primal variables), into another optimization problem in a different set of variables λ (called the dual variables). We introduce two different approaches to duality:
Lagrangian Duality and Legendre-Fenchel Duality
Lagrangian Duality
The problem
minf(x)
subject to gi(x)≤0 for all i=1,…,m
is know as the primal problem, corresponds to the primal variable x.The associated Lagrangian dual problem is given by
maxD(λ),λ∈Rm
subject to λ≥0
where λ are the dual variables and D(λ)=minx∈RdL(x,λ)
Assume that f(.) and g(.) are differentiable, we find the Lagrange dual problem by differentiating the Lagrangian with respect to x, setting the differential to 0, and solving for the optimal value.
Equality constraints
Consider
minf(x)
subject to gi(x)≤0 for all i=1,…,m
hj(x)=0 for all j=1,…,n
We can model equality constraints by replacing them with two inequality constraints.
That is for each equality constraint hj(x)=0 we equivalently replace it by two constraints hj(x)≤0 and hj(x)≥0. It turns out that the resulting Lagrange multipliers are then unconstrained.Therefore, we constrain the Lagrange multipliers corresponding to the inequality constraints in equation to be non-negative, and leave the Lagrange multipliers corresponding to the equality constraints unconstrained.L(x,λ,v)=f(x0)+∑mi=1λgi(x)+∑ni=1vihi(x)
The optimal value of the dual problem is less than or equal to the optimal value of the Primal problem( weak duality)
D(λ,v)≤infL(x,λ,v)
Example:
Least Square problem ( find the dual)
Minimize ||x2||
Subject to Ax=b
L(x,v)=||x2||+∑vi(Ax−b)i
L(x,v)=xTx+vT(Ax−b)
▽xL(x,v)=2x+ATv=0
x0=−12ATv
So Lagrangian Dual is
D(v)=L(x0,v)=14vTAATv+−12vTAATv−vTb
=−14vTAATv−vTb
Example:
Dual of general LP.
Find the dual function of the LP
minimize cTx
subject to
Ax=b
x≥0
1. The Lagrangian is
L(x,λ,v)=cTx+λT.−x+vT(Ax−b)
L(x,λ,v)=cTx−λTx+vTAx−vTb
L(x,λ,v)=(cT−λT+vTA)x−vTb
The dual problem is
maximize D(λ,v) subject to λ≥0.
is having two options
−vTbifcT−λT+vTA=0
−∞ifcT−λT+vTA≠0unbounded this is not feasible
So the minimization LP problem become a maximization problem in standard LP form
Maximize −vTb
subject to
c+ATv≥0 because λ≥0
λi≥0
Example:
Minimize the function f(x,y)=x2+y2
Subject to the constraint x+2y−5=0
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=x2+y2+λ(x+2y−5)
∂L∂x=0,2x+λ=0
∂L∂y=0,2y+2λ=0
∂L∂λ=0,x+2y−5=0
from equation 1 λ=−2x so from equation 2 y=2x
from equation 3
x+2y−5=0
x+4x−5=0
x=1 So y=2
So the minimum is f(x,y)=x2+y2=f(1,2)=12+22=5
Example:
Minimize the function
f(x,y)=x2−10x+y2−14y+28
subject to the constraint x+y=8
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=x2−10x+y2−14y+28+λ(x+y−8)
∂L∂x=0,2x−10+λ=0
∂L∂y=0,2y−14+λ=0
∂L∂λ=0,x+y−8=0
Subtracting 2 from 1
2x−2y=4
x−y=2
y=x−2
Using the equation 3
x+y−8=0
x+x−2−8=0
x=5
so y=3
minimum value is f(5,3)=−38
Example:
Use the method of Lagrangian Multipliers to find the point that represent the minimum value for
f(x,y)=x2+y2 subject to the constraint x+4y=20
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=x2+y2+λ(x+4y−20)
∂L∂x=0,2x+λ=0
∂L∂y=0,2y+4λ=0
∂L∂λ=0,x+4y−20=0
Solving equation 1 and 2
x=2017
using equation 3
y=8017
The minimum point is (20/7,80/7) and the minimum value is 400/7
Example:
Maximize f(x,y)=2x+2xy+y subject to the constraint 2x+y=100
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=2x+2xy+y+λ(2x+y−100)
∂L∂x=0,2y+2λ=0
∂L∂y=0,2x+λ=0
∂L∂λ=0,2x+y−100=0
Solving equation 1 and 2 we will get
x=25
So
y=50
The maximum point is (25,50) and the value is 2600
Example:
Maximize the function f(x,y)=2xy subject to the constraint x+y=6
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=2xy+λ(x+y−6)
∂L∂x=0,2y+λ=0
∂L∂y=0,2x+λ=0
∂L∂λ=0,x+y−6=0
from the first two equations
2y−2x=0
y=x
from equation 3
2x−6=0
x=3
So y=3
So the maximum occurs at (3,3) and the value is f(x,y)=2xy=2.3.3=18
Example:
optimize f(x,y)=xy+1 with the constraint
g(x,y)=x2+y2−1=0
L(x,y,λ)=f(x,y)+λg(x,y)
L(x,y,λ)=xy+1+λ(x2+y2−1)
∂L∂x=0,y+λ2x=0
∂L∂y=0,x+λ2y=0
∂L∂λ=0,x2+y2−1=0
From the first equation
x=−y2λ
putting it into second
−y2λ+λ2y=0
−y+4λ2y=0
y(4λ2−1)=0
This means that y=0 or 4λ2−1=0
so
λ=±12
when y=0 x=±1 from equation 3
so we have two points (1,0), (−1,0)
when λ=±12
y=x or y=−x
So
using equation 3
x2+x2−1=0
2x2=1
x=±1√2
So we have four points
(1√2,1√2),(1√2,−1√2),(−1√2,1√2),(−1√2,−1√2)
f(x,y)=f(1√2,1√2)=14+1=54
f(x,y)=f(1√2,−1√2)=−14+1=34
f(x,y)=f(−1√2,1√2)=−14+1=34
f(x,y)=f(−1√2,−1√2)=14+1=54
f(x,y)=f(1,0)=1
f(x,y)=f(−1,0)=1
From this maximum and minimum can be found very easily.
Example:
Maximize the function f(x,y,z)=xy+yz+xz on the unit sphere g(x,y,z)=x2+y2+z2=1
L(x,y,z,λ)=xy+yz+xz+λ(x2+y2+z2−1)
∂L∂x=0,y+z+λ2x=0
∂L∂y=0,x+z+λ2y=0
∂L∂z=0,y+x+λ2z=0
∂L∂λ=0,x2+y2+z2−1=0
From the first two equations
x−λ2x−y+λ2y=0
x(1−2λ)−y(1−2λ)=0
(1−2λ)(x−y)=0
when x−y=0,we have x=y
so from equation 4 we have
x2+x2+z2=1
2x2+z2=1
z=±√1−2x2
So the points (x,x,√1−2x2) and (x,x,−√1−2x2) represents maximum value of f(x,y,z)
when x≠y we have (1−2λ)=0
so λ=12
which results in equation x+y+z=0 so z=−x−y
f(x,y,z)=xy+y(−x−y)+x(−x−y)
f(x,y,z)=xy−xy−y2−x2−xy
f(x,y,z)=−xy−y2−x2 which is always negative
Example:
Find the extreme values of the function f(x,y)=x2+2y2 on the
circle x2+y2=1.
Using Lagrange multipliers,
fx=λgx
fy=λgy
which results in following equations
2x=λ2x.........(1)
4y=λ2y..........(2)
x2+y2=1...............(3)
From equation (1) x=0 or λ=1 when x≠0
From equation (3) when x=0 , y=±1
This result in f has extreme values at points (0,1), (0,−1)
When λ=1 from equation(2) y=0
This result in extreme points (1,0) and (−1,0)
Evaluating f at these four points, we find that
f(0,1)=2
f(0,−1)=2
f(1,0)=1
f(−1,0)=1
Therefore the maximum value of f on the circle x2+y2=1 is f(0,±1)=2 and minimum value is f(±1,0)=1
Example: Lagrangian Duality
You can write the Lagrangian as:
So we can get the gradient and putting it equal zero:
and we have these solutions: , and .
Example:
Find the extrema of f(x,y)=x subject to g(x,y)=x2+2y2=3.
fx=λgx
1=λ2x
x=12λ
fy=λgy
0=λ4y
y=0
When y=0.x=±√3
when y≠0,x=∞
So
f(√3,0)=√3
f(−√3,0)=−√3
f(∞,y)=∞
so the maximum is √3 and minimum is −√3
Example
Find the maximum value of f(x,y,z)=xyz given that g(x,y,z)=x+y+z=3 and x,y,z>=0.L(x,y,z,λ)=xyz+λ(x+y+z−3)
∂L∂x=0,yz+λ=0
∂L∂y=0,xz+λ=0
∂L∂z=0,xy+λ=0
∂L∂λ=0,x+y+z−3=0
The first 3 equation implies that
xz=yz=xy
xz=yz
z(x−y)=0
so
x=y
we have xz=xy
so xz=x.x
x=z
This implies that x=y=z
putting it into equation 4 x+y+z−3=0
3x−3=0
3(x−1)=0
So x=1,y=1,z=1 is the maximum and the value is f(x,y,z)=1.1.1=1
Comments
Post a Comment