Skip to content

Conversation

@francastagna
Copy link
Collaborator

@francastagna francastagna commented Oct 22, 2025

PR Summary

We implemented the Breeder Genetic Algorithm (BGA) and added comprehensive tests.


Breeder GA Pseudocode:

image

Source: https://www.researchgate.net/publication/327166354_An_Empirical_Evaluation_of_Evolutionary_Algorithms_for_Unit_Test_Suite_Generation


Main Changes

  • New Algorithm (BreederGeneticAlgorithm):

    • Performs truncation selection to form parents pool P'.
    • At each step, creates 2 offspring from random parents in P', then carries over exactly 1 child.
    • Invokes lifecycle hooks: beginGeneration, endGeneration, beginStep, endStep.
    • Freezes targets each iteration: frozenTargets = archive.notCoveredTargets().
  • Config (EMConfig):

    • Added BreederGA to EMConfig.Algorithm.
    • Added breederTruncationFraction (default 0.5, range (0,1]) and breederParentsMin (default 2).

Tests

  • Breeder GA tests added (BreederGeneticAlgorithmTest.kt):
    • Finds optimum on OneMax (testBreederGeneticAlgorithmFindsOptimum).
    • Next generation shape (testNextGenerationIsElitesPlusTruncationChildren):
      • Preserves population size, carries elites, and adds exactly one child per iteration.
      • Verifies crossover and mutation counts per iteration.
    • Edge cases:
      • xoverProbability = 0.0, fixedRateMutation = 1.0 → no crossovers; exactly 2 * populationSize mutations; size preserved.
      • fixedRateMutation = 0.0, xoverProbability = 1.0 → exactly populationSize crossovers; zero mutations; size preserved.

@francastagna
Copy link
Collaborator Author

rp retest

@francastagna francastagna marked this pull request as ready for review October 28, 2025 13:51
@francastagna francastagna requested a review from arcuri82 October 28, 2025 13:51
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.

2 participants