<blockquote>
<p>One thing I overlooked, though---you've split out the line search termination conditions in order to give better failure messages; but on those failures, it no longer returns false, it just breaks. Is there a particular reason for this? I think that this could cause L_BFGS to iterate forever with no improvement, although the relative improvement termination condition should catch that. Which then implies that there's no need for LineSearch() to return anything at all or check whether or not it failed.</p>
</blockquote>

<p>I think I actually needed <code>break</code> instead of <code>return false</code> for it to work. In my experience, it was <code>cond3</code> which was triggering, that is <code>numIterations &gt;= maxLineSearchTrials</code>. In this case, I found that it was better to take a (non-zero) step that didn't satisfy the armijo conditions than to give up entirely on the optimization. In other words, it helps to get out of these strange valleys so that on subsequent iterations we can make good progress. I also tried to increase <code>maxLineSearchTrials</code>, but then the optimization become quite slow. You do bring up a valid point, which is what happens if the move becomes so small, could it loop infinitely? And that's why we have a relative difference condition, as you pointed it :)</p>

<p>I don't think, however, you should change <code>LineSearch()</code> to return <code>void</code>. There is still one condition that causes us to terminate entirely (the <code>initialSearchDirectionDotGradient &gt; 0.0</code> check above). </p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/370#issuecomment-70226842">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFMd4zE_ruzm5UOBD7bGd8qTgzd5nks5niM3xgaJpZM4DNsex.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/370#issuecomment-70226842"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>