Restore backward compatibility of OSR command with maxit and tolf options
Translates these options into optim_opt structuretime-shift
parent
816b5bb884
commit
8dadd1519e
|
@ -7452,6 +7452,15 @@ Specifies the optimizer for minimizing the objective function. The same solvers
|
||||||
@item optim = (@var{NAME}, @var{VALUE}, ...)
|
@item optim = (@var{NAME}, @var{VALUE}, ...)
|
||||||
A list of @var{NAME} and @var{VALUE} pairs. Can be used to set options for the optimization routines. The set of available options depends on the selected optimization routine (i.e. on the value of option @ref{opt_algo}). @xref{optim}.
|
A list of @var{NAME} and @var{VALUE} pairs. Can be used to set options for the optimization routines. The set of available options depends on the selected optimization routine (i.e. on the value of option @ref{opt_algo}). @xref{optim}.
|
||||||
|
|
||||||
|
@item maxit = @var{INTEGER}
|
||||||
|
Determines the maximum number of iterations used in @code{opt_algo=4}. This option is now deprecated and will be
|
||||||
|
removed in a future release of Dynare. Use @code{optim} instead to set optimizer-specific values. Default: @code{1000}
|
||||||
|
|
||||||
|
@item tolf = @var{DOUBLE}
|
||||||
|
Convergence criterion for termination based on the function value used in @code{opt_algo=4}. Iteration will cease when it proves impossible to
|
||||||
|
improve the function value by more than tolf. This option is now deprecated and will be
|
||||||
|
removed in a future release of Dynare. Use @code{optim} instead to set optimizer-specific values. Default: @code{e-7}
|
||||||
|
|
||||||
@item silent_optimizer
|
@item silent_optimizer
|
||||||
@pxref{silent_optimizer}
|
@pxref{silent_optimizer}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,27 @@ if any(isnan(M_.params(i_params)))
|
||||||
error ('OSR: At least one of the initial parameter values for osr_params is NaN') ;
|
error ('OSR: At least one of the initial parameter values for osr_params is NaN') ;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
%restore backward compatibility with maxit and tolf
|
||||||
|
if isfield(options_.osr,'maxit') || isfield(options_.osr,'tolf')
|
||||||
|
warning('OSR: The use of maxit and tolf is now deprecated. Please use the optim-option instead.')
|
||||||
|
if options_.osr.opt_algo~=4
|
||||||
|
error ('OSR: The maxit and tolf options are not supported when not using the default opt_algo=4. Use the optim-option instead.') ;
|
||||||
|
else
|
||||||
|
if isfield(options_.osr,'maxit')
|
||||||
|
if ~isempty(options_.optim_opt)
|
||||||
|
options_.optim_opt=[options_.optim_opt,','];
|
||||||
|
end
|
||||||
|
options_.optim_opt=[options_.optim_opt,'''MaxIter'',',num2str(options_.osr.maxit),''];
|
||||||
|
end
|
||||||
|
if isfield(options_.osr,'tolf')
|
||||||
|
if ~isempty(options_.optim_opt)
|
||||||
|
options_.optim_opt=[options_.optim_opt,','];
|
||||||
|
end
|
||||||
|
options_.optim_opt=[options_.optim_opt,'''TolFun'',',num2str(options_.osr.tolf),''];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
exe =zeros(M_.exo_nbr,1);
|
exe =zeros(M_.exo_nbr,1);
|
||||||
|
|
||||||
oo_.dr = set_state_space(oo_.dr,M_,options_);
|
oo_.dr = set_state_space(oo_.dr,M_,options_);
|
||||||
|
|
Loading…
Reference in New Issue