Skip to content

Commit

Permalink
addressed review by felixreimann
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhglass committed Apr 19, 2018
1 parent a2ed701 commit 2ce9dd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public Pair<PermutationGenotype<?>> crossover(PermutationGenotype<?> p1, Permuta
}

/**
* Helper function for crossover() to crossover and rotate up to the
* cutpoint.
* Helper function for crossover() to crossover and rotate up to the coined cut
* point.
*
* @param p1
* parent one
Expand Down Expand Up @@ -150,7 +150,7 @@ protected void crossoverToCutpoint(PermutationGenotype<?> p1, PermutationGenotyp
}

/**
* Helper function for crossover() to fill and rotate.
* Helper function for crossover() to fill and rotate after the cut point.
*
* @param p1
* parent one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ protected Map<Individual, Integer> getRank(List<List<Individual>> fronts) {
public List<List<Individual>> fronts(Collection<Individual> individuals) {

List<Individual> population = new ArrayList<Individual>(individuals);
Map<Individual, Integer> individualID = new HashMap<Individual, Integer>();
Map<Individual, Integer> individualIDs = new HashMap<Individual, Integer>();
for (int i = 0; i < population.size(); i++) {
individualID.put(population.get(i), i);
individualIDs.put(population.get(i), i);
}

List<List<Individual>> fronts = new ArrayList<List<Individual>>();
Expand All @@ -196,14 +196,14 @@ public List<List<Individual>> fronts(Collection<Individual> individuals) {

for (Individual e : population) {
dominatedIndividuals.put(e, new ArrayList<Individual>());
numberOfDominations[individualID.get(e)] = 0;
numberOfDominations[individualIDs.get(e)] = 0;
}

frontsResolveDomination(population, numberOfDominations, individualID, dominatedIndividuals);
frontsResolveDomination(population, numberOfDominations, individualIDs, dominatedIndividuals);

List<Individual> f1 = new ArrayList<Individual>();
for (Individual i : population) {
if (numberOfDominations[individualID.get(i)] == 0) {
if (numberOfDominations[individualIDs.get(i)] == 0) {
f1.add(i);
}
}
Expand All @@ -213,8 +213,8 @@ public List<List<Individual>> fronts(Collection<Individual> individuals) {
List<Individual> h = new ArrayList<Individual>();
for (Individual p : fi) {
for (Individual q : dominatedIndividuals.get(p)) {
numberOfDominations[individualID.get(q)]--;
if (numberOfDominations[individualID.get(q)] == 0) {
numberOfDominations[individualIDs.get(q)]--;
if (numberOfDominations[individualIDs.get(q)] == 0) {
h.add(q);
}
}
Expand Down

0 comments on commit 2ce9dd0

Please sign in to comment.