{"record":{"id":"d88d91e3afdc813a","repo":"stanfordnlp/CoreNLP","slug":"exceeded-during-linesearch-function-d88d91","errorCode":null,"errorMessage":"Exceeded during lineSearch() Function.","messagePattern":"Exceeded during lineSearch\\(\\) Function\\.","errorType":"exception","errorClass":"edu.stanford.nlp.optimization.QNMinimizer.MaxEvaluationsExceeded","httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/optimization/QNMinimizer.java","lineNumber":1376,"sourceCode":"\n    double[] newPoint = new double[3];\n\n    while ((newPoint[f] = func.valueAt((plusAndConstMult(x, dir, step, newX)))) > lastValue\n        + c * step) {\n      fevals += 1;\n      if (newPoint[f] < lastValue) {\n        // an improvement, but not good enough... suspicious!\n        sb.append('!');\n      } else {\n        sb.append('.');\n      }\n      step = c1 * step;\n    }\n\n    newPoint[a] = step;\n    fevals += 1;\n    if (fevals > maxFevals) {\n      throw new MaxEvaluationsExceeded(\"Exceeded during lineSearch() Function.\");\n    }\n\n    return newPoint;\n  }\n\n  private double[] lineSearchMinPack(DiffFunction dfunc, double[] dir,\n      double[] x, double[] newX, double[] grad, double f0, double tol, StringBuilder sb)\n      throws MaxEvaluationsExceeded {\n    double xtrapf = 4.0;\n    int info = 0;\n    int infoc = 1;\n    bracketed = false;\n    boolean stage1 = true;\n    double width = aMax - aMin;\n    double width1 = 2 * width;\n    // double[] wa = x;\n\n    // Should check input parameters","sourceCodeStart":1358,"sourceCodeEnd":1394,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/optimization/QNMinimizer.java#L1358-L1394","documentation":"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.","triggerScenarios":"Calling minimize() with the line search path that routes to this overload; the search needs more function evaluations than maxFevals allows.","commonSituations":"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.","solutions":["Increase maxFevals.","Use MINPACK line search (setMinimizeType(MINPACK)) which bounds iterations differently.","Catch the exception and resume with looser tolerance or better initialization."],"exampleFix":"// before\nminimizer.setMinimizeType(QNMinimizer.eLineSearchType.BACKTRACKING);\nminimizer.setMaxFevals(20);\n// after\nminimizer.setMinimizeType(QNMinimizer.eLineSearchType.MINPACK);\nminimizer.setMaxFevals(1000);","handlingStrategy":"try-catch","validationCode":"if (maxFevals < 100) log.warning(\"maxFevals too low for backtracking line search\");","typeGuard":null,"tryCatchPattern":"try {\n  x = minimizer.minimize(f, tol, init);\n} catch (MaxEvaluationsExceeded e) {\n  minimizer.setMaxFevals(maxFevals * 4);\n  x = minimizer.minimize(f, tol, init);\n}","preventionTips":["Same as other MaxEvaluationsExceeded: raise budget, loosen tolerance.","Consider MINPACK line search for more robust step selection."],"tags":["optimization","line-search","max-evaluations"],"backgroundTag":"value-out-of-range","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}