pub struct Fx<R: Fitness, const N: usize> { /* fields omitted */ }
Expand description
A quick interface help to create objective function from a callable object.
use metaheuristics_nature::{Fx, Rga, Solver};
let f = Fx::new(|v| v[0] * v[0] + 8. * v[1] * v[1] + v[2] * v[2] + v[3] * v[3])
.lb([-50.; 4])
.ub([50.; 4]);
let s = Solver::build(Rga::default())
.task(|ctx| ctx.gen == 20)
.solve(f);
Adaptive version is FxAdaptive
.
Create objective function from a callable object.
Representation of the fitness value.
Return fitness, the smaller value represents a good result. Read more
Return the final result of the problem. Read more
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.