Allow for pass OSR parameter bounds to optimizer

time-shift
Johannes Pfeifer 2016-05-20 20:02:06 +02:00 committed by Stéphane Adjemian (Lupi)
parent 9774d0544d
commit 03563e012b
2 changed files with 38 additions and 2 deletions

View File

@ -665,7 +665,7 @@ Dynare unusable.
In order to give instructions to Dynare, the user has to write a
@emph{model file} whose filename extension must be @file{.mod}. This
file contains the description of the model and the computing tasks
required by the user. Its contents is described in @ref{The Model file}.
required by the user. Its contents are described in @ref{The Model file}.
@menu
* Dynare invocation::
@ -7365,6 +7365,36 @@ osr_params gammax0 gammac0 gamma_y_ gamma_inf_;
osr y;
@end example
@anchor{osr_params_bounds}
@deffn Block osr_params_bounds ;
This block declares lower and upper bounds for parameters in the optimal simple rule. If not specified
the optimization is unconstrained.
Each line has the following syntax:
@example
PARAMETER_NAME, LOWER_BOUND, UPPER_BOUND;
@end example
Note that the use of this block requires the use of a constrained optimizer, i.e. setting @ref{opt_algo} to
1,2,5, or 9.
@examplehead
@example
osr_param_bounds;
gamma_inf_, 0, 2.5;
end;
osr(solve_algo=9) y;
@end example
@end deffn
@defvr {MATLAB/Octave variable} oo_.osr.objective_function
After an execution of the @code{osr} command, this variable contains the value of
the objective under optimal policy.

View File

@ -97,9 +97,15 @@ elseif isequal(options_.osr.opt_algo,6)
error('OSR: OSR does not support opt_algo=6.')
elseif isequal(options_.osr.opt_algo,10)
error('OSR: OSR does not support opt_algo=10.')
elseif isequal(options_.osr.opt_algo,11)
error('OSR: OSR does not support opt_algo=11.')
else
if ~isempty(M_.osr.param_bounds) && ~(ismember(options_.osr.opt_algo,[1,2,5,9]) || ischar(options_.osr.opt_algo))
error('OSR: OSR with bounds on parameters requires a constrained optimizer, i.e. 1,2,5, or 9.')
end
%%do actual optimization
[p, f, exitflag] = dynare_minimize_objective(str2func('osr_obj'),t0,options_.osr.opt_algo,options_,[],cellstr(M_.param_names(i_params,:)),[],[], i_params,...
[p, f, exitflag] = dynare_minimize_objective(str2func('osr_obj'),t0,options_.osr.opt_algo,options_,M_.osr.param_bounds,cellstr(M_.param_names(i_params,:)),[],[], i_params,...
inv_order_var(i_var),weights(i_var,i_var));
end