Repository navigation
Fix odd-N mating and add an opt-in two-shuffle pool - #10
Merged
Merged
Conversation
Odd populations now pair the leftover parent with parent 0 so parents[N-1] enters crossover. Even-N consecutive pairs are unchanged. MatingPoolMode.TwoShuffledPasses and TournamentMode.Algorithm2 are opt-in. RankNicheDistance, the independent pool, and the PymooCompatible coin flip stay the defaults. Co-authored-by: Jason <jkbennitt@users.noreply.github.com>
jkbennitt
pushed a commit
that referenced
this pull request
Sep 30, 2026
Resolve CHANGELOG Unreleased conflict after #10 (odd-N mating / two-shuffle) landed on main: keep both constraint/two-layer notes and mating-pool notes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Odd populations skipped
parents[N-1]in SBX because the pair cursor wrapped to 0 before that index was read. Das–Dennis sizes such as M=2, p=12 (N=13) and M=3, p=12 (N=91) hit this every generation. The leftover parent is now paired with parent 0, then the cursor restarts. Even N still walks(0,1), (2,3), …and wraps to(0,1)with no extra random draw, so the published ZDT1 (52) and DTLZ2 (92) pair sequences stay the same.Two opt-in modes follow the existing
TournamentModestyle. Defaults are unchanged.MatingPoolMode.TwoShuffledPasses: two shuffled passes of consecutive tournaments (Seada & Deb Algorithm 1 and pymoo 0.6.2TournamentSelectionwith pressure 2). When N parents are drawn from N members, each index is a contestant twice. The default pool remains N independent tournaments with replacement, which is the published ZDT1 Wilcoxon protocol.TournamentMode.Algorithm2: a same-niche perpendicular-distance tie keeps the second parent.PymooCompatiblestill coin-flips.RankNicheDistanceis unchanged. Either comparator works with either pool.No package version bump. No new IGD or Wilcoxon numbers.
Checklist
dotnet test Unsga3.slnx -c Releasepasses locallySurvival, normalization, duplicate keys,
p_c, and the published tables are untouched. Even-N mating order is locked by tests, so the published ZDT1 / DTLZ2 protocols are not remeasured.Test plan
dotnet test Unsga3.slnx -c Release— 87 passed, 0 failed.AdvanceMatingPairand a recording crossover proveparents[N-1]is an SBX parent for N=13 (and the cursor for N=3 and N=91).(0,1). A recording crossover checks the N=4 cycle does not use the odd wrap.SelectParentsfollows that contest order.Next/NextExceptdraws still match the previous sequence on a ranked population.Algorithm2keeps the second parent on a same-niche distance tie, still prefers the shorter distance, and still coin-flips an equal constraint violation.PymooCompatiblecoin-flip tests are unchanged.TwoShuffledPasses, andAlgorithm2returns a full population.What stayed unchanged
RankNicheDistancePymooCompatibledistance-tie coin flipp_c = 1.0PrepareForSelectionre-normalization