Skip to main content

Score

Trait Score 

Source
pub trait Score:
    Copy
    + Debug
    + Display
    + Default
    + Send
    + Sync
    + PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Add<Output = Self>
    + Sub<Output = Self>
    + Neg<Output = Self>
    + 'static {
Show 17 methods // Required methods fn is_feasible(&self) -> bool; fn zero() -> Self; fn levels_count() -> usize; fn to_level_numbers(&self) -> Vec<i64>; fn from_level_numbers(levels: &[i64]) -> Self; fn multiply(&self, multiplicand: f64) -> Self; fn divide(&self, divisor: f64) -> Self; fn abs(&self) -> Self; fn to_scalar(&self) -> f64; fn level_label(index: usize) -> ScoreLevel; // Provided methods fn compare(&self, other: &Self) -> Ordering { ... } fn is_better_than(&self, other: &Self) -> bool { ... } fn is_worse_than(&self, other: &Self) -> bool { ... } fn is_equal_to(&self, other: &Self) -> bool { ... } fn one_hard() -> Self { ... } fn one_soft() -> Self { ... } fn one_medium() -> Self { ... }
}
Expand description

Core trait for all score types in SolverForge.

Scores represent the quality of a planning solution. They are used to:

  • Compare solutions (better/worse/equal)
  • Guide the optimization process
  • Determine feasibility

All score implementations must be:

  • Immutable (operations return new instances)
  • Thread-safe (Send + Sync)
  • Comparable (total ordering)

§Score Levels

Scores can have multiple levels (e.g., hard/soft constraints):

  • Hard constraints: Must be satisfied for a solution to be feasible
  • Soft constraints: Optimization objectives to maximize/minimize

When comparing scores, higher-priority levels are compared first.

Required Methods§

Source

fn is_feasible(&self) -> bool

Source

fn zero() -> Self

Source

fn levels_count() -> usize

Source

fn to_level_numbers(&self) -> Vec<i64>

Source

fn from_level_numbers(levels: &[i64]) -> Self

Source

fn multiply(&self, multiplicand: f64) -> Self

Source

fn divide(&self, divisor: f64) -> Self

Source

fn abs(&self) -> Self

Source

fn to_scalar(&self) -> f64

Source

fn level_label(index: usize) -> ScoreLevel

Provided Methods§

Source

fn compare(&self, other: &Self) -> Ordering

Source

fn is_better_than(&self, other: &Self) -> bool

Source

fn is_worse_than(&self, other: &Self) -> bool

Source

fn is_equal_to(&self, other: &Self) -> bool

Source

fn one_hard() -> Self

Source

fn one_soft() -> Self

Source

fn one_medium() -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§