Commit 9a60da23 by Francois Gygi

limit number of all iterations, bracketing or not

git-svn-id: http://qboxcode.org/svn/qb/trunk@975 cba15fb0-1239-40c8-b417-11db7ca47a34
parent d1bd0a9f
......@@ -40,6 +40,15 @@ double LineMinimizer::interpolate(void)
////////////////////////////////////////////////////////////////////////////////
double LineMinimizer::next_alpha(double alpha, double f, double fp)
{
nstep_++;
if ( nstep_ > nstep_max_ )
{
#ifdef DEBUG
cout << "LineMinimizer: fail, nstep_max" << endl;
#endif
fail_ = true;
}
if ( done_ || fail_ )
return alpha;
......@@ -126,16 +135,6 @@ double LineMinimizer::next_alpha(double alpha, double f, double fp)
else
{
// bracketing
nstep_++;
if ( nstep_ > nstep_max_ )
{
#ifdef DEBUG
cout << "LineMinimizer: fail, nstep_max" << endl;
#endif
fail_ = true;
return alpha;
}
if ( !wolfe1 || f > f_low )
{
#ifdef DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment