pub struct AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where MappingAlm: Fn(&[f64], &mut [f64]) -> FunctionCallResult, MappingPm: Fn(&[f64], &mut [f64]) -> FunctionCallResult, ParametricGradientType: Fn(&[f64], &[f64], &mut [f64]) -> FunctionCallResult, ParametricCostType: Fn(&[f64], &[f64], &mut f64) -> FunctionCallResult, ConstraintsType: Constraint, AlmSetC: Constraint, LagrangeSetY: Constraint,
{ /* private fields */ }
Expand description

Definition of optimization problem to be solved with AlmOptimizer. The optimization problem has the general form

$$\begin{aligned} \mathrm{Minimize}\ f(u) \\ u \in U \\ F_1(u) \in C \\ F_2(u) = 0 \end{aligned}$$

where

  • $u\in\mathbb{R}^{n_u}$ is the decision variable,
  • $f:\mathbb{R}^n\to\mathbb{R}$ is a $C^{1,1}$-smooth cost function,
  • $U$ is a (not necessarily convex) closed subset of $\mathbb{R}^{n_u}$ on which we can easily compute projections (e.g., a rectangle, a ball, a second-order cone, a finite set, etc),
  • $F_1:\mathbb{R}^{n_u}\to\mathbb{R}^{n_1}$ and $F_2:\mathbb{R}^{n_u} \to\mathbb{R}^{n_2}$ are mappings with smooth partial derivatives, and
  • $C\subseteq\mathbb{R}^{n_1}$ is a convex closed set on which we can easily compute projections.

Implementations§

source§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where MappingAlm: Fn(&[f64], &mut [f64]) -> FunctionCallResult, MappingPm: Fn(&[f64], &mut [f64]) -> FunctionCallResult, ParametricGradientType: Fn(&[f64], &[f64], &mut [f64]) -> FunctionCallResult, ParametricCostType: Fn(&[f64], &[f64], &mut f64) -> FunctionCallResult, ConstraintsType: Constraint, AlmSetC: Constraint, LagrangeSetY: Constraint,

source

pub fn new( constraints: ConstraintsType, alm_set_c: Option<AlmSetC>, alm_set_y: Option<LagrangeSetY>, parametric_cost: ParametricCostType, parametric_gradient: ParametricGradientType, mapping_f1: Option<MappingAlm>, mapping_f2: Option<MappingPm>, n1: usize, n2: usize ) -> Self

Constructs new instance of AlmProblem

§Arguments
  • constraints: hard constraints, set $U$
  • alm_set_c: Set $C$ of ALM-specific constraints (convex, closed)
  • alm_set_y: Compact, convex set $Y$ of Lagrange multipliers, which needs to be a compact subset of $C^*$ (the convex conjugate of the convex set $C{}\subseteq{}\mathbb{R}^{n_1}$)
  • parametric_cost: Parametric cost function, $\psi(u, \xi)$, where $\xi = (c, y)$
  • parametric_gradient: Gradient of cost function wrt $u$, that is $\nabla_x \psi(u, \xi)$
  • mapping_f1: Mapping F1 of ALM-specific constraints ($F1(u) \in C$)
  • mapping_f2: Mapping F2 of PM-specific constraints ($F2(u) = 0$)
  • n1: range dimension of $F_1(u)$ (that is, mapping_f1)
  • n2: range dimension of $F_2(u)$ (that is, mapping_f2)
§Returns

Instance of AlmProblem

§Example
use optimization_engine::{FunctionCallResult, alm::*, constraints::Ball2};

let psi = |_u: &[f64], _p: &[f64], _cost: &mut f64| -> FunctionCallResult { Ok(()) };
let dpsi = |_u: &[f64], _p: &[f64], _grad: &mut [f64]| -> FunctionCallResult { Ok(()) };
let n1 = 0;
let n2 = 0;
let bounds = Ball2::new(None, 10.0);
let _alm_problem = AlmProblem::new(
    bounds, NO_SET, NO_SET, psi, dpsi, NO_MAPPING, NO_MAPPING, n1, n2,
);

Auto Trait Implementations§

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Freeze for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: Freeze, ConstraintsType: Freeze, LagrangeSetY: Freeze, MappingAlm: Freeze, MappingPm: Freeze, ParametricCostType: Freeze, ParametricGradientType: Freeze,

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> RefUnwindSafe for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: RefUnwindSafe, ConstraintsType: RefUnwindSafe, LagrangeSetY: RefUnwindSafe, MappingAlm: RefUnwindSafe, MappingPm: RefUnwindSafe, ParametricCostType: RefUnwindSafe, ParametricGradientType: RefUnwindSafe,

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Send for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: Send, ConstraintsType: Send, LagrangeSetY: Send, MappingAlm: Send, MappingPm: Send, ParametricCostType: Send, ParametricGradientType: Send,

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Sync for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: Sync, ConstraintsType: Sync, LagrangeSetY: Sync, MappingAlm: Sync, MappingPm: Sync, ParametricCostType: Sync, ParametricGradientType: Sync,

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Unpin for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: Unpin, ConstraintsType: Unpin, LagrangeSetY: Unpin, MappingAlm: Unpin, MappingPm: Unpin, ParametricCostType: Unpin, ParametricGradientType: Unpin,

§

impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> UnwindSafe for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
where AlmSetC: UnwindSafe, ConstraintsType: UnwindSafe, LagrangeSetY: UnwindSafe, MappingAlm: UnwindSafe, MappingPm: UnwindSafe, ParametricCostType: UnwindSafe, ParametricGradientType: 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V