forked from markomil/vilin-numerical-optimization
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixedStepSize.m
More file actions
32 lines (25 loc) · 1.39 KB
/
FixedStepSize.m
File metadata and controls
32 lines (25 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [ outT, outX, outVal, outGr, evalNumbers ] = FixedStepSize( functionName, params )
% ------------------ ******************* ------------------
% * *
% * ************************************* *
% * * * *
% * * Fixed step size * *
% * * * *
% * ************************************* *
% * *
% ------------------ ******************* ------------------
% This is fixed step size line search which means that in each iteration
% fixed value of step size is used.
% ------------------ ******************* ------------------
% set initial values
evalNumbers = EvaluationNumbers(0,0,0);
x0 = params.startingPoint;
dir = params.dir;
t = params.tInitStart; % starting value for t
% save output values
xmin = x0 + t*dir;
outX = xmin; outT = t;
% compute function and gradient value in current point xmin
[outVal, outGr, ~] = feval(functionName, xmin, [1 1 0]);
evalNumbers.incrementBy([1 1 0]);
end