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
paramsmethod needs to return the parameters originally used to create the specimen (seeconstructorargument to functionSolver::new). - The
cmp_costmethod 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§
Provided Methods§
Sourcefn params_dist(&self, other: &Self) -> f64
fn params_dist(&self, other: &Self) -> f64
Euclidean distance between two specimens’ parameters
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".