Implement scheduling algorithms and experimentation framework#3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def repair(child: List[int], segment: List[int], donor: List[int]) -> None: | ||
| mapping = {donor[i]: segment[i] for i in range(cx_point1, cx_point2)} | ||
| for idx in list(range(cx_point1)) + list(range(cx_point2, size)): | ||
| while child[idx] in mapping: | ||
| child[idx] = mapping[child[idx]] |
There was a problem hiding this comment.
Repair PMX children to avoid duplicate genes
The PMX crossover’s repair step maps donor genes to the swapped segment (mapping = {donor[i]: segment[i]}) and then repeatedly replaces child[idx] while that value is in the mapping. When a value from the inserted segment also occurs outside the crossover window—which is common for permutations—the key for that value is missing because the mapping is reversed. The loop therefore never replaces the duplicate (or can oscillate between two keys), yielding children with repeated or missing job indices and potentially non‑terminating while loops. Invalid permutations break the subsequent scheduling evaluation and can stall the NSGA‑II search.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6905635dcc148324aab009e512efab09