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

Exceeded during lineSearchMinPack() Function.

Error message

Exceeded during lineSearchMinPack() Function.

What it means

lineSearchMinPack() throws MaxEvaluationsExceeded when fevals reaches maxFevals inside the MINPACK-style line search loop. The budget is checked on every iteration of the line search regardless of whether bracketing or convergence has been achieved.

Solutions

  1. Increase maxFevals.
  2. Loosen functionTolerance / line search tolerances so the search terminates earlier.
  3. Check logged line-search diagnostics (minimum step length reached, interval too small) for scaling problems and rescale the objective.

Example fix

// before
QNMinimizer m = new QNMinimizer();
m.setMinimizeType(QNMinimizer.eLineSearchType.MINPACK);
m.minimize(f, 1e-8, init); // long line search, fevals >= maxFevals
// after
m.minimize(f, 1e-4, init); // looser tolerance, fewer evals
Defensive patterns

Strategy: try-catch

Validate before calling

if (maxFevals < 500) log.warning("MINPACK line search can consume many evaluations; maxFevals=" + maxFevals);

Try / catch

try {
  x = minimizer.minimize(f, tol, init);
} catch (MaxEvaluationsExceeded e) {
  log.warning("lineSearchMinPack exhausted budget; relaxing tolerance");
  x = minimizer.minimize(f, Math.max(tol, 1e-4), init);
}

Prevention

When it happens

Trigger: A minimize() call using eLineSearchType.MINPACK where the total function evaluations during line search reach maxFevals before a satisfactory step is found (stuck at minimum step length, interval too small, or slow Armijo/Wolfe satisfaction).

Common situations: Very tight functionTolerance or gtol making the line search iterate indefinitely; ill-conditioned objectives; small maxFevals budgets on large problems.

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/90062bcf199d8f0d. Report an issue: GitHub.

Appendix: source

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

      fevals += 1;

      // Check and make sure everything is normal.
      if ((bracketed && (newPt[a] <= stpMin || newPt[a] >= stpMax))
          || infoc == 0) {
        info = 6;
        if (!quiet) log.info(" line search failure: bracketed but no feasible found ");
      }
      if (newPt[a] == aMax && newPt[f] <= fTest && newPt[g] <= gTest) {
        info = 5;
        if (!quiet) log.info(" line search failure: sufficient decrease, but gradient is more negative ");
      }
      if (newPt[a] == aMin && (newPt[f] > fTest || newPt[g] >= gTest)) {
        info = 4;
        if (!quiet) log.info(" line search failure: minimum step length reached ");
      }
      if (fevals >= maxFevals) {
        // info = 3;
        throw new MaxEvaluationsExceeded("Exceeded during lineSearchMinPack() Function.");
      }
      if (bracketed && stpMax - stpMin <= tol * stpMax) {
        info = 2;
        if (!quiet) log.info(" line search failure: interval is too small ");
      }
      if (newPt[f] <= fTest && Math.abs(newPt[g]) <= -gtol * g0) {
        info = 1;
      }

      if (info != 0) {
        return newPt;
      }

      // this is the first stage where we look for a point that is lower and
      // increasing

      if (stage1 && newPt[f] <= fTest && newPt[g] >= Math.min(ftol, gtol) * g0) {
        stage1 = false;

View on GitHub (pinned to 1b7edd19c4)