Fix SpeciatedFitnessEliminator to sort FitnessObserver inputs by raw fitness#155
Merged
HyperCodec merged 4 commits intomainfrom Mar 11, 2026
Merged
Conversation
…tnessEliminator Co-authored-by: HyperCodec <72839119+HyperCodec@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix sorting issue in FitnessObserver input
Fix SpeciatedFitnessEliminator to sort FitnessObserver inputs by raw fitness
Mar 11, 2026
HyperCodec
approved these changes
Mar 11, 2026
There was a problem hiding this comment.
Pull request overview
This PR fixes SpeciatedFitnessEliminator so FitnessObserver::observe receives fitness values sorted by raw (pre-division) fitness, aligning the ordering with the values being observed while preserving speciation-aware elimination behavior (which still uses divided fitness).
Changes:
- Sort observer inputs by raw fitness (rayon + non-rayon), then re-sort by divided fitness for truncation/selection.
- Document
FitnessObserver::observeinput ordering contract (descending by fitness). - Add an integration test validating raw-fitness ordering for observer inputs under speciation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| genetic-rs-common/src/builtin/eliminator.rs | Adjusts SpeciatedFitnessEliminator::eliminate to sort observer inputs by raw fitness and adds a doc note about descending order. |
| genetic-rs/tests/speciation.rs | Adds a new test ensuring the speciated eliminator’s observer sees raw fitness values in descending order. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: HyperCodec <72839119+HyperCodec@users.noreply.github.com>
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.
SpeciatedFitnessEliminator::eliminate(non-rayon + rayon) to sort observer inputs by raw fitness before calling observerFitnessObserver::observenoting inputs are sorted descending by fitnessobserver_receives_fitness_sorted_by_raw_descendingverifying observer receives raw-fitness-descending ordergenomeswith the low-fitness genome first so the input is deliberately unsorted, making the test fail if sorting is absentOriginal prompt
FitnessObserverfix still doesn't quite sort exactly as previously #154🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.