If possible define boundaries for the share of optimizing agents in PAC/NLS.

The parameter is constrained to be in (0,1) for the following algorithms

 - lsqnonlin (without Levenberg-Marquardt)
 - fmincon
 - annealing
 - particleswarm

Other algorithms do not allow the definition of boundaries... We should add a
penality function to the objective for these algorithms.
time-shift
Stéphane Adjemia (Scylla) 2018-12-19 16:05:34 +01:00
parent df57bf7eb9
commit c829e7968d
Signed by untrusted user who does not match committer: stepan
GPG Key ID: A6D44CB9C64CE77B
1 changed files with 10 additions and 2 deletions

View File

@ -195,6 +195,8 @@ 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')
@ -204,6 +206,8 @@ 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')
@ -224,8 +228,10 @@ else
minalgo = 8;
case 'annealing'
minalgo = 2;
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds = ones(length(params0),1)*[-100,100];
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
@ -234,8 +240,10 @@ else
error('Optimization ''particleswarm'' requires the Global Optimization Toolbox')
end
minalgo = 12;
bounds = ones(length(params0),1)*[-Inf,Inf];
bounds = ones(length(params0),1)*[-100,100];
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);