ADProblem

Struct ADProblem 

Source
pub struct ADProblem<T, const X: usize, const CACHE: bool> { /* private fields */ }
Expand description

Wrapper struct that handles caching and sparsity detection to interface between the blackbox model and IPOPT.

Implementations§

Source§

impl<T: SimpleADProblem<X>, const X: usize> ADProblem<T, X, false>

Source

pub fn new(problem: T) -> Self

Initialize an NLP using the SimpleADProblem interface.

Source§

impl<T: CachedADProblem<X>, const X: usize> ADProblem<T, X, true>

Source

pub fn new_cached(problem: T) -> Result<Self, T::Error>

Initialize an NLP using the CachedADProblem interface.

Trait Implementations§

Source§

impl<T: SimpleADProblem<X>, const X: usize> BasicProblem for ADProblem<T, X, false>

Source§

fn num_variables(&self) -> usize

Total number of variables of the non-linear problem.
Source§

fn bounds(&self, x_l: &mut [f64], x_u: &mut [f64]) -> bool

Specify lower and upper variable bounds given by x_l and x_u respectively. Read more
Source§

fn initial_point(&self, x: &mut [f64]) -> bool

Construct the initial guess of the primal variables for Ipopt to start with. Read more
Source§

fn objective(&self, x: &[f64], _: bool, obj: &mut f64) -> bool

Objective function. This is the function being minimized. Read more
Source§

fn objective_grad(&self, x: &[f64], _: bool, grad_f: &mut [f64]) -> bool

The gradient of the objective function speficies the search direction to Ipopt. Read more
Source§

fn indexing_style(&self) -> IndexingStyle

Specify the indexing style used for arrays in this problem. (Default is zero-based)
Source§

fn initial_bounds_multipliers(&self, z_l: &mut [f64], z_u: &mut [f64]) -> bool

Construct the initial guess of the lower and upper bounds multipliers for Ipopt to start with. Read more
Source§

fn variable_scaling(&self, _x_scaling: &mut [f64]) -> bool

Provide custom variable scaling. Read more
Source§

fn objective_scaling(&self) -> f64

Provide custom scaling for the objective function. Read more
Source§

impl<T: CachedADProblem<X>, const X: usize> BasicProblem for ADProblem<T, X, true>

Source§

fn num_variables(&self) -> usize

Total number of variables of the non-linear problem.
Source§

fn bounds(&self, x_l: &mut [f64], x_u: &mut [f64]) -> bool

Specify lower and upper variable bounds given by x_l and x_u respectively. Read more
Source§

fn initial_point(&self, x: &mut [f64]) -> bool

Construct the initial guess of the primal variables for Ipopt to start with. Read more
Source§

fn objective(&self, x: &[f64], new_x: bool, obj: &mut f64) -> bool

Objective function. This is the function being minimized. Read more
Source§

fn objective_grad(&self, x: &[f64], new_x: bool, grad_f: &mut [f64]) -> bool

The gradient of the objective function speficies the search direction to Ipopt. Read more
Source§

fn indexing_style(&self) -> IndexingStyle

Specify the indexing style used for arrays in this problem. (Default is zero-based)
Source§

fn initial_bounds_multipliers(&self, z_l: &mut [f64], z_u: &mut [f64]) -> bool

Construct the initial guess of the lower and upper bounds multipliers for Ipopt to start with. Read more
Source§

fn variable_scaling(&self, _x_scaling: &mut [f64]) -> bool

Provide custom variable scaling. Read more
Source§

fn objective_scaling(&self) -> f64

Provide custom scaling for the objective function. Read more
Source§

impl<T: SimpleADProblem<X>, const X: usize> ConstrainedProblem for ADProblem<T, X, false>

Source§

fn num_constraints(&self) -> usize

Number of equality and inequality constraints.
Source§

fn num_constraint_jacobian_non_zeros(&self) -> usize

Number of non-zeros in the constraint Jacobian.
Source§

fn constraint(&self, x: &[f64], _: bool, g: &mut [f64]) -> bool

Constraint function. Read more
Source§

fn constraint_bounds(&self, g_l: &mut [f64], g_u: &mut [f64]) -> bool

Specify lower and upper bounds, g_l and g_u respectively, on the constraint function. Read more
Source§

fn constraint_jacobian_indices( &self, rows: &mut [i32], cols: &mut [i32], ) -> bool

Constraint Jacobian indices. Read more
Source§

fn constraint_jacobian_values( &self, x: &[f64], _: bool, vals: &mut [f64], ) -> bool

Constraint Jacobian values. Read more
Source§

fn num_hessian_non_zeros(&self) -> usize

Number of non-zeros in the Hessian matrix. Read more
Source§

fn hessian_indices(&self, rows: &mut [i32], cols: &mut [i32]) -> bool

Hessian indices. Read more
Source§

fn hessian_values( &self, x: &[f64], _new_x: bool, obj_factor: f64, lambda: &[f64], vals: &mut [f64], ) -> bool

Hessian values. Read more
Source§

fn initial_constraint_multipliers(&self, lambda: &mut [f64]) -> bool

Construct the initial guess of the constraint multipliers for Ipopt to start with. Read more
Source§

fn constraint_scaling(&self, _g_scaling: &mut [f64]) -> bool

Provide custom constraint function scaling. Read more
Source§

impl<T: CachedADProblem<X>, const X: usize> ConstrainedProblem for ADProblem<T, X, true>

Source§

fn num_constraints(&self) -> usize

Number of equality and inequality constraints.
Source§

fn num_constraint_jacobian_non_zeros(&self) -> usize

Number of non-zeros in the constraint Jacobian.
Source§

fn constraint(&self, x: &[f64], new_x: bool, g: &mut [f64]) -> bool

Constraint function. Read more
Source§

fn constraint_bounds(&self, g_l: &mut [f64], g_u: &mut [f64]) -> bool

Specify lower and upper bounds, g_l and g_u respectively, on the constraint function. Read more
Source§

fn constraint_jacobian_indices( &self, rows: &mut [i32], cols: &mut [i32], ) -> bool

Constraint Jacobian indices. Read more
Source§

fn constraint_jacobian_values( &self, x: &[f64], new_x: bool, vals: &mut [f64], ) -> bool

Constraint Jacobian values. Read more
Source§

fn num_hessian_non_zeros(&self) -> usize

Number of non-zeros in the Hessian matrix. Read more
Source§

fn hessian_indices(&self, rows: &mut [i32], cols: &mut [i32]) -> bool

Hessian indices. Read more
Source§

fn hessian_values( &self, x: &[f64], _new_x: bool, obj_factor: f64, lambda: &[f64], vals: &mut [f64], ) -> bool

Hessian values. Read more
Source§

fn initial_constraint_multipliers(&self, lambda: &mut [f64]) -> bool

Construct the initial guess of the constraint multipliers for Ipopt to start with. Read more
Source§

fn constraint_scaling(&self, _g_scaling: &mut [f64]) -> bool

Provide custom constraint function scaling. Read more

Auto Trait Implementations§

§

impl<T, const X: usize, const CACHE: bool> !Freeze for ADProblem<T, X, CACHE>

§

impl<T, const X: usize, const CACHE: bool> !RefUnwindSafe for ADProblem<T, X, CACHE>

§

impl<T, const X: usize, const CACHE: bool> Send for ADProblem<T, X, CACHE>
where T: Send,

§

impl<T, const X: usize, const CACHE: bool> !Sync for ADProblem<T, X, CACHE>

§

impl<T, const X: usize, const CACHE: bool> Unpin for ADProblem<T, X, CACHE>
where T: Unpin,

§

impl<T, const X: usize, const CACHE: bool> UnwindSafe for ADProblem<T, X, CACHE>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.