jhadida/gpso

Undefined 'f4' in minimize.m

Closed this issue · 0 comments

https://github.com/jhadida/gpso/blob/master/gpml/util/minimize.m

While running the code, the run was terminated with an error 'undefined variable f4' in the script minimize.m. So looking at the script, at ln 125, we have the following:

while (abs(d3) > -SIGd0 || f3 > f0+x3RHOd0) && M > 0 % keep interpolating
if d3 > 0 || f3 > f0+x3
RHOd0 % choose subinterval
x4 = x3; f4 = f3; d4 = d3; % move point 3 to point 4
else
x2 = x3; f2 = f3; d2 = d3; % move point 3 to point 2
end
if f4 > f0
x3 = x2-(0.5
d2*(x4-x2)^2)/(f4-f2-d2*(x4-x2)); % quadratic interpolation
else .....

if d3 > 0 || f3 > f0+x3RHOd0 is true, then x4 = x3; f4 = f3; d4 = d3; will be executed and hence f4 is defined. However, if not true, then f4 will not be defined. And on ln 130, it follows with this condition: if f4 > f0... So if f4 is not defined, then there will be an error and the run terminates.

Could I seek clarifications on the above issue? Thank you.