Skip to content

Conversation

@francastagna
Copy link
Collaborator

@francastagna francastagna commented Oct 28, 2025

PR Summary

We implemented and validated the 1+(λ, λ) Genetic Algorithm and added comprehensive tests


1+(λ, λ) GA Pseudocode

image

Main Changes

  • New Algorithm (OnePlusLambdaLambdaGeneticAlgorithm)

    • Implements the 1+(λ, λ) loop:
      • Generate λ mutants from the parent, pick best mutant.
      • Do λ/2 crossovers between parent and best mutant, pick best offspring.
      • Replace parent iff best offspring is strictly better.
    • Lifecycle hooks: beginGeneration, endGeneration, beginStep, endStep.
    • Freezes targets per generation via frozenTargets = archive.notCoveredTargets().
  • Config (EMConfig) and Wiring

    • Added OnePlusLambdaLambdaGA to EMConfig.Algorithm.
    • Uses onePlusLambdaLambdaOffspringSize (λ), xoverProbability, fixedRateMutation.
  • Docs

    • Updated docs/options.md to include the new algorithm and parameters.

Tests

  • New/Updated tests (OnePlusLambdaLambdaGeneticAlgorithmTest.kt):
    • Finds Optimum (testOnePlusLambdaLambdaGeneticAlgorithmFindsOptimum):
      • Reaches the OneMax optimum under standard constraints.
    • Parent Kept When Offspring Worse (testParentKeptWhenOffspringWorse).
    • Best Offspring Kept Better Than Parent (testBestOffspringKeptWhenBetterThanParent):
    • Edge Cases
      • xoverProbability = 0.0, fixedRateMutation = 1.0 → no crossovers; λ mutants; size preserved.
      • fixedRateMutation = 0.0, xoverProbability = 1.0 → λ/2 crossovers; 0 mutants; size preserved.

@francastagna francastagna changed the title Feature/one plus lambda lambda OnePlusLambdaLambda GA Oct 28, 2025
@francastagna francastagna marked this pull request as ready for review October 30, 2025 11:51
@francastagna francastagna requested a review from arcuri82 October 30, 2025 11:52
@arcuri82 arcuri82 merged commit 3b24190 into master Oct 31, 2025
13 checks passed
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.

3 participants