stanfordnlp/CoreNLP · warning · edu.stanford.nlp.optimization.QNMinimizer.MaxEvaluationsExceeded

Exceeded during lineSearch() Function.

Error message

Exceeded during lineSearch() Function.

What it means

A second backtracking lineSearch() overload throws MaxEvaluationsExceeded when fevals exceeds maxFevals during its evaluation loop. Functionally identical to error 614 but raised from the other lineSearch variant.

Solutions

  1. Increase maxFevals.
  2. Use MINPACK line search (setMinimizeType(MINPACK)) which bounds iterations differently.
  3. Catch the exception and resume with looser tolerance or better initialization.

Example fix

// before
minimizer.setMinimizeType(QNMinimizer.eLineSearchType.BACKTRACKING);
minimizer.setMaxFevals(20);
// after
minimizer.setMinimizeType(QNMinimizer.eLineSearchType.MINPACK);
minimizer.setMaxFevals(1000);
Defensive patterns

Strategy: try-catch

Validate before calling

if (maxFevals < 100) log.warning("maxFevals too low for backtracking line search");

Try / catch

try {
  x = minimizer.minimize(f, tol, init);
} catch (MaxEvaluationsExceeded e) {
  minimizer.setMaxFevals(maxFevals * 4);
  x = minimizer.minimize(f, tol, init);
}

Prevention

When it happens

Trigger: Calling minimize() with the line search path that routes to this overload; the search needs more function evaluations than maxFevals allows.

Common situations: Same as 614: bad scaling, tight budgets, hard objectives; also occurs when maxFevals is shared across both the main loop and line search and the line search consumes the remaining budget.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/d88d91e3afdc813a. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/optimization/QNMinimizer.java:1376

    double[] newPoint = new double[3];

    while ((newPoint[f] = func.valueAt((plusAndConstMult(x, dir, step, newX)))) > lastValue
        + c * step) {
      fevals += 1;
      if (newPoint[f] < lastValue) {
        // an improvement, but not good enough... suspicious!
        sb.append('!');
      } else {
        sb.append('.');
      }
      step = c1 * step;
    }

    newPoint[a] = step;
    fevals += 1;
    if (fevals > maxFevals) {
      throw new MaxEvaluationsExceeded("Exceeded during lineSearch() Function.");
    }

    return newPoint;
  }

  private double[] lineSearchMinPack(DiffFunction dfunc, double[] dir,
      double[] x, double[] newX, double[] grad, double f0, double tol, StringBuilder sb)
      throws MaxEvaluationsExceeded {
    double xtrapf = 4.0;
    int info = 0;
    int infoc = 1;
    bracketed = false;
    boolean stage1 = true;
    double width = aMax - aMin;
    double width1 = 2 * width;
    // double[] wa = x;

    // Should check input parameters

View on GitHub (pinned to 1b7edd19c4)