Line Search Method 1 - 步长计算 (Step length calculation)

本文是一系列关于 Numerical Optimization 的博客的第一篇,主要讨论 Line Search Method 中步长 α 的计算。
该系列博客以 Nocedal 的 Numerical Optimization 一书(2006年第二版,下面简称“该书”)为主题,讨论书中的内容,并结合自己的仿真进行更生动形象的解释。博客中所有在图例中带有 “Figure” 的图片都是从Numerical Optimization 一书中截取的,在此予以说明。

在该书的前两张,作者主要对优化算法进行了入门的介绍,以及一些数学基础知识的回顾。从第三章开始将介绍主要内容,其中第三章主要介绍 Line Search Method。

Line Search Method,顾名思义,就是在某条线上去搜索下个迭代点的位置,即

xk+1=xk+αkpk
其中, pk 是(下降的)方向, αk 是步长。这就体现出其与 Trust Region Method 的不同之处,因为后者是在当前迭代点的某个邻域内去寻找下个迭代点的值。关于 Line Search Method 中所沿的那条线,具体不同的方法有不同的选择。比如最速下降法(Steepest Descent Method)就是直接取当前点导数的反方向,即 f(x) ,而在牛顿法中的方向的选取则为 2f(x)1f(x) ,在拟牛顿法中则有另外的选取方法,但这些方法所选取的方向都有一个共同之处就在于要求目标函数值在当前点沿着这个方向是下降的,即
pTkfk<0
在本文接下来的内容中会主要介绍步长 α 的选取,也就是说,在这里我们认为方向 pk 已经确定了,然后接下来的工作是找到一个合适的步长 α 。首先,我们能想到的就是求解一个单变量的优化命题,让原目标函数在该方向上取得最大的下降量,即
minϕ(α)=f(xk+αpk),α>0
但一般来说,得到上面这个优化优化命题的解的代价往往很大,因为即使是单变量优化命题,如果目标函数形状很奇怪的话,如下面 Figure 3.1 ,这个方向上的最优点也是很难求的。

这里写图片描述

这里要说明的一点是,为了保证算法能最终收敛到极小点,那么对 α 一定是有要求的。比如,如果我们只是单纯保证 α 的选取能使得目标函数之逐步下降的话,那么这是不足够的,例如下图 Figure 3.2,目标函数的最小值是-1。如果我们选取补偿使得目标函数的值以 f(xk)=5/k,k=1,2,... 这样的级数收敛的话,那么函数值将最终收敛到0而非最优值-1。

这里写图片描述

因此,步长

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The Cortex-M0 processor does not have a hardware divider, which means that division calculations are performed using software routines. There are various algorithms for performing software division, but one commonly used method is called "long division". In long division, the divisor is repeatedly subtracted from the dividend until the remainder is less than the divisor. The number of times the divisor is subtracted is the quotient, and the remainder is the final result. This process is repeated until all digits of the dividend have been processed. Here is a sample code for performing integer division on Cortex-M0 using long division: ``` int divide(int dividend, int divisor) { int quotient = 0, remainder = 0; int sign = ((dividend < 0) ^ (divisor < 0)) ? -1 : 1; // convert both operands to positive if (dividend < 0) dividend = -dividend; if (divisor < 0) divisor = -divisor; // perform long division for (int i = 31; i >= 0; i--) { remainder <<= 1; // left shift remainder remainder |= (dividend >> i) & 1; // add next bit from dividend to remainder if (remainder >= divisor) { remainder -= divisor; quotient |= (1 << i); // set corresponding bit in quotient } } // apply sign quotient = sign * quotient; return quotient; } ``` Note that this code assumes that both the dividend and divisor are 32-bit integers. It also handles negative operands correctly and applies the correct sign to the result. However, it may not be the most efficient implementation and may need to be optimized for specific use cases.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值