pub struct ProbQP<L: LinAlgEx> { /* private fields */ }
Expand description
Quadratic program
The problem is \[ \begin{array}{ll} {\rm minimize} & {1 \over 2} x^T P x + q^T x + r \\ {\rm subject \ to} & G x \preceq h \\ & A x = b, \end{array} \] where
- variables \( x \in \mathbb{R}^n \)
- \( P \in \mathcal{S}_{+}^n,\ q \in \mathbb{R}^n,\ r \in \mathbb{R} \)
- \( G \in \mathbb{R}^{m \times n},\ h \in \mathbb{R}^m \)
- \( A \in \mathbb{R}^{p \times n},\ b \in \mathbb{R}^p \).
In the following, \( r \) does not appear since it does not matter.
The representation as a conic linear program is as follows: \[ \begin{array}{ll} {\rm minimize} & t \\ {\rm subject \ to} & \left[ \begin{array}{ccc} 0 & 0 \\ q^T & -1 \\ -P^{1 \over 2} & 0 \\ G & 0 \\ A & 0 \end{array} \right] \left[ \begin{array}{c} x \\ t \end{array} \right] + s = \left[ \begin{array}{c} 1 \\ 0 \\ 0 \\ h \\ b \end{array} \right] \\ & s \in \mathcal{Q}_r^{2 + n} \times \mathbb{R}_+^m \times \lbrace 0 \rbrace^p. \end{array} \]
\( \mathcal{Q}_r \) is a rotated second-order (or quadratic) cone (see ConeRotSOC
).
Implementations§
source§impl<L: LinAlgEx> ProbQP<L>
impl<L: LinAlgEx> ProbQP<L>
sourcepub fn new(
sym_p: MatBuild<L>,
vec_q: MatBuild<L>,
mat_g: MatBuild<L>,
vec_h: MatBuild<L>,
mat_a: MatBuild<L>,
vec_b: MatBuild<L>,
eps_zero: L::F
) -> Self
pub fn new(
sym_p: MatBuild<L>,
vec_q: MatBuild<L>,
mat_g: MatBuild<L>,
vec_h: MatBuild<L>,
mat_a: MatBuild<L>,
vec_b: MatBuild<L>,
eps_zero: L::F
) -> Self
Creates a QP with given data.
Returns the ProbQP
instance.
sym_p
is \(P\) which shall belong tototsu_core::MatType::SymPack
.vec_q
is \(q\).mat_g
is \(G\).vec_h
is \(h\).mat_a
is \(A\).vec_b
is \(b\).eps_zero
should be the same value astotsu_core::solver::SolverParam::eps_zero
.
sourcepub fn problem(
&mut self
) -> (ProbQPOpC<L>, ProbQPOpA<'_, L>, ProbQPOpB<'_, L>, ProbQPCone<L>, &mut [L::F])
pub fn problem(
&mut self
) -> (ProbQPOpC<L>, ProbQPOpA<'_, L>, ProbQPOpB<'_, L>, ProbQPCone<L>, &mut [L::F])
Generates the problem data structures to be fed to Solver::solve
.
Returns a tuple of operators, a cone and a work slice.