Skip to main content

DeterministicObjective

Trait DeterministicObjective 

Source
pub trait DeterministicObjective<T>: Objective<T>
where T: HasId,
{ // Required methods fn select_deterministic<'a>( &self, candidates: &'a [T], context: &ObjectiveContext, ) -> ObjectiveResult<Selection<&'a T>>; fn select_top_deterministic<'a>( &self, candidates: &'a [T], n: usize, context: &ObjectiveContext, ) -> Vec<Selection<&'a T>>; }
Expand description

Extension trait for deterministic selection with UUID tie-breaking.

Provides reproducible ordering when multiple candidates have equal scores. Requires candidates to implement HasId for UUID-based tie-breaking.

Ordering is determined by:

  1. Score (descending) using canonical IEEE-754 total-order ranks
  2. UUID (ascending) for tie-breaking

Required Methods§

Source

fn select_deterministic<'a>( &self, candidates: &'a [T], context: &ObjectiveContext, ) -> ObjectiveResult<Selection<&'a T>>

Select the best candidate with deterministic tie-breaking.

Source

fn select_top_deterministic<'a>( &self, candidates: &'a [T], n: usize, context: &ObjectiveContext, ) -> Vec<Selection<&'a T>>

Select the top N candidates with deterministic ordering.

Implementors§

Source§

impl<O, T> DeterministicObjective<T> for O
where O: Objective<T>, T: HasId,

Blanket implementation of DeterministicObjective for any Objective where T: HasId.