Hi,
I'm having a lot of trouble with the Matlab optimizer. Right now, I'm just trying to get the solver working by optimizing on one variable then I will move on to the full optimization problem using all variables.
I keep getting an error saying "my initial point is a local minimum". I know this isn't the case because I've done some manual optimization and I've on purposely set the starting point to be away from the minimum.
It also says "Optimization completed because the size of the gradient at the initial point is less than the selected value of the function tolerance". I'm not sure what this means exactly. I've tried setting 'TolFun' in the options to larger values and I still get the same error.
This is my code so far:
x0 = 10
f = @(x)optimfun(input1, input2, input3, x);
options = optimoptions(@fminunc,'Algorithm','quasi-newton','TolFun',0.01);
[x,fval,exitflag,output] = fminunc(f,x0,options);
optimfun is a custom function that I build that calls a series of subroutines to process images.
I've tried different values for x0 (note: x0 is a continuous variable) and different values for TolFun right from 1e-6 to 10. I get the same error regardless.
From my manual optimization, I know that different values of x gives the following results
x = 9; fval = 0.612
x = 9.5; fval = 0.602
x = 10; fval = 0.6140
x = 10.5; fval = 0.623
I know the real minimum point should be somewhere around 9.5 but no matter what I set x0 to be, it is always the "optimal point" according to the solver.
I'm really confused and some help with this would be great.
Thanks