MoM: Check availability of optim toolbox for default mode_compute

lsqnonlin is an optimization algorithm that is specifically well suited for minimizing quadratic objectives, so I would like to have it as default. However, we fallback to csminwel if the optimization toolbox for Matlab or optim for Octave are not available.
mr#1893
Willi Mutschler 2021-08-12 06:19:27 +02:00 committed by Stéphane Adjemian (Charybdis)
parent 0d200f3b39
commit a5995aec03
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
1 changed files with 5 additions and 1 deletions

View File

@ -215,7 +215,11 @@ end
% Optimization options that can be set by the user in the mod file, otherwise default values are provided
options_mom_ = set_default_option(options_mom_,'huge_number',1e7); % value for replacing the infinite bounds on parameters by finite numbers. Used by some optimizers for numerical reasons
options_mom_ = set_default_option(options_mom_,'mode_compute',13); % specifies the optimizer for minimization of moments distance
if (isoctave && user_has_octave_forge_package('optim')) || (~isoctave && user_has_matlab_license('optimization_toolbox'))
options_mom_ = set_default_option(options_mom_,'mode_compute',13); % specifies lsqnonlin as default optimizer for minimization of moments distance
else
options_mom_ = set_default_option(options_mom_,'mode_compute',4); % specifies csminwel as fallback default option for minimization of moments distance
end
options_mom_ = set_default_option(options_mom_,'additional_optimizer_steps',[]); % vector of additional mode-finders run after mode_compute
options_mom_ = set_default_option(options_mom_,'optim_opt',[]); % a list of NAME and VALUE pairs to set options for the optimization routines. Available options depend on mode_compute
options_mom_ = set_default_option(options_mom_,'silent_optimizer',false); % run minimization of moments distance silently without displaying results or saving files in between