ObjectiveFunction

Trait ObjectiveFunction 

Source
pub trait ObjectiveFunction: Send + Sync {
    // Required methods
    fn evaluate(
        &self,
        parameters: &Array1<f64>,
    ) -> DeviceResult<ObjectiveResult>;
    fn compute_gradient_with_method(
        &self,
        parameters: &Array1<f64>,
        method: &GradientMethod,
    ) -> DeviceResult<Array1<f64>>;
    fn estimate_cost(&self, parameters: &Array1<f64>) -> usize;
    fn parameter_bounds(&self) -> Option<Vec<(f64, f64)>>;

    // Provided methods
    fn compute_gradient(
        &self,
        parameters: &Array1<f64>,
    ) -> DeviceResult<Array1<f64>> { ... }
    fn supports_batch_evaluation(&self) -> bool { ... }
    fn batch_evaluate(
        &self,
        parameter_sets: &[Array1<f64>],
    ) -> DeviceResult<Vec<ObjectiveResult>> { ... }
}
Expand description

Enhanced objective function trait

Required Methods§

Source

fn evaluate(&self, parameters: &Array1<f64>) -> DeviceResult<ObjectiveResult>

Evaluate the objective function

Source

fn compute_gradient_with_method( &self, parameters: &Array1<f64>, method: &GradientMethod, ) -> DeviceResult<Array1<f64>>

Compute gradient with specific method

Source

fn estimate_cost(&self, parameters: &Array1<f64>) -> usize

Estimate computational cost for given parameters

Source

fn parameter_bounds(&self) -> Option<Vec<(f64, f64)>>

Get parameter bounds

Provided Methods§

Source

fn compute_gradient( &self, parameters: &Array1<f64>, ) -> DeviceResult<Array1<f64>>

Compute gradient using specified method

Source

fn supports_batch_evaluation(&self) -> bool

Check if objective supports batched evaluation

Source

fn batch_evaluate( &self, parameter_sets: &[Array1<f64>], ) -> DeviceResult<Vec<ObjectiveResult>>

Batch evaluate multiple parameter sets (if supported)

Implementors§