Osqp
All copied from here: Arxiv Link
Problem
Consider the following optimization problem
where \(x\in \reals^{n}\) is the decision variable.
The objective function is defined by a positive semidefinite matrix \(P \in \symm_{+}^{n}\) and a vector \(q \in \reals^{n}\), and the constraints by a matrix \(A\in \reals^{m \times n}\) and a nonempty, closed and convex set \(\mathcal{C} \subseteq \reals^m\).
Primal dual solution
We will find it convenient to rewrite problem~\eqref{pb:main} by introducing an additional decision variable \(z\in\reals^m\), to obtain the equivalent problem
We can write the optimality conditions of problem \(\eqref{pb:equivalent}\) as
where \(y\in \reals^{m}\) is the Lagrange multiplier associated with the constraint \(Ax=z\) and \(N_{\mathcal{C}}(z)\) denotes the normal cone of \(\mathcal{C}\) at \(z\).
If there exist \(x \in \reals^n\), \(z \in \reals^{m}\) and \(y \in \reals^{m}\) that satisfy the conditions above, then we say that \((x,z)\) is a primal and \(y\) is a dual solution to problem \(\eqref{pb:equivalent}\).
We define the primal and dual residuals of problem \(\eqref{pb:main}\) as
Algorithm
- given initial values \(x^0\), \(z^0\), \(y^0\) and parameters \(\rho>0\), \(\sigma>0\), \(\alpha \in (0,2)\)
- Repeat
- \((\tilde{x}^{k+1}, \nu^{k+1}) \gets\) solve linear system \(\begin{bmatrix} P + \sigma I & A^\tpose \\ A & -\rho^{-1}I \end{bmatrix} \begin{bmatrix} \tilde{x}^{k+1} \\ \nu^{k+1} \end{bmatrix}= \begin{bmatrix}\sigma x^{k} - q \\ z^{k} - \rho^{-1} y^k \end{bmatrix}\)
- \(\tilde{z}^{k+1} \gets z^k + \rho^{-1}(\nu^{k+1} - y^{k})\) OR with Indirect Solver: \(\tilde{z}^{k+1} = A\tilde{x}^{k+1}\)
- \(x^{k+1} \gets \alpha \tilde{x}^{k+1} + (1-\alpha)x^{k}\)
- \(z^{k+1} \gets \Pi\left(\alpha \tilde{z}^{k+1} + (1-\alpha)z^{k} + \rho^{-1} y^{k} \right)\)
- \(y^{k+1} \gets y^{k} + \rho \left( \alpha \tilde{z}^{k+1} + (1-\alpha)z^{k} - z^{k+1} \right)\)
- Until termination criterion is satisfied
where \(\sigma>0\) and \(\rho>0\) are the step-size parameters, \(\alpha \in (0,2)\) is the relaxation parameter, and \(\Pi\) denotes the Euclidean projection onto \(\mathcal{C}\).
Indirect Linear Solver
With regards to step 3 of the algorithm, in our applications we solve indirectly:
With large-scale QP, factoring linear system in step 3 might be prohibitive. In these cases it might be more convenient to use an indirect method by solving instead the linear system
obtained by eliminating \(\nu^{k+1}\) from (step 3). We then compute \(\tilde{z}^{k+1}\) as \(\tilde{z}^{k+1} = A\tilde{x}^{k+1}\).
Note that the coefficient matrix in the above linear system is always positive definite.
The linear system can therefore be solved with an iterative scheme such as the conjugate gradient method.
When the linear system is solved up to some predefined accuracy, we terminate the method.