MachineLearning/genetic_algorithm library

Genetic Algorithm (generic)

A production-grade, generic genetic algorithm (GA) module that supports:

  • generic individual type T with user-provided crossover, mutate, and fitness functions
  • steady-state and generational replacement strategies
  • tournament selection, elitism, and configurable mutation rates
  • reproducible RNG via seed

Contract:

  • Input: population generator, fitness(T)->double (higher is better), crossover(T,T,Random)->T, mutate(T,Random)->T, and hyperparameters.
  • Output: run returns best individual and its fitness.
  • Errors: throws ArgumentError for invalid parameters.

Classes

GeneticAlgorithm<T>