Expand description
Parent-selection operators.
Selection operators turn a fitness slice into winner indices that the
caller uses (via Tensor::select) to gather parents out of the
population. The baseline is host-side sampling + a single device
gather; a fused kernel variant is tracked as
follow-up work.
All operators that draw random numbers accept an explicit &mut dyn Rng
(the host-RNG convention). Operators never touch thread-local or
process-wide backend RNG state (B::seed / Tensor::random), which
would race with sibling tests under the parallel test runner.
§Fitness convention
Fitness values are canonical (maximise): higher is better.
Tournament selection retains the largest fitness seen across all
candidates in a single draw; truncation selection returns the top_k
entries with the largest fitnesses; argmax_host reduces a fitness
slice to the index of its single largest entry.
Functions§
- argmax_
host - Returns the index of the largest fitness value.
- tournament_
indices_ host - K-ary tournament selection over a fitness slice.
- tournament_
select - Gathers
n_winnersrows out of a population tensor by tournament. - truncation_
indices_ host - Returns the indices of the
top_khighest-fitness members. - truncation_
select - Gathers the
top_khighest-fitness rows out of a population tensor.