pub trait StatFunctionsSolution<T>: StatFunctionsGoal {
// Required methods
fn get_average(&self) -> Option<(T, f64)>;
fn get_standard_deviation(&self) -> Option<(T, f64)>;
fn get_success_rate<P>(&self, predicate: P) -> Option<f64>
where P: Fn(&(T, f64)) -> bool;
}Expand description
The trait contains methods for calculate solution statistics for Vec<Option<Solution
Required Methods§
Sourcefn get_average(&self) -> Option<(T, f64)>
fn get_average(&self) -> Option<(T, f64)>
Calculate an average of solutions and goal function.
Returns None if self is empty or self contains None only.
Sourcefn get_standard_deviation(&self) -> Option<(T, f64)>
fn get_standard_deviation(&self) -> Option<(T, f64)>
Calculate a standard deviation of solutions goal function.
Returns None if length of self less 2 or self contains None only.
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<T: Float + Debug> StatFunctionsSolution<Vec<T>> for Vec<Option<(Vec<T>, f64)>>
impl<T: Float + Debug> StatFunctionsSolution<Vec<T>> for Vec<Option<(Vec<T>, f64)>>
Source§fn get_success_rate<P>(&self, predicate: P) -> Option<f64>
fn get_success_rate<P>(&self, predicate: P) -> Option<f64>
Calculate success rate between 0 and 1. Returns Some(SR) if running count > 0 and None otherwise.
§Params
predicate - function must return true for success solution and false otherwise.