pub trait Specimen {
    // Required methods
    fn params(&self) -> &[f64];
    fn cmp_cost(&self, other: &Self) -> Ordering;

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

Specimen in evolutionary process.

Two methods are required to be implemented:

  • The params method needs to return the parameters originally used to create the specimen (see constructor argument to function Solver::new).
  • The cmp_cost method compares specimen by their fitness (lower cost values are better).

For most cases, the module provides a BasicSpecimen which is an implementation only storing the params and cost values.

Required Methods§

source

fn params(&self) -> &[f64]

Parameters used for creation.

source

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

Compare specimen’s fitness (Less means better).

Provided Methods§

source

fn params_dist(&self, other: &Self) -> f64

Euclidean distance between two specimens’ parameters

Implementors§