java-timeseries
java-timeseries copied to clipboard
Loop in BFGS.java#127 can fall into infinite loop.
See discussion in PR https://github.com/signaflo/java-timeseries/pull/3
Code
while (!(Double.isFinite(functionValue) &&
functionValue < priorFunctionValue + C1 * stepSize * slopeAt0) && !stop) {
can fall into infinite loop.
Release 0.4 includes the simplest solution of using a counter to keep track of the number of iterations and exiting the loop when the maximum is reached. It is far preferable to understand why the algorithm is falling into this state and taking steps to prevent that.