Trait nlopt::MObjFn

source ·
pub trait MObjFn<U>: Fn(&mut [f64], &[f64], Option<&mut [f64]>, &mut U) { }
Expand description

A trait representing a multi-objective function.

A multi-objective function takes the form of a closure f(result: &mut [f64], x: &[f64], gradient: Option<&mut [f64], user_data: &mut U)

  • result - m-dimensional array to store the value f(x)
  • x - n-dimensional array
  • gradient - n×m-diconstraint array to store the gradient grad f(x). The n dimension of gradient is stored contiguously, so that df_i / dx_j is stored in gradient[i*n + j]. If gradient is Some(x), the user is required to return a valid gradient, otherwise the optimization will most likely fail.
  • user_data - user defined data

Implementors§

source§

impl<T, U> MObjFn<U> for T
where T: Fn(&mut [f64], &[f64], Option<&mut [f64]>, &mut U),