Skip to main content

ObjectiveFunction

Trait ObjectiveFunction 

Source
pub trait ObjectiveFunction: Send + Sync {
    // Required methods
    fn evaluate(&self, parameters: &[f32]) -> OptimizerResult<f32>;
    fn dimension(&self) -> usize;

    // Provided methods
    fn bounds(&self) -> Option<(Vec<f32>, Vec<f32>)> { ... }
    fn name(&self) -> &str { ... }
}
Expand description

Trait for objective functions in gradient-free optimization

Required Methods§

Source

fn evaluate(&self, parameters: &[f32]) -> OptimizerResult<f32>

Evaluate the objective function at given parameters Returns the scalar loss value

Source

fn dimension(&self) -> usize

Get the dimension of the parameter space

Provided Methods§

Source

fn bounds(&self) -> Option<(Vec<f32>, Vec<f32>)>

Get parameter bounds (lower, upper) if any

Source

fn name(&self) -> &str

Get the name of the objective function

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§