Skip to main content

FitnessValue

Trait FitnessValue 

Source
pub trait FitnessValue:
    PartialOrd
    + Clone
    + Send
    + Sync
    + Debug
    + Serialize
    + DeserializeOwned
    + 'static {
    // Required methods
    fn to_f64(&self) -> f64;
    fn is_better_than(&self, other: &Self) -> bool;

    // Provided method
    fn is_worse_than(&self, other: &Self) -> bool { ... }
}
Expand description

Trait bound for fitness values

Fitness values must be comparable and convertible to f64 for probabilistic selection operations. They must also be serializable for checkpointing.

Required Methods§

Source

fn to_f64(&self) -> f64

Convert fitness to f64 for probabilistic operations

Source

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

Check if this fitness is better than another

Provided Methods§

Source

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

Check if this fitness is worse than another

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.

Implementations on Foreign Types§

Source§

impl FitnessValue for f32

Source§

fn to_f64(&self) -> f64

Source§

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

Source§

impl FitnessValue for f64

Source§

fn to_f64(&self) -> f64

Source§

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

Source§

impl FitnessValue for i32

Source§

fn to_f64(&self) -> f64

Source§

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

Source§

impl FitnessValue for i64

Source§

fn to_f64(&self) -> f64

Source§

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

Source§

impl FitnessValue for usize

Source§

fn to_f64(&self) -> f64

Source§

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

Implementors§