Skip to content

Commit

Permalink
fix randomizedQuickSortForCrowdingDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
Debabrata Acharya authored and Debabrata Acharya committed May 7, 2020
1 parent 6dd49ed commit 54d3b8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/target/
.DS_Store
licenseheader.txt
nb-configuration.xml
nb-configuration.xml
.classpath
.idea/
.project
.settings/
NSGA-II.iml
4 changes: 2 additions & 2 deletions src/main/java/io/onclave/nsga/ii/api/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ private static int partitionForCrowdingDistance(final List<Chromosome> populace,

if(populace.get(j).getCrowdingDistance() >= pivot) {

Service.swapForRank(populace, pivotIndex, j);
Service.swapForCrowdingDistance(populace, pivotIndex, j);
++pivotIndex;
}
}

Service.swapForRank(populace, pivotIndex, tail);
Service.swapForCrowdingDistance(populace, pivotIndex, tail);

return pivotIndex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Chromosome {
private final Allele[] geneticCode;
private int dominationCount = 0;
private double fitness;
private int rank;
private int rank = 1;

private Chromosome(final Chromosome chromosome) {

Expand Down

0 comments on commit 54d3b8e

Please sign in to comment.