Expand description
Deterministic ordering primitives for objective functions
This module provides utilities for deterministic ordering of scored candidates, ensuring reproducible results across processes, architectures, and executions.
§Key Components
HasId: Trait for candidates with stable UUID identifierscanonical_f64/canonical_f32: Normalize floating-point values for comparisoncmp_desc_score_then_id: Deterministic comparator (f64 + Uuid) with UUID tie-breakingScoredEntry: Ord-implementing wrapper for heap operations, backed byDeterministicScoreQuantKey: Re-exported fromkhive-score— 8-byte packed sort key (i32 score + u32 ID prefix)DeterministicScore: Re-exported fromkhive-score— i64 fixed-point scoreRanked: Re-exported fromkhive-score— score + genericOrdID pair for heaps
Structs§
- Deterministic
Score - Quant
Key - 8-byte packed sort key: i32 quantized score + u32 ID prefix.
- Ranked
- Ranked item: score descending, ID ascending for ties.
- Scored
Entry - A wrapper for scored candidates that implements deterministic
Ord.
Traits§
- HasId
- Trait for candidates with stable UUID identifiers.
Functions§
- canonical_
f32 - Normalize an f32 value to canonical form for comparison.
- canonical_
f64 - Normalize an f64 value to canonical form for comparison.
- cmp_
asc_ score_ then_ id - Compare two scored candidates in ascending score order with UUID tie-breaking.
- cmp_
asc_ then_ id - Compare scores ascending, lower ID wins ties.
- cmp_
desc_ score_ then_ id - Compare two scored candidates in descending score order with UUID tie-breaking.
- cmp_
desc_ then_ id - Compare scores descending, lower ID wins ties.