Struct metaheuristics_nature::Fx
source · [−]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
.
Implementations
Trait Implementations
Auto Trait Implementations
impl<'a, R, const N: usize> !RefUnwindSafe for Fx<'a, R, N>
impl<'a, R, const N: usize> Send for Fx<'a, R, N>
impl<'a, R, const N: usize> Sync for Fx<'a, R, N>
impl<'a, R, const N: usize> Unpin for Fx<'a, R, N>
impl<'a, R, const N: usize> !UnwindSafe for Fx<'a, R, N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more