Skip to main content

mu_comma_lambda

Function mu_comma_lambda 

Source
pub fn mu_comma_lambda<B: Backend>(
    offspring: Tensor<B, 2>,
    offspring_fitness: &[f32],
    mu: usize,
    device: &<B as BackendTypes>::Device,
) -> (Tensor<B, 2>, Vec<f32>)
Expand description

(μ, λ) replacement: discards parents and keeps the μ best offspring.

Parents are not passed to this function; only the λ offspring compete for the μ survivor slots. This strategy deliberately discards parent solutions each generation, which can help the population escape local optima and tracks moving optima better than (μ + λ). Requires lambda >= mu (offspring_fitness.len() >= mu).

The returned tensor has shape (mu, genome_dim) and the returned fitness vector has length mu, both ordered by selection rank (best first).

§Panics

Panics if mu > offspring_fitness.len() (i.e. lambda < mu).