Struct metaheuristics_nature::FxAdaptive
source ·
[−]Expand description
A quick interface help to create adaptive objective function from a callable object.
use metaheuristics_nature::{FxAdaptive, Rga, Solver};
let f = FxAdaptive::new(|v, f| v[0] * v[0] + 8. * v[1] * v[1] + v[2] * v[2] + v[3] * v[3] * f)
.lb([-50.; 4])
.ub([50.; 4]);
let s = Solver::build(Rga::default())
.task(|ctx| ctx.gen == 20)
.adaptive(|ctx| ctx.gen as f64)
.solve(f);
Non-adaptive version is Fx
.