Skip to main content

moead

Function moead 

Source
pub fn moead<F>(
    bounds: &[(f64, f64)],
    objectives: F,
    config: MoeadConfig,
) -> OptimizeResult<MoeadResult>
where F: Fn(&[f64]) -> Vec<f64>,
Expand description

Run MOEA/D on a multi-objective optimisation problem.

§Arguments

  • bounds - Decision-variable bounds [(lo, hi); n_vars].
  • objectives - Closure mapping a gene vector to an objective vector (all minimised).
  • config - Algorithm hyper-parameters.

§Errors

Returns an error for empty bounds, degenerate bound intervals, or if n_objectives < 2.

§Examples

use scirs2_optimize::multiobjective::moead::{moead, MoeadConfig};

let bounds: Vec<(f64, f64)> = vec![(0.0, 1.0); 10];
let mut cfg = MoeadConfig::default();
cfg.population_size = 20;
cfg.n_generations   = 5;
cfg.n_objectives    = 2;

let result = moead(&bounds, |x| {
    let f1 = x[0];
    let g = 1.0 + 9.0 * x[1..].iter().sum::<f64>() / (x.len()-1) as f64;
    vec![f1, g * (1.0 - (f1/g).sqrt())]
}, cfg).expect("valid input");

assert!(!result.pareto_front.is_empty());