pub trait Problem {
// Required method
fn objective(&self, x: &[f64]) -> f64;
// Provided methods
fn n_constraints(&self) -> usize { ... }
fn constraints(&self, _x: &[f64], _out: &mut [f64]) { ... }
fn gradient(&self, _x: &[f64], _grad: &mut [f64]) -> bool { ... }
fn jacobian(&self, _x: &[f64], _jac: &mut [f64]) -> bool { ... }
}Expand description
A nonlinear program. Implement objective; override the rest as needed.
gradient / jacobian return false (their default) to request a
finite-difference approximation. The Hessian is never required — the
builder uses a limited-memory (L-BFGS) approximation by default.
Required Methods§
Provided Methods§
Sourcefn n_constraints(&self) -> usize
fn n_constraints(&self) -> usize
Number of constraints m (default 0, i.e. bound-constrained only).
Sourcefn constraints(&self, _x: &[f64], _out: &mut [f64])
fn constraints(&self, _x: &[f64], _out: &mut [f64])
Constraint values g(x) into out (length n_constraints).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".