pub trait Objective:
Debug
+ Send
+ Sync {
// Required methods
fn value(
&self,
coefficients: &Array1<Float>,
data: &ObjectiveData,
) -> Result<Float>;
fn gradient(
&self,
coefficients: &Array1<Float>,
data: &ObjectiveData,
) -> Result<Array1<Float>>;
// Provided methods
fn value_and_gradient(
&self,
coefficients: &Array1<Float>,
data: &ObjectiveData,
) -> Result<(Float, Array1<Float>)> { ... }
fn supports_hessian(&self) -> bool { ... }
fn hessian(
&self,
_coefficients: &Array1<Float>,
_data: &ObjectiveData,
) -> Result<Array2<Float>> { ... }
}Expand description
Trait for optimization objectives that can be minimized
Required Methods§
Provided Methods§
Sourcefn value_and_gradient(
&self,
coefficients: &Array1<Float>,
data: &ObjectiveData,
) -> Result<(Float, Array1<Float>)>
fn value_and_gradient( &self, coefficients: &Array1<Float>, data: &ObjectiveData, ) -> Result<(Float, Array1<Float>)>
Compute both value and gradient (often more efficient than separate calls)
Sourcefn supports_hessian(&self) -> bool
fn supports_hessian(&self) -> bool
Check if the objective supports Hessian computation