0
votes

I am using fminsearch to fit parameters for a system of DEs to observed data. I am not expecting to get a great fit.

fminsearch pretty quickly finds what appears to be an acceptable min for the objective function, but then does not stop. It's running for a really long time, and I cannot figure out why.

I am using the options

options = optimset('Display','iter','TolFun',1e-4,'TolX',1e-4,'MaxFunEvals',1000);

which I understood to mean that when the value of the objective function drops to below 1e-4 that would be considered sufficient. Alternatively when they could no longer change the parameters whatever is the best would be returned.

The output is

Iteration   Func-count     min f(x)         Procedure
 0            1      8.13911e+10         
 1            8       7.2565e+10         initial simplex
 2            9       7.2565e+10         reflect
 3           10       7.2565e+10         reflect
 4           11       7.2565e+10         reflect
 5           12       7.2565e+10         reflect
 6           13       7.2565e+10         reflect
 7           15      6.85149e+10         expand
 8           16      6.85149e+10         reflect
 9           17      6.85149e+10         reflect
10           19      6.20681e+10         expand
11           20      6.20681e+10         reflect
12           22      5.55199e+10         expand
13           23      5.55199e+10         reflect
14           25      4.86494e+10         expand
15           26      4.86494e+10         reflect
16           27      4.86494e+10         reflect
17           29      3.65616e+10         expand
18           30      3.65616e+10         reflect
19           31      3.65616e+10         reflect
20           33      2.82946e+10         expand
21           34      2.82946e+10         reflect
22           36      2.02985e+10         expand
23           37      2.02985e+10         reflect
24           39      1.20011e+10         expand
25           40      1.20011e+10         reflect
26           41      1.20011e+10         reflect
27           43      5.61651e+09         expand
28           44      5.61651e+09         reflect
29           45      5.61651e+09         reflect
30           47       2.1041e+09         expand
31           48       2.1041e+09         reflect
32           49       2.1041e+09         reflect
33           51      5.15751e+08         expand
34           52      5.15751e+08         reflect
35           53      5.15751e+08         reflect
36           55      7.99868e-05         expand
37           56      7.99868e-05         reflect
38           58      7.99835e-05         reflect
39           59      7.99835e-05         reflect

I have previously let this run for a lot longer and it's stuck with the same min f(x) for at least the next 30 print outs.

How do I set the options correctly so that when it finds a solution within an acceptable value for the objective function it stops?

1

1 Answers

1
votes

Matlab requires that both TolX AND TolFun be satisfied before terminating ("Unlike other solvers, fminsearch stops when it satisfies both TolFun and TolX." See: https://www.mathworks.com/help/matlab/ref/fminsearch.html). You should check what the "x" value (your solution) is doing. I suspect that is changing more than your tolerance specification for each step. (i.e. the value of x is changing more than TolX between iterations but f(x) is not changing by more than TolFun).