genetic-algorithm-fn 0.1.0

Using genetic algorithms to maximize functions.
Documentation
1
2
3
4
5
6
7
8
9
10
use crate::function;
pub fn triple_multiplication() -> fn(Vec<f64>) -> Result<f64, function::FunctionError> {
    |x| match x.len() {
        3 => Ok(x[0] * x[1] * x[2]),
        _ => Err(function::FunctionError::WrongNumberOfEntries {
            actual_number_of_entries: x.len(),
            expected_number_of_entries: 3,
        }),
    }
}