Skip to content

Commit 6fffdc2

Browse files
committed
Fix a bug in crossover.py
1 parent 08fb08a commit 6fffdc2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/jmetal/operator/crossover.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ def execute(self, parents: List[PermutationSolution]) -> List[PermutationSolutio
224224

225225
# Resolve mappings with cycle detection
226226
visited1 = set()
227-
while val1 in mapping and val1 not in visited1:
227+
while val1 in mapping_child1 and val1 not in visited1:
228228
visited1.add(val1)
229-
val1 = mapping[val1]
229+
val1 = mapping_child1[val1]
230230

231231
visited2 = set()
232-
while val2 in mapping and val2 not in visited2:
232+
while val2 in mapping_child2 and val2 not in visited2:
233233
visited2.add(val2)
234-
val2 = mapping[val2]
234+
val2 = mapping_child2[val2]
235235

236236
offspring[0].variables[i] = val1
237237
offspring[1].variables[i] = val2

0 commit comments

Comments
 (0)