Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[T any] struct { PopulationSize int Generations int MutationRate float64 CrossoverRate float64 ElitismCount int ConcurrencyLevel int // Number of goroutines for fitness evaluation (default: runtime.NumCPU()) Seed *[32]byte // Optional seed for reproducible deterministic runs (ChaCha8) InitFunc InitFunc[T] FitnessFunc FitnessFunc[T] SelectionFunc SelectionFunc[T] CrossoverFunc CrossoverFunc[T] MutationFunc MutationFunc[T] // Optional callback executed at the end of each generation OnGeneration func(generation int, best T, bestFitness float64, avgFitness float64) }
Config holds the configuration for the Engine.
type CrossoverFunc ¶
CrossoverFunc performs crossover between two parents to produce two offspring.
type Engine ¶
type Engine[T any] struct { // contains filtered or unexported fields }
Engine is the core struct that drives the evolutionary process.
func (*Engine[T]) EvaluatePopulation ¶
EvaluatePopulation evaluates all individuals in the population concurrently.
type FitnessFunc ¶
FitnessFunc evaluates the fitness of a single individual. Higher values should represent better fitness (maximization).
type MutationFunc ¶
MutationFunc mutates an individual based on the given mutation rate.
Click to show internal directories.
Click to hide internal directories.