armijo matlab,using MATLAB to do steepest descent algorithm(use Armijo) ,aiming at finding the extre...

Steepest-descent-algorithm-Matlab-

用MATLAB实现最速下降法(使用梯度作为下降方向的无限制最优化方法)。使用Armijo准则找步长。

using MATLAB to do steepest descent algorithm(unconstrained optimization method that uses gratitude vector as descent direction), and find steps by Armijo principle.

English version is placed behind the Chinese one.

一. 背景简述

1.最速下降法的常用的迭代格式为

min f(x)

xk+1 = xk + αkdk, k =0,1,...

x0为初始向量,dk为f(x)在xk处的下降方向,αk > 0为步长。

在最速下降法中,dk取负梯度方向-gk。步长采用Armijo准则进行非精确一维搜索。

2.Armijo准则:

设f(x)连续可微,dk是f(x)在xk处的下降方向,给定𝜌 ∈ (0, 1), β ∈ (0,1), 我们寻找使得下式成立的最小正整数𝑚𝑘 :

f(xk + β^mdk) ≤ f(xk) + ρβ^mgkTdk

我们需要的步长𝛼𝑘 = 𝛽^𝑚𝑘

二. 算法简述

步骤1:给出初值𝑥𝑜 以及精度eps

步骤2:计算gk = -∇f(xk);如果|gk| < eps,停止,输出𝑥𝑘;否则转步骤3。

步骤3.由Armijo准则搜索线性步长因子𝛼𝑘

步骤4.计算xk+1 = xk + αkdk ,𝑘 = 𝑘 + 1,转步骤2.

三. Matlab实现

程序包含4部分,分别是:

最速下降法主函数 steepest1.m;

求梯度函数 fun_grad1.m;

测试函数 fun1.m;

求Armijo步长因子函数 armijo1.m

I.Background explanation

1.The literation form of steepest descent algorithm:

min f(x)

xk+1 = xk + αkdk, k =0,1,...

x0 is the initialization vector,dk is the descent direction of f(x) at xk.

In steepest descent algorithm, dk = -gk, where gk is gratitude vector.

Here I use Armijo principle to set the steps of inexact line search .

II.Armijo Principle

Set f(x) to be continuously differential,and dk is the descent direction of f(x) at xk,

Given 𝜌 ∈ (0, 1), β ∈ (0,1), we are trying to find the least possible integer that satisfy the following inequality:

f(xk + β^mdk) ≤ f(xk) + ρβ^mgkTdk

And the step we actually need is such: 𝛼𝑘 = 𝛽^𝑚𝑘

II.Steps of the algorithm

Step1.Set the initial vlue x0 and precision eps

Step2.Calculate 'gk':gk = -∇f(xk); If |gk| < eps, stop and output xk; Otherwise, turn to Step 3.

Step3.Set the step 𝛼𝑘 by Armijo principle.

Step4.Caculate 'xk+1':xk+1 = xk + αkdk ,𝑘 = 𝑘 + 1; Turn to Step2.

Matlab code structure:

The codes are formed by four parts:

Main function of steepest descent method: steepest1.m

the function used to get the gratitude:fun_grad1.m

the testing function :fun1.m

the function used to get the step :armijo1.m

1ba96aff7d47804f2365e7eef45df7b6.png

3f0ad597918ac1822a44baba113e48d1.png

e946ed48753c418f7aa57b9d84d589fa.png

f3c0ae493551d6407d266ebeb2c6cae0.png

a16a2f846457988dba628bcdf8624312.png

037ced71bd602cae617ccc5c0d8162d7.png

.

.

.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值