Minimum reached and First-Order Optimality non zero

Good morning everyone,
I'm using fminunc to set to zero an objective function that depends on one variable only, which happens to be an efficiency (so that I can guess a good starting value and assess if the solution I get is reliable).
I find the value that pushes to zero my objective function and it is reasonable. Nevertheless, when displaying the optimization steps, the label first-order optimality isn't zero.
If I look at stopping criteria I get the following:
Now, my question is: what's the difference between the first-order optimality and the first-order optimality measure? I know that the second one should be the maximum of the gradient (like the infinity norm), but in my case, since I have only one variable, it should be the simple derivative... But what about the first one?
Hope my question does not sound to silly,
thanks
Roberto

回答 (1 件)

Alan Weiss
Alan Weiss 2018 年 7 月 5 日

1 投票

The difference is in the term relative. Because the initial first-order optimality measure is so high, the relative first-order optimality measure at the end is low, even though the derivative is not all that near zero. The relative measure is the ratio of the measure to the initial measure.
To get a better final value, rerun the solver starting at the solution.
Alan Weiss
MATLAB mathematical toolbox documentation

3 件のコメント

Roberto Galimberti
Roberto Galimberti 2018 年 7 月 6 日
Hey Alan, thanks for your explanation. I tried as you suggest, but nothing happens, since optimization stops due to step-size tolerance.
My function is defined as the squared difference of a constant and a term depending on my variable (clearly, I want the variable term to become equal to the constant one). Squared in order to have the minimum at zero.
I tried to scale up and down the problem, but I'm afraid there's some numerical instability behind it which prevented me to get any solution in some cases. What I came up with later was to change the function from an "absolute error" to a relative one, as below:
I remember from numerical courses based on both Excel and Matlab that this shape is generally better and easier to handle by the computer.
I get the same value result as before, but now the optimality condition (gradient) feels "safer", let's say...
Does it sound correct to you?
Thanks,
Roberto
Alan Weiss
Alan Weiss 2018 年 7 月 6 日
Your method seems OK.
You could also try to use lsqnonlin instead of fminunc. In that case, you would have as the objective function ( variable - constant ), not the square. See the lsqnonlin function reference page. This will probably give you even more reliable results, as it is the solver for your problem's form.
Alan Weiss
MATLAB mathematical toolbox documentation
Roberto Galimberti
Roberto Galimberti 2018 年 7 月 9 日
Good, I'm gonna try and see what happens! Thank you Alan,
Roberto

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

カテゴリ

質問済み:

2018 年 7 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by