pub fn argmax_host(fitness: &[f32]) -> usizeExpand description
Returns the index of the largest fitness value.
fitness is canonical (maximise): higher is better. The scan keeps
the running best under a strict > seeded from NEG_INFINITY, so:
- ties resolve to the lowest index,
NaNand−infentries never displace the running best (every comparison against them or the seed is strict), and- a slice with no entry above
−inf(e.g. all-NaN) falls back to index0.
§Examples
use rlevo_evolution::ops::selection::argmax_host;
let fitness = [1.0_f32, 5.0, 3.0];
assert_eq!(argmax_host(&fitness), 1);§Panics
Panics if fitness.is_empty().