pub trait PopulationState: State {
// Required methods
fn candidates(&self) -> &[Self::Param];
fn costs(&self) -> &[Self::Float];
}Expand description
States built around a population of λ candidate parameters and
parallel costs.
Mirrors SimplexState: the trait exists so termination criteria
that need to inspect the whole population (diversity, generation
spread, stall counters) can bound on a richer view than
State::param / State::cost, which only see the best
candidate. The vehicle for stochastic solvers
(RandomSearch; CMA-ES once it lands).
§Contract
- Implementor must: keep
candidatesandcostssorted by ascending cost at the start and end of everySolver::next_itercall (and at the end ofSolver::init). SoState::param/State::costalways return the current best candidate (candidates[0]/costs[0]). - Implementor must: sort
NaNcosts last, so a single bad evaluation can’t drag itself to the front and become the “best” candidate. - Implementor must: keep the two slices the same length and in
parallel order —
costs[i]is the cost atcandidates[i].
Required Methods§
Sourcefn candidates(&self) -> &[Self::Param]
fn candidates(&self) -> &[Self::Param]
All λ candidates, sorted by ascending cost.
Sourcefn costs(&self) -> &[Self::Float]
fn costs(&self) -> &[Self::Float]
Costs in parallel with candidates, sorted
ascending.