Search⌘ K
AI Features

The Dual of Quadratic Programing (QP)

Explore the concept of the dual in quadratic programming problems within constrained optimization. Understand how the dual problem reduces complex primal constraints to simpler box constraints and how it can be solved using the projected gradient descent algorithm. Apply these concepts through an example using NumPy to solve investment allocation minimizing risk.

The dual of a QP problem is also another QP problem but with simpler box constraints. Therefore, no matter how complex the primal constraints are, the dual of a QP problem will always have box constraints and can always be solved using the PGD algorithm.

Calculating the dual of the QP problem

Consider a QP problem with the primal objective given as follows:

where ARm×dA \in \R^{m \times d}, bRmb \in \R^m, cRdc \in \R^d, and QRd×dQ \in \R^{d\times d} is a square symmetric positive definite matrix.

The Lagrangian function is given by the following:

where λRm0\lambda \in \R^m \geq 0 are Lagrange multipliers.

Note: The Lagrangian here is a convex function because it is a combination of quadratic and linear functions. Therefore, the local optimum is always the global optimal solution.

To find the dual objective D(λ)=minxRd£(x,λ)\mathcal{D}(\lambda) = \min_{x \in \R^d} \pounds(x, \lambda) ...