what is this mean: Gradient must be provided for trust-region algorithm?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have matlab code, when I run it I receive this message:
Warning: Gradient must be provided for trust-region algorithm; using line-search algorithm instead. > In fminunc at 367 In false_alarm_detection_2 at 14
Local minimum found.
Optimization completed because the size of the gradient is less than the selected value of the function tolerance.
what is that mean? and how can be solved?
Thanks
1 件のコメント
Sean de Wolski
2013 年 5 月 24 日
It means the default algorithm isn't suitable for the way you've called fminunc. You can just ignore the warning, it picked a different algorithm instead.
採用された回答
Alan Weiss
2013 年 5 月 24 日
編集済み: Alan Weiss
2013 年 5 月 24 日
fmincon options describes the restrictions for the trust-region-reflective algorithm. Including Derivatives describes how you include the derivative in the objective function definition.
To avoid the warning without including a derivative, set the Algorithm option to 'interior-point' or some other algorithm:
opts = optimset('Algorithm','interior-point');
x = fmincon(objfn,x0,[],[],[],[],lb,ub,[],opts);
Take a look at the documentation examples for more information on setting gradients and options: <http://www.mathworks.com/help/optim/constrained-optimization.html>
Alan Weiss
MATLAB mathematical toolbox documentation
その他の回答 (1 件)
Matt J
2013 年 5 月 24 日
編集済み: Matt J
2013 年 5 月 24 日
FMINUNC seems like overkill for a 1D root finding problem. Why not just use FZERO?
xv = fzero(@(x) gammainc(5,x)- vall(i) ,4);
6 件のコメント
Matt J
2013 年 5 月 27 日
編集済み: Matt J
2013 年 5 月 27 日
so, after gammainc(5,6.982) the result will be between 0.24 and 1
Yes, but your target values of gammainc are not between 0.24 and 1. Here is the stream of vall(i) that your code produces
vall =
0.0024 0.0120 0.0240 0.1200 0.2400 1.2000 2.4000 12.0000 24.0000
As you can see, they exceed 1 for i>=6. As Alan said, it is not possible for gammainc(5,x) to reach a value greater than 1.
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!