Hi all

I’m trying to improve how to use Optim in Scilab, so I’m still using the basic Rosembrock function; in the example hereafter, one can see that Optim goes back the Error flag to 3 and I do not understand why?

The goal is to be able to check all the values of this flag in order to validate the result ; while the values are the optimized ones, the calculation indicates that the optimization fails …

I’m a bit loss … so any feedback will be appreciated

Thanks

Paul

###################################################################################
In my understanding:
-       err = 9 : everything went well … ok

-       err = 3 : Optimization stops because of too small variations for x
-       err=1 : Norm of projected gradient lower than …
-       err=2 : At last iteration f decreases by less than …
- err=4 : Optim stops: maximum number of calls to f is reached ==> increase nocf - err=5 : Optim stops: maximum number of iterations is reached. ==> increase niter
-       err=6 : Optim stops: too small variations in gradient direction.
-       err=7 : Stop during calculation of descent direction.
-       err=8 : Stop during calculation of estimated hessian.
-       err=10 : End of optimization (linear search fails).



// Rosembrock function
function f=rosembrock(x)
    f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;
endfunction

// Cost function
function [f, g, ind]=cost(x, ind)
    f = rosembrock(x);
    //        g = derivative(rosembrock, x.',order = 4);
//            g = numderivative(rosembrock, x.',order = 4);
    g = numderivative(rosembrock, x.',0.1, order = 4);
endfunction

initial_parameters = [10 100]
lower_bounds = [0 0];
upper_bounds = [1000 1000];
nocf = 100000;      // number of call of f
niter = 100000;    // number of iterations
[fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter);
xopt
fopt
iters
evals
err
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to