@evolite/core
    Preparing search index...

    Interface geneticAlgorithmOptions<Entity>

    Configuration options for initializing a new GeneticAlgorithm instance. *

    interface geneticAlgorithmOptions<Entity extends WithFitness> {
        fitnessObjective?: number;
        fittestAlwaysSurvives?: boolean;
        initialPopulation: Entity[];
        logging?: boolean;
        loggingInterval?: number;
        maxPopulationSize?: number;
        mutationRate?: number;
        optimization?: Optimize;
        yieldEvery?: number;
    }

    Type Parameters

    Index
    fitnessObjective?: number

    Optional target fitness score. If any individual reaches or surpasses this fitness value (depending on the optimization direction), the evolution process terminates early.

    fittestAlwaysSurvives?: boolean

    If true, the fittest individual of the current generation is automatically carried over to the next generation unchanged (elitism).

    true

    initialPopulation: Entity[]

    The starting set of individuals.

    Must contain more than one individual to enable selection and crossover operations.

    logging?: boolean

    Whether to log evolutionary progress metrics to the console during evolution.

    false

    loggingInterval?: number

    The interval (in generations) at which to output progress metrics if logging is enabled.

    1 (logs every generation)

    maxPopulationSize?: number

    The maximum population size allowed at the end of each generation.

    20

    mutationRate?: number

    The probability (from 0.0 to 1.0) that a generated child will undergo mutation.

    0.01 (1% chance)

    optimization?: Optimize

    Determines whether the algorithm should attempt to maximize or minimize the fitness values.

    Optimize.Maximize

    yieldEvery?: number

    The interval (in generations) at which the algorithm voluntarily yields to the JavaScript event loop. Set to 0 to disable yielding. This helps prevent UI freezing in single-threaded environments (like browsers) during long running tasks.

    0