Be agnostic about the name of the PAC model.
time-shift
Stéphane Adjemia (Scylla) 2019-01-07 13:33:08 +01:00
parent 4d95484e60
commit 3bc6b34161
Signed by untrusted user who does not match committer: stepan
GPG Key ID: A6D44CB9C64CE77B
1 changed files with 3 additions and 11 deletions

View File

@ -42,7 +42,7 @@ function nls(eqname, params, data, range, optimizer, varargin)
% is available only if the matylab optimization toolbox is installed), the
% remaining inputs are the options (key/value) passed to the optimizers.
% Copyright (C) 2018 Dynare Team
% Copyright (C) 2018-2019 Dynare Team
%
% This file is part of Dynare.
%
@ -195,8 +195,6 @@ else
case 'lsqnonlin'
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds(strcmp(fieldnames(params), M_.param_names(M_.pac.(pacmodl).ec.params)),1) = .0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 1) = 0.0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 2) = 1.0;
case 'fmincon'
if isoctave
error('Optimization algorithm ''fmincon'' is not available under Octave')
@ -206,8 +204,6 @@ else
minalgo = 1;
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds(strcmp(fieldnames(params), M_.param_names(M_.pac.(pacmodl).ec.params)),1) = .0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 1) = 0.0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 2) = 1.0;
case 'fminunc'
if isoctave && ~user_has_octave_forge_package('optim')
error('Optimization algorithm ''fminunc'' requires the optim package')
@ -228,10 +224,8 @@ else
minalgo = 8;
case 'annealing'
minalgo = 2;
bounds = ones(length(params0),1)*[-100,100];
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds(strcmp(fieldnames(params), M_.param_names(M_.pac.(pacmodl).ec.params)),1) = .0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 1) = 0.0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 2) = 1.0;
parameter_names = fieldnames(params);
case 'particleswarm'
if isoctave
@ -240,10 +234,8 @@ else
error('Optimization ''particleswarm'' requires the Global Optimization Toolbox')
end
minalgo = 12;
bounds = ones(length(params0),1)*[-100,100];
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds(strcmp(fieldnames(params), M_.param_names(M_.pac.(pacmodl).ec.params)),1) = .0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 1) = 0.0;
bounds(ipnames_==M_.pac.(pacmodl).share_of_optimizing_agents_index, 2) = 1.0;
parameter_names = fieldnames(params);
otherwise
msg = sprintf('%s is not an implemented optimization routine.\n', optimizer);