ObjectiveFunction

Trait ObjectiveFunction 

Source
pub trait ObjectiveFunction: Send + Sync {
    // Required methods
    fn evaluate(&self, params: &[f64]) -> f64;
    fn num_parameters(&self) -> usize;

    // Provided method
    fn gradient(&self, params: &[f64]) -> Vec<f64> { ... }
}
Expand description

Trait for objective functions to be minimized.

Required Methods§

Source

fn evaluate(&self, params: &[f64]) -> f64

Evaluate the objective function at given parameters.

Source

fn num_parameters(&self) -> usize

Number of parameters.

Provided Methods§

Source

fn gradient(&self, params: &[f64]) -> Vec<f64>

Compute the gradient of the objective.

Default implementation uses finite differences.

Implementors§