Transfer hardcoded osr options to options structure

Implements #423. To be done: add preprocessor options for tolf and maxit.
time-shift
Johannes Pfeifer 2013-06-24 22:52:10 +02:00
parent 4cef0a1568
commit c4998f93d3
3 changed files with 21 additions and 6 deletions

View File

@ -5521,12 +5521,22 @@ The parameters to be optimized must be listed with @code{osr_params}.
The quadratic objectives must be listed with @code{optim_weights}.
This problem is solved using a numerical optimizer.
This problem is solved using the numerical optimizer @code{csminwel} of Chris Sims.
@optionshead
This command accept the same options than @code{stoch_simul}
(@pxref{Computing the stochastic solution}).
This command accepts the same options as @code{stoch_simul}
(@pxref{Computing the stochastic solution}) plus
@table @code
@item maxit = = @var{INTEGER}
Determines the maximum number of iterations used in the non-linear solver. Default: @code{1000}
@item tolf = = @var{DOUBLE}
Convergence criterion for termination based on the function value. Iteration will
cease when it proves impossible to improve the function value by more than tolf. Default: @code{1e-7}
@end table
The value of the objective is stored in the variable
@code{oo_.osr.objective_function}, which is described below.

View File

@ -565,6 +565,11 @@ options_.risky_steadystate = 0;
options_.endogenous_prior = 0;
options_.endogenous_prior_restrictions.irf={};
% OSR Optimal Simple Rules
options_.osr.tolf=1e-7;
options_.osr.maxit=1000;
options_.osr.verbose=2;
% use GPU
options_.gpu = 0;

View File

@ -48,9 +48,9 @@ t0 = M_.params(i_params);
inv_order_var = oo_.dr.inv_order_var;
H0 = 1e-4*eye(np);
crit = 1e-7;
nit = 1000;
verbose = 2;
crit=options_.osr.tolf;
nit=options_.osr.maxit;
verbose=options_.osr.verbose;
[f,p]=csminwel1('osr_obj',t0,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,i_params,...
inv_order_var(i_var),weights(i_var,i_var));