Struct optimization_engine::alm::AlmProblem
source · 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,
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,
sourcepub 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
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
: MappingF1
of ALM-specific constraints ($F1(u) \in C$)mapping_f2
: MappingF2
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>
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>
impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Sync for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
impl<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY> Unpin for AlmProblem<MappingAlm, MappingPm, ParametricGradientType, ParametricCostType, ConstraintsType, AlmSetC, LagrangeSetY>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more