Skip to content

Conversation

@francastagna
Copy link
Collaborator

PR Summary

We implemented and validated the Steady-State GA behavior and added comprehensive tests:

  • Steady-State GA now emits generation/step lifecycle events and uses score with frozen targets when deciding replacements.
  • New deterministic tests verify steady-state replacement logic and edge cases.

Main Changes

  • Steady-State GA (SteadyStateGeneticAlgorithm):
    • Invokes lifecycle hooks: beginGeneration, endGeneration, beginStep, endStep.
    • Freezes targets each iteration (frozenTargets = archive.notCoveredTargets()).
    • Uses score (respects frozenTargets) for replacement:
      • Replace the two selected parents with the two offspring only if max(score(o1), score(o2)) > max(score(p1), score(p2)).

Tests

  • Steady-State GA tests added/updated (SteadyStateGeneticAlgorithmTest.kt):
    • Finds optimum on OneMax.
    • Edge cases:
      • xoverProbability = 0.0 → no crossover; two mutations; population size preserved.
      • fixedRateMutation = 0.0 → crossover occurs; zero mutations; population size preserved.
    • Replacement behavior (deterministic via FixedSelectionStrategy) → next generation is created as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant