Skip to main content

ConstrainedProblem

Trait ConstrainedProblem 

Source
pub trait ConstrainedProblem {
    // Required method
    fn objective(&self, x: &[f64]) -> f64;

    // Provided methods
    fn gradient(&self, x: &[f64]) -> Vec<f64> { ... }
    fn equalities(&self, _x: &[f64]) -> Vec<f64> { ... }
    fn equality_jacobian(&self, x: &[f64]) -> Vec<Vec<f64>> { ... }
    fn inequalities(&self, _x: &[f64]) -> Vec<f64> { ... }
    fn inequality_jacobian(&self, x: &[f64]) -> Vec<Vec<f64>> { ... }
    fn lagrangian_hessian(
        &self,
        _x: &[f64],
        _equality_multipliers: &[f64],
        _inequality_multipliers: &[f64],
    ) -> Option<Vec<Vec<f64>>> { ... }
    fn lagrangian_hessian_vector(
        &self,
        _x: &[f64],
        _equality_multipliers: &[f64],
        _inequality_multipliers: &[f64],
        _v: &[f64],
    ) -> Option<Vec<f64>> { ... }
}
Expand description

A constrained minimization problem. Only ConstrainedProblem::objective is required; constraints default to none and derivatives to central differences.

Required Methods§

Source

fn objective(&self, x: &[f64]) -> f64

Provided Methods§

Source

fn gradient(&self, x: &[f64]) -> Vec<f64>

Source

fn equalities(&self, _x: &[f64]) -> Vec<f64>

Equality constraints h(x) = 0.

Source

fn equality_jacobian(&self, x: &[f64]) -> Vec<Vec<f64>>

Rows ∇h_i(x)ᵀ.

Source

fn inequalities(&self, _x: &[f64]) -> Vec<f64>

Inequality constraints g(x) ≤ 0.

Source

fn inequality_jacobian(&self, x: &[f64]) -> Vec<Vec<f64>>

Rows ∇g_j(x)ᵀ.

Source

fn lagrangian_hessian( &self, _x: &[f64], _equality_multipliers: &[f64], _inequality_multipliers: &[f64], ) -> Option<Vec<Vec<f64>>>

The Hessian of the Lagrangian ∇²f + Σ λ_i ∇²h_i + Σ μ_j ∇²g_j (rows), with the sign convention of the solvers, for trust_constr_with and HessianUpdate::Exact. The default, None, means that it is not available.

Source

fn lagrangian_hessian_vector( &self, _x: &[f64], _equality_multipliers: &[f64], _inequality_multipliers: &[f64], _v: &[f64], ) -> Option<Vec<f64>>

The product of the Lagrangian Hessian with a vector v, for problems where forming the matrix is too costly (SciPy’s hessp). Used by trust_constr_with and HessianUpdate::Exact when ConstrainedProblem::lagrangian_hessian gives None; the default, None, means that it is not available.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§