Commit 60e1d1b7 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Changed the organization of the options for the dynare's implementation of the...

Changed the organization of the options for the dynare's implementation of the simplex optimization algorithm.
parent b01aee4d
...@@ -461,7 +461,6 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation ...@@ -461,7 +461,6 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
elseif ~exist('OCTAVE_VERSION') && ~user_has_matlab_license('optimization_toolbox') elseif ~exist('OCTAVE_VERSION') && ~user_has_matlab_license('optimization_toolbox')
error('Option mode_compute=7 requires the Optimization Toolbox') error('Option mode_compute=7 requires the Optimization Toolbox')
end end
optim_options = optimset('display','iter','MaxFunEvals',1000000,'MaxIter',6000,'TolFun',1e-8,'TolX',1e-6); optim_options = optimset('display','iter','MaxFunEvals',1000000,'MaxIter',6000,'TolFun',1e-8,'TolX',1e-6);
if isfield(options_,'optim_opt') if isfield(options_,'optim_opt')
eval(['optim_options = optimset(optim_options,' options_.optim_opt ');']); eval(['optim_options = optimset(optim_options,' options_.optim_opt ');']);
...@@ -469,7 +468,32 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation ...@@ -469,7 +468,32 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
[xparam1,fval,exitflag] = fminsearch(objective_function,xparam1,optim_options,dataset_,options_,M_,estim_params_,bayestopt_,oo_); [xparam1,fval,exitflag] = fminsearch(objective_function,xparam1,optim_options,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
case 8 case 8
% Dynare implementation of the simplex algorithm. % Dynare implementation of the simplex algorithm.
[xparam1,fval,exitflag] = simplex_optimization_routine(objective_function,xparam1,options_.simplex,dataset_,options_,M_,estim_params_,bayestopt_,oo_); simplexOptions = options_.simplex;
if isfield(options_,'optim_opt')
options_list = strsplit(options_.optim_opt,',');
number_of_options = length(options_list)/2;
o = 1;
while o<=number_of_options
switch strtrim(options_list{2*(o-1)+1})
case '''MaxIter'''
simplexOptions.maxiter = str2num(options_list{2*(o-1)+2});
case '''TolFun'''
simplexOptions.tolerance.f = str2double(options_list{2*(o-1)+2});
case '''TolX'''
simplexOptions.tolerance.x = str2double(options_list{2*(o-1)+2});
case '''MaxFunEvals'''
simplexOptions.maxfcall = str2num(options_list{2*(o-1)+2});
case '''MaxFunEvalFactor'''
simplexOptions.maxfcallfactor = str2num(options_list{2*(o-1)+2});
case '''InitialSimplexSize'''
simplexOptions.delta_factor = str2double(options_list{2*(o-1)+2});
otherwise
warning(['simplex: Unknown option (' options_list{2*(o-1)+1} ')!'])
end
o = o + 1;
end
end
[xparam1,fval,exitflag] = simplex_optimization_routine(objective_function,xparam1,simplexOptions,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
case 9 case 9
H0 = 1e-4*ones(nx,1); H0 = 1e-4*ones(nx,1);
warning('off','CMAES:NonfinitenessRange'); warning('off','CMAES:NonfinitenessRange');
......
...@@ -443,6 +443,9 @@ options_.homotopy_steps = 1; ...@@ -443,6 +443,9 @@ options_.homotopy_steps = 1;
options_.homotopy_force_continue = 0; options_.homotopy_force_continue = 0;
% Simplex optimization routine (variation on Nelder Mead algorithm). % Simplex optimization routine (variation on Nelder Mead algorithm).
simplex.tolerance.x = 1e-4;
simplex.tolerance.f = 1e-4;
simplex.maxiter = 5000;
simplex.maxfcallfactor = 500; simplex.maxfcallfactor = 500;
simplex.maxfcall = []; simplex.maxfcall = [];
options_.simplex = simplex; options_.simplex = simplex;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment