diff --git a/README.md b/README.md index 3c904c4..f26459d 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ To use it as a maven dependency add the following to your `pom.xml` file: com.debacharya nsgaii - 3.1.1 + 3.1.3 ``` diff --git a/pom.xml b/pom.xml index 994b5f9..40aa6db 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ com.debacharya nsgaii - 3.1.1 + 3.1.3 jar 2019 diff --git a/src/main/java/com/debacharya/nsgaii/termination/StabilizationOfObjectives.java b/src/main/java/com/debacharya/nsgaii/termination/StabilizationOfObjectives.java index f2bf5b7..873243c 100644 --- a/src/main/java/com/debacharya/nsgaii/termination/StabilizationOfObjectives.java +++ b/src/main/java/com/debacharya/nsgaii/termination/StabilizationOfObjectives.java @@ -65,18 +65,13 @@ public boolean shouldRun(Population population, int generationCount, int maxGene this.avgObjectives.size() ); - for(int i = 1; i < avgObjectivesToConsider.size(); i++) { - - double diff = Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i)); - + for(int i = 1; i < avgObjectivesToConsider.size(); i++) if((this.shouldRoundOff ? Service.roundOff( - diff, - this.roundOffDecimalPlace - ) : diff) > this.stabilizationThreshold) + Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i)), + this.roundOffDecimalPlace + ) : Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i))) > this.stabilizationThreshold) return true; - } - return false; }