This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
OM/Claudio_Maggioni_3/backtracking.m

8 lines
231 B
Mathematica
Raw Normal View History

2021-04-19 09:23:32 +00:00
function alpha = backtracking(f, xk, alpha_bar, pk, rho, c)
alpha = alpha_bar;
gf = gradient(f);
while at(f, xk + alpha * pk) > at(f, xk) - c * alpha * dot(at(gf, xk), pk)
alpha = alpha * rho
end
end