Skip to content

Commit

Permalink
fix stabilization of objectives
Browse files Browse the repository at this point in the history
  • Loading branch information
Debabrata Acharya authored and Debabrata Acharya committed Sep 21, 2020
1 parent 21cfe2d commit 8fcda18
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ To use it as a maven dependency add the following to your `pom.xml` file:
<dependency>
<groupId>com.debacharya</groupId>
<artifactId>nsgaii</artifactId>
<version>3.1.1</version>
<version>3.1.3</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.debacharya</groupId>
<artifactId>nsgaii</artifactId>
<version>3.1.1</version>
<version>3.1.3</version>
<packaging>jar</packaging>

<inceptionYear>2019</inceptionYear>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8fcda18

Please sign in to comment.