function OPTIONS=optim_options(options_in) % MY_FOPTIONS Default parameters used by the optimization routines. % % OPTIONS = MY_FOPTIONS returns the default OPTIONS. % % OPTIONS = MY_FOPTIONS(SOME_OPTIONS) takes the non-empty vector % SOME_OPTIONS and replaces the zero or missing values of % SOME_OPTIONS with the default OPTIONS. % % The parameters are: Default Values % OPTIONS(1) : 1: displays some results, 0: don't 1 % OPTIONS(2) : Termination tolerance for parameters. 1e-4 % OPTIONS(3) : Termination tolerance on cost. 1e-4 % OPTIONS(4) : Termination tolerance on max constraint. 1e-4 % OPTIONS(5) : Maximum number of function evaluations. 1000 % OPTIONS(6) : Penalty on constraint violations 10 % OPTIONS(7) : Exponent on constraint violations 1 % OPTIONS(8) : initialize 1: stop when feasible solution 0 % OPTIONS(9) : 1: check gradient calculation, 0: don't 0 % OPTIONS(10): Penalty type 0: none, 1: interior, 2: exterior 2 % OPTIONS(11): Minimum param. change for finite difference gradients 1e-6 % OPTIONS(12): Maximum param. change for finite difference gradients 1e-1 % OPTIONS(13): Number of equality constraints 0 default_options = [ 1 , 1e-4 , 1e-4 , 1e-4, 1000 , 10 , 1 , 0 , 1e-6 , 2 , 1e-6 , 1e-1 , 0 ]; options_in = abs(options_in); if nargin<1; options_in = []; end n=length(options_in); OPTIONS=zeros(1,13); OPTIONS(1:n)=options_in(1:n); OPTIONS = OPTIONS + (OPTIONS<2*eps) .* default_options; if n > 5, if options_in(6) == 0, OPTIONS(6) = 0; end; end OPTIONS(7) = min(OPTIONS(7),5); OPTIONS(7) = max(OPTIONS(7),1);