pub trait OptimizationProblem<const N: usize> {
type Input;
type Output;
type Error: Error + Send + Sync + 'static;
// Required methods
fn input(&self, x: &[f64; N]) -> Result<Self::Input, Self::Error>;
fn objective(
&self,
input: &Self::Input,
output: &Self::Output,
) -> Result<f64, Self::Error>;
}Expand description
Defines an optimization problem to be solved.
An optimization problem maps solver variables to a model input, then computes a scalar objective value from the model input and output.
The direction of optimization (minimize or maximize) is determined by
the solver function chosen (e.g., golden_section::minimize vs
golden_section::maximize).
The const generic N is the number of solver variables.
For example, N = 1 represents a scalar optimization problem.