Skip to content

Commit

Permalink
Bugfix/#404 progress negative (#405)
Browse files Browse the repository at this point in the history
* checks if result is NaN --> returns zero
Fixes #402

* Adding () for non-negative values
Fixes #404
  • Loading branch information
anLeid authored Apr 16, 2020
1 parent 52ebf08 commit 0fe4d35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/main/java/com/treasure/hunt/analysis/Statistic.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ public double getGlobalOptimalSolution() {
* @return solution quotient
*/
public double getSolutionQuotient() {
return getLocalOptimalSolution() / getGlobalOptimalSolution();
double value = getLocalOptimalSolution() / getGlobalOptimalSolution();
if (Double.isNaN(value)) {
return 0;
}
return value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public List<Pair<Double, Double>> computeMultipleSeries(PlotSettingsController.S
List<Number> statisticValues = Statistic.filterBy(currentStatistics.getStatisticsWithIds(), settings.getStatisticInfo());
computedValues.add(new Pair<>(currentStatisticValue, settings.getType().getAggregation().apply(statisticValues).doubleValue()));
int finalStep = step;
Platform.runLater(() -> coinProgress.setProgress(finalStep / settings.getUpperBoundValue() - settings.getLowerBoundValue()));
Platform.runLater(() -> coinProgress.setProgress(finalStep / (settings.getUpperBoundValue() - settings.getLowerBoundValue())));
}
Platform.runLater(() -> coinProgress.setVisible(false));

Expand Down

0 comments on commit 0fe4d35

Please sign in to comment.