I have implemented an interior-point method algorithm tailored to a given class of problems (with following parameters: $H \in \mathbb{R}^{n \times n}, g \in \mathbb{R}^{n}, A \in \mathbb{R}^{m \times n}, b \in \mathbb{R}^{m}$): \begin{eqnarray} PQP: \quad &\underset{x \in \mathbb{R}^{n}}{\mathrm{min}}&\; \frac{1}{2} x^{T} H x + g^{T}x \\ &\mathrm{subject\;to}&\; Ax = b, \\ &&\; x \geq 0. \end{eqnarray} If I understand correctly, the Lagrangian function is as follows: \begin{equation} L(x, y, z) = \frac{1}{2} x^{T} H x + g^{T}x + y^{T} (b - Ax) - z^{T}x = b^{T} y - \frac{1}{2} x^{T} H x + x^{T} \left( Hx + g - A^{T} y - z \right), \end{equation} what would mean that a dual problem to the given one is constructed like that: \begin{eqnarray} DQP: \quad &\underset{y \in \mathbb{R}^{m}, z \in \mathbb{R}^{n}}{\mathrm{max}}&\; b^{T} y - \frac{1}{2} x^{T} H x \\ &\mathrm{subject\;to}&\; Hx + g - A^{T} y - z = 0, \\ &&\; z \geq 0. \end{eqnarray} (for brevity, I left $x$ in the objective function, but it can be easily derived from condition).
While checking for stopping condition, I validate if both primal and dual constraints are met:
- primary: $b - Ax = 0$
- dual: $Hx + g - A^{T} y - z = 0$
Since I have used Matlab environment, I compared results with quadprog function. What's bothering me is that solution doesn't meet dual problem constraints (primary is fine), neither for my implementation nor for quadprog.
It got me thinking that I might have wrongly defined a dual problem or that there is a weak duality gap, but I cannot find any reasonable source to validate that suspicions in the Internet (most of them refer only to inequality cases).