Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Villemot
dynare
Commits
39248627
Commit
39248627
authored
10 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug (options_.optim_opt is now initialized as an empty array).
parent
e7bffae5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/optimization/dynare_minimize_objective.m
+8
-9
8 additions, 9 deletions
matlab/optimization/dynare_minimize_objective.m
with
8 additions
and
9 deletions
matlab/optimization/dynare_minimize_objective.m
+
8
−
9
View file @
39248627
...
...
@@ -78,7 +78,7 @@ switch minimizer_algorithm
end
% Set default optimization options for fmincon.
optim_options
=
optimset
(
'display'
,
'iter'
,
'LargeScale'
,
'off'
,
'MaxFunEvals'
,
100000
,
'TolFun'
,
1e-8
,
'TolX'
,
1e-6
);
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
eval
([
'optim_options = optimset(optim_options,'
options_
.
optim_opt
');'
]);
end
if
options_
.
analytic_derivation
,
...
...
@@ -96,7 +96,7 @@ switch minimizer_algorithm
end
% Set default optimization options for fminunc.
optim_options
=
optimset
(
'display'
,
'iter'
,
'MaxFunEvals'
,
100000
,
'TolFun'
,
1e-8
,
'TolX'
,
1e-6
);
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
eval
([
'optim_options = optimset(optim_options,'
options_
.
optim_opt
');'
]);
end
if
options_
.
analytic_derivation
,
...
...
@@ -117,7 +117,7 @@ switch minimizer_algorithm
numgrad
=
options_
.
gradient_method
;
epsilon
=
options_
.
gradient_epsilon
;
% Change some options.
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
options_list
=
read_key_value_string
(
options_
.
optim_opt
);
for
i
=
1
:
rows
(
options_list
)
switch
options_list
{
i
,
1
}
...
...
@@ -156,8 +156,7 @@ switch minimizer_algorithm
newratflag
=
options_
.
newrat
.
hess
;
%default
end
nit
=
options_
.
newrat
.
maxiter
;
if
isfield
(
options_
,
'optim_opt'
)
if
~
isempty
(
options_
.
optim_opt
)
options_list
=
read_key_value_string
(
options_
.
optim_opt
);
for
i
=
1
:
rows
(
options_list
)
switch
options_list
{
i
,
1
}
...
...
@@ -194,14 +193,14 @@ switch minimizer_algorithm
error
(
'Option mode_compute=7 requires the Optimization Toolbox'
)
end
optim_options
=
optimset
(
'display'
,
'iter'
,
'MaxFunEvals'
,
1000000
,
'MaxIter'
,
6000
,
'TolFun'
,
1e-8
,
'TolX'
,
1e-6
);
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
eval
([
'optim_options = optimset(optim_options,'
options_
.
optim_opt
');'
]);
end
[
opt_par_values
,
fval
,
exitflag
]
=
fminsearch
(
objective_function
,
start_par_value
,
optim_options
,
varargin
{:});
case
8
% Dynare implementation of the simplex algorithm.
simplexOptions
=
options_
.
simplex
;
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
options_list
=
read_key_value_string
(
options_
.
optim_opt
);
for
i
=
1
:
rows
(
options_list
)
switch
options_list
{
i
,
1
}
...
...
@@ -228,7 +227,7 @@ switch minimizer_algorithm
H0
=
1e-4
*
ones
(
n_params
,
1
);
cmaesOptions
=
options_
.
cmaes
;
% Modify defaults
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
options_list
=
read_key_value_string
(
options_
.
optim_opt
);
for
i
=
1
:
rows
(
options_list
)
switch
options_list
{
i
,
1
}
...
...
@@ -252,7 +251,7 @@ switch minimizer_algorithm
fval
=
BESTEVER
.
f
;
case
10
simpsaOptions
=
options_
.
simpsa
;
if
is
field
(
options_
,
'
optim_opt
'
)
if
~
is
empty
(
options_
.
optim_opt
)
options_list
=
read_key_value_string
(
options_
.
optim_opt
);
for
i
=
1
:
rows
(
options_list
)
switch
options_list
{
i
,
1
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment