mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.51k stars 898 forks source link

BfgsMinimizer - ReasonForExit #1095

Open MartinCernak opened 2 months ago

MartinCernak commented 2 months ago

In the BfgsMinimizer, the reason for exit is always the absolute gradient.

 return new MinimizationWithLineSearchResult(candidate, iterations, ExitCondition.AbsoluteGradient, totalLineSearchSteps, iterationsWithNontrivialLineSearch);

I believe that the reason for termination should be set by checking the conditions of termination.

return new MinimizationWithLineSearchResult(candidate, iterations, currentExitCondition, totalLineSearchSteps, iterationsWithNontrivialLineSearch);

It's not a big deal, but it can help when setting optimization parameters...

jkalias commented 1 month ago

Hi,

Yes, this seems like a legitimate change. Would you like to open a PR?

MartinCernak commented 1 month ago

Hi, @jkalias, yes, I can.