拉格朗日乘子法

326 篇文章 2 订阅
183 篇文章 6 订阅

Lagrange Multipliers

The method of Lagrange multipliers is a method for finding extrema of a function of several variables restricted to a given subset.

Let us begin with an example. Find the maximum and minimum of the function z=f(x,y)=6x+8y subject to the constraint g(x,y)=x^2+y^2-1=0. We can solve this problem by parameterizing the circle and converting the problem to an optimization problem with one independent variable, that can be tackled using techniques from single variable calculus. In this section we apply the method of Lagrange multipliers instead.

The key to understanding this technique is the following figure, which plots the constraint function and the level curves of f(x,y).

The constraint function is the circle of radius 1 centered at the origin. Recall that the level curves of f(x,y)=6x+8y are the curves defined by 6x+8y=C, where C is a constant. These curves are the straight lines in the figure . On 6x+8y=C, f(x,y)=C. The value of C is listed on each level curve in the figure. As the plot shows, the function of f(x,y) takes on values between -10 and 10 for points on the circle. Hence, the maximum is 10 and the minimum is -10.

Note that the maximum and minimum occur at points where the constraint curve is tangent to the level curve! There is another way to characterize the extreme points: the maximum and minimum occur at points where the normal to constraint curve and the normal to level curve point in the same direction! The vectors at the max and min in the figure above are the normal vectors.

As discussed previously, the gradient vector

displaymath23

is normal to the level curve of f through (x,y). It turns out that the normal vector to the constraint curve is the gradient of g:

displaymath25

Why is this last fact true? Let z=g(x,y). The constraint curve g(x,y)=0 is a level curve corresponding to 0. Hence, the gradient vector of g(x,y) on the constraint curve is normal to the constraint curve.

At the maximum and minimum points the normal vectors point in the same direction. That means that the normal vectors are multiples of each other:

displaymath27

Here the unknown multiplier

displaymath29

is called the Lagrange multiplier. For the case of functions of two variables, this last vector equation can be written:

displaymath31

For our problem

displaymath33

and

displaymath35

Hence, the above vector equation consists of the following 2 equations

displaymath37

and

displaymath39

These last 2 equations have 3 unknowns: x, y, and lambda. We need a third equation to solve for the 3 variables. The third equation is the constraint equation:

displaymath41

We now solve these last equations. Solving for x and y in the first two equations, we have:

displaymath43

Substituting these expressions for x and y in the constraint equation, we have:

displaymath45

Solving this last equation, we obtain lambda=+5 and lambda =-5. If lambda=5, then x=3/5 and y=4/5 and f(x,y)=10. This is maximum value of f(x,y). If lambda=-5, then x=-3/5 and y=-4/5 and f(x,y)=-10. This is the minimum value of f(x,y).

In general, the equations that must be solved simultaneously are nonlinear, and there is no simple recipe for solving them.

The Lagrange multiplier technique can be applied to problems in higher dimensions. Consider the problem: find the extreme values of w=f(x,y,z) subject to the constraint g(x,y,z)=0. In this case we get the following 4 equations for the 4 unknowns x, y, z, and lambda.

displaymath47

displaymath49

displaymath51

and the constraint equation:

displaymath53

For this problem, the constraint is a surface in xyz space.


来源:http://www.math.oregonstate.edu/home/programs/undergrad/CalculusQuestStudyGuides/vcalc/lagrang/lagrang.html
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
拉格朗日乘子法是一种优化算法,应用于具有约束条件的优化问题。它的原理是基于拉格朗日乘子的概念,在求解有约束问题的时候,将约束条件转化为目标函数的一部分,通过求解该新的目标函数,得到问题的最优解。 在使用拉格朗日乘子法时,首先根据问题的约束条件构造拉格朗日函数。拉格朗日函数是由目标函数和约束条件组成的,目标函数会被调整为加入拉格朗日乘子与约束条件的乘积,同时每个约束条件都会有一个对应的拉格朗日乘子。然后,通过求取拉格朗日函数的偏导数,将其等于0,可以得到一组方程,包括目标函数的梯度和约束条件的梯度。将这些方程联立求解,就可以得到问题的最优解。 对于拉格朗日函数的求解,可以采用数值方法,例如使用fmincon算法。fmincon是一种非线性约束最小化算法,可以求解具有非线性约束的优化问题。它的实现基于拉格朗日乘子法,通过迭代的方式逼近最优解。在每一次迭代中,通过求解一组子问题,不断调整拉格朗日乘子的值,直到找到最优解为止。 总之,拉格朗日乘子法是一种基于拉格朗日函数的优化算法,通过将约束条件转化为目标函数的一部分,再利用数值方法求解最优解。而fmincon算法则是一种具体的数值方法实现,可以应用于求解具有非线性约束的优化问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值