Skip to content

Commit 8fcda18

Browse files
Debabrata AcharyaDebabrata Acharya
authored andcommitted
fix stabilization of objectives
1 parent 21cfe2d commit 8fcda18

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To use it as a maven dependency add the following to your `pom.xml` file:
5959
<dependency>
6060
<groupId>com.debacharya</groupId>
6161
<artifactId>nsgaii</artifactId>
62-
<version>3.1.1</version>
62+
<version>3.1.3</version>
6363
</dependency>
6464
</dependencies>
6565
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<groupId>com.debacharya</groupId>
1616
<artifactId>nsgaii</artifactId>
17-
<version>3.1.1</version>
17+
<version>3.1.3</version>
1818
<packaging>jar</packaging>
1919

2020
<inceptionYear>2019</inceptionYear>

src/main/java/com/debacharya/nsgaii/termination/StabilizationOfObjectives.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,13 @@ public boolean shouldRun(Population population, int generationCount, int maxGene
6565
this.avgObjectives.size()
6666
);
6767

68-
for(int i = 1; i < avgObjectivesToConsider.size(); i++) {
69-
70-
double diff = Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i));
71-
68+
for(int i = 1; i < avgObjectivesToConsider.size(); i++)
7269
if((this.shouldRoundOff
7370
? Service.roundOff(
74-
diff,
75-
this.roundOffDecimalPlace
76-
) : diff) > this.stabilizationThreshold)
71+
Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i)),
72+
this.roundOffDecimalPlace
73+
) : Math.abs(avgObjectivesToConsider.get(i - 1) - avgObjectivesToConsider.get(i))) > this.stabilizationThreshold)
7774
return true;
78-
}
79-
8075

8176
return false;
8277
}

0 commit comments

Comments
 (0)