Skip to main content

Module ordering

Module ordering 

Source
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

Structs§

DeterministicScore
QuantKey
8-byte packed sort key: i32 quantized score + u32 ID prefix.
Ranked
Ranked item: score descending, ID ascending for ties.
ScoredEntry
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.