Expand description
Typed constraint set for zero-erasure incremental scoring.
This module provides the ConstraintSet trait which enables fully
monomorphized constraint evaluation without virtual dispatch.
§Zero-Erasure Architecture
Traditional constraint providers return Vec<Box<dyn Constraint>> which
requires virtual dispatch on every evaluation. ConstraintSet instead
uses tuple-based storage where each constraint type is known at compile time.
use solverforge_scoring::api::constraint_set::ConstraintSet;
use solverforge_core::score::SimpleScore;
// Typed tuple of constraints - no Box, no dyn
fn example<S, C1, C2>(constraints: (C1, C2), solution: &S) -> SimpleScore
where
S: Send + Sync + 'static,
C1: solverforge_scoring::api::constraint_set::IncrementalConstraint<S, SimpleScore>,
C2: solverforge_scoring::api::constraint_set::IncrementalConstraint<S, SimpleScore>,
{
constraints.evaluate_all(solution)
}Structs§
- Constraint
Result - A set of constraints that can be evaluated together.
Traits§
- Constraint
Set - Incremental
Constraint - A single constraint with incremental scoring capability.