In this JCP paper, the authors simultaneously enforce the discrete maximum principles and element-wise mass balance for advection-diffusion equations through convex optimization. The least-squares finite element method is used, so the problem becomes a mixed formulation with a flux variable $\boldsymbol{q}\in\mathbb{R}^{n_qdofs}$ and a scalar concentration $\boldsymbol{c}\in\mathbb{R}^{n_cdofs}$. The constraint optimization problem in the discrete setting is as follows:
$$\begin{align} \min_{q,c} \ &\tfrac12\langle c, K_{cc}c\rangle + \langle c, K_{cq}q\rangle + \tfrac12\langle q, K_{qq}q\rangle + \langle c,r_c \rangle + \langle q,r_q\rangle\tag{A}\\ \text{subject to: } &A_c c+ A_q q = b_f\tag{B}\\ &c_{\text{min}}\preceq c\preceq c_{\text{max}} \tag{C} \end{align} $$
where (B) is the equality constraints for element-wise mass balance and (C) is the bounded constraints to ensure discrete maximum principles. It is known that simply solving unconstrained version of (A) satisfies neither (B) nor (C), and the authors claim that this constrained optimization problem can satisfy both properties using MATLAB's quadprog function (interior-point-convex algorithm).
If only (B) is enforced, there will still be violations in maximum principles, but the solution will be locally conservative.
If only (C) is enforced, there will still be errors in mass balance, but the solution will satisfy the maximum principles.
If both (B) and (C) are enforced, it makes sense to me that maximum principles will be met, but will element-wise mass balance necessarily be met? Based on what I understand about quadratic programming problems, the constraint (B) is associated with a lagrange multiplier $\lambda$ and is added to the objective functional (A), so if I am applying bounds to the new objective functional (A)+$\lambda\cdot$(B), wouldn't I still have some violations in mass balance (B) because my resulting objective functional value will be non-zero?