Optimization toolbox: "lsqnonlin" stopped because it exceeded the function evaluation limit

55 ビュー (過去 30 日間)
Hi everyone,
I am using the lsqnonlin from optimization toolbox for a problem. After 88 itterations I am getting my answeres and this msg:
lsqnonlin stopped because it exceeded the function evaluation limit
options.MaxFunEvals=800
As I am not satisfied with the answeres, I am guessing maybe changing the MaxFunEvals to a higher number can help. Could anyone let me know how I can set it in the toolbox? I am not seeing any parameter like this in the options.
Thank you
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 11 月 20 日
old name MaxFunEvals
current name MaxFunctionEvaluations
The name to use depends upon which options constructing routine you are using

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2018 年 11 月 20 日
編集済み: John D'Errico 2018 年 11 月 20 日
Note that I don't know which release of MATLAB you are using. But what did you try? This seems clear:
opts = optimoptions('lsqnonlin')
opts =
lsqnonlin options:
Options used by current Algorithm ('trust-region-reflective'):
(Other available algorithms: 'levenberg-marquardt')
Set properties:
No options set.
Default properties:
Algorithm: 'trust-region-reflective'
CheckGradients: 0
Display: 'final'
FiniteDifferenceStepSize: 'sqrt(eps)'
FiniteDifferenceType: 'forward'
FunctionTolerance: 1e-06
JacobianMultiplyFcn: []
MaxFunctionEvaluations: '100*numberOfVariables'
MaxIterations: 400
OptimalityTolerance: 1e-06
OutputFcn: []
PlotFcn: []
SpecifyObjectiveGradient: 0
StepTolerance: 1e-06
SubproblemAlgorithm: 'factorization'
TypicalX: 'ones(numberOfVariables,1)'
UseParallel: 0
Now, nothing stops you from setting:
opts.MaxFunctionEvaluations = 2000
opts =
lsqnonlin options:
Options used by current Algorithm ('trust-region-reflective'):
(Other available algorithms: 'levenberg-marquardt')
Set properties:
MaxFunctionEvaluations: 2000
Default properties:
Algorithm: 'trust-region-reflective'
CheckGradients: 0
Display: 'final'
FiniteDifferenceStepSize: 'sqrt(eps)'
FiniteDifferenceType: 'forward'
FunctionTolerance: 1e-06
JacobianMultiplyFcn: []
MaxIterations: 400
OptimalityTolerance: 1e-06
OutputFcn: []
PlotFcn: []
SpecifyObjectiveGradient: 0
StepTolerance: 1e-06
SubproblemAlgorithm: 'factorization'
TypicalX: 'ones(numberOfVariables,1)'
UseParallel: 0
As you can see, opts now contains the desired value. Pass opts into lsqnonlin to use these settings.
As Walter points out, in older releases, the property name was MaxFunEvals. But the same sort of thing will still apply. You may just need to use the proper property name.
Having said that, frequently when you run out of function evals or iterations, it means your problem is not converging very well. Tht in turn either means that your starting values are particularly poor, or that your problem is fairly ill-posed. In either case, merely increasing the function evals will not really help that much. Essentially, it says that you really need to get better data or a better model or better starting values, each a far better choice than merely increasing the function evals allowed.
  2 件のコメント
Mohammad Heidari
Mohammad Heidari 2018 年 11 月 21 日
Thank you for the useful guidance. This really helped.
has azz
has azz 2020 年 7 月 21 日
Hi John could you please let me know in which line i can introduce these corrections in my code. thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by