Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions algorithms/java/src/org/openda/algorithms/BaseDudCoreOptimizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -433,26 +433,20 @@ boolean isThereMoreToDo(double costs[], double relErrorLinCost, IVector predTry,
&& diff > relTol * Math.abs(costs[0])
&& relErrorLinCost>relTolLinCost;

// do not stop on a backtracking iteration
if (innerIter > 0 && imain < maxit) return true;

if (stopCriteria.isEmpty()) return moreToDo;
// additional stop criteria:
if (stopCriteria.size()>0) {
IVector residual = obs.clone();
residual.axpy(-1.0,predTry);
boolean isStop;
for (int i=0; i<stopCriteria.size(); i++){
IStopCriterion object = stopCriteria.get(i);
double threshold = stopCriteriaThreshold.get(i);
if (obsDescr!=null) {
isStop = object.checkForStop(pars[0],residual,obsDescr,costs[0],threshold);
} else {
isStop = object.checkForStop(pars[0],residual,costs[0],threshold);
}
Results.putMessage(object.toString());
this.moreToDo = this.moreToDo & !isStop;
}
IVector residual = obs.clone();
residual.axpy(-1.0, predTry);
for (int i = 0; i < stopCriteria.size(); i++) {
IStopCriterion stopCriterion = stopCriteria.get(i);
double threshold = stopCriteriaThreshold.get(i);
boolean isStop = obsDescr != null ? stopCriterion.checkForStop(pars[0], residual, obsDescr, costs[0], threshold) : stopCriterion.checkForStop(pars[0], residual, costs[0], threshold);
Results.putMessage(stopCriterion.toString());
moreToDo &= !isStop;
}

// do not stop on a backtracking iteration
if (innerIter>0 && (imain < maxit)) moreToDo = true;

return moreToDo;
}
Expand Down
Loading