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§
Sourcefn evaluate(&self, parameters: &Array1<f64>) -> DeviceResult<ObjectiveResult>
fn evaluate(&self, parameters: &Array1<f64>) -> DeviceResult<ObjectiveResult>
Evaluate the objective function
Sourcefn compute_gradient_with_method(
&self,
parameters: &Array1<f64>,
method: &GradientMethod,
) -> DeviceResult<Array1<f64>>
fn compute_gradient_with_method( &self, parameters: &Array1<f64>, method: &GradientMethod, ) -> DeviceResult<Array1<f64>>
Compute gradient with specific method
Sourcefn estimate_cost(&self, parameters: &Array1<f64>) -> usize
fn estimate_cost(&self, parameters: &Array1<f64>) -> usize
Estimate computational cost for given parameters
Provided Methods§
Sourcefn compute_gradient(
&self,
parameters: &Array1<f64>,
) -> DeviceResult<Array1<f64>>
fn compute_gradient( &self, parameters: &Array1<f64>, ) -> DeviceResult<Array1<f64>>
Compute gradient using specified method
Sourcefn supports_batch_evaluation(&self) -> bool
fn supports_batch_evaluation(&self) -> bool
Check if objective supports batched evaluation
Sourcefn batch_evaluate(
&self,
parameter_sets: &[Array1<f64>],
) -> DeviceResult<Vec<ObjectiveResult>>
fn batch_evaluate( &self, parameter_sets: &[Array1<f64>], ) -> DeviceResult<Vec<ObjectiveResult>>
Batch evaluate multiple parameter sets (if supported)