Skip to content

Conversation

@francastagna
Copy link
Collaborator

@francastagna francastagna commented Oct 22, 2025

PR Summary

We implemented and validated the Cellular Genetic Algorithm (cGA) and added comprehensive tests.


Cellular 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 (CellularGeneticAlgorithm):

    • Performs neighborhood-restricted evolution: for each index i, selects two parents from the neighborhood, produces 2 offspring, and keeps the local best between parent and offspring.
    • Invokes lifecycle hooks: beginGeneration, endGeneration, beginStep, endStep.
    • Freezes targets each iteration: frozenTargets = archive.notCoveredTargets().
  • Config (EMConfig):

    • Added CellularGA to EMConfig.Algorithm.
    • Added CGANeighborhoodModel { RING, L5, C9, C13 } and property cgaNeighborhoodModel (default RING).

Tests

  • Neighborhood tests added (NeighborhoodTest.kt):

    • Validates index wrap-around and neighborhood composition for RING/L5/C9/C13 using identity checks.
  • Cellular GA tests added (CellularGeneticAlgorithmTest.kt):

    • Finds optimum on OneMax (testCellularGeneticAlgorithmFindsOptimum).
    • Next generation shape (testNextGenerationIsLocalWinnersFromNeighborhood):
      • Preserves population size; for each position i, next[i] is either the original parent or one of the two offspring produced at i.
    • Edge cases:
      • xoverProbability = 0.0, fixedRateMutation = 1.0 → no crossovers; one mutation per position; size preserved.
      • fixedRateMutation = 0.0, xoverProbability = 1.0 → one crossover per position; zero mutations; size preserved.

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