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
Claudio Maggioni (maggicl) ca2a294fc7 hw3: done MATLAB
2021-04-22 13:37:38 +02:00

8 lines
No EOL
227 B
Matlab

function alpha = backtracking(f, gf, p, x, alpha, rho, c)
xn = x + alpha * p;
while f(xn(1), xn(2)) > f(x(1), x(2)) + c * alpha * gf(x(1), x(2))' * p
alpha = rho * alpha;
xn = x + alpha * p;
end
end