Wolfe和Armijo准则之Matlab实现

Wolfe准则

复制代码
function [alpha, newxk, fk, newfk] = wolfe(xk, dk)
rho = 0.25; sigma = 0.75;
alpha = 1; a = 0; b = Inf;
while (1)
if ~(fun(xk+alpha*dk)<=fun(xk)+rho*alpha*gfun(xk)'*dk)
b = alpha;
alpha = (alpha+a)/2;
continue;
end
if ~(gfun(xk+alpha*dk)'*dk >= sigma*gfun(xk)'*dk)
a = alpha;
alpha = min([2*alpha, (b+alpha)/2]);
continue;
end
break;
end
newxk = xk+alpha*dk;
fk = fun(xk);
newfk = fun(newxk);
复制代码


Armijo准则

复制代码
function mk = armijo(xk, dk)
beta = 0.5; sigma = 0.2;
m = 0; mmax = 200;
while (m<=mmax)
if(fun(xk+beta^m*dk) <= fun(xk) + sigma*beta^m*gfun(xk)'*dk)
mk = m; break;
end
m = m+1;
end
alpha = beta^mk
newxk = xk + alpha*dk
fk = fun(xk)
newfk = fun(newxk)
©️2020 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值