CVXOPT HW3
$\newcommand{\qq}{\quad\quad}$ $\newcommand{\lag}{\mathcal{L}}$
1. Consider the optimization problem
$$ \begin{align} \text{minimize}\qq & c^Tx\\ \text{subject to}\qq & f(x) \le 0 \end{align} $$with $c \ne 0$. We don’t not assume $f$ is convex.
a) Write down the dual problem in terms of the conjugate $f^*$. Explain why the dual problem is convex.
Let us first write down the Lagrangian
$$ \lag(x, \lambda) = c^Tx + \lambda f(x) $$The the Lagrangian dual becomes
$$ \begin{gather} g(\lambda) = \inf_x \{c^Tx + \lambda f(x)\}\\ g(\lambda) = - \sup_x \{ - c^Tx - \lambda f(x) \} \\ g(\lambda) = - \sup_x \{ \lambda (-\frac{1}{\lambda}c^Tx - f(x)) \} \\ g(\lambda) = - \lambda \sup_x \left\{ \left(-\frac{1}{\lambda}c\right)^Tx - f(x) \right\} \\ \end{gather} $$We know that the conjugate of $f$ is $f^*(y) = \sup_x\{y^Tx - f(x)\}$
$$ \begin{gather} g(\lambda) = - \lambda f^*(-\frac{1}{\lambda}c) \end{gather} $$Now that we have the dual, we can form the Lagrange dual problem
$$ \begin{align} \text{maximize}\qq & g(\lambda) = - \lambda f^*(-\frac{1}{\lambda}c)\\ \text{such that}\qq & \lambda \ge 0 \end{align} $$Convexity of this problem
$f^*(y)$ is convex is in $y$ because it is a point-wise maximum of an affine function $y^Tx$.
Then $-f^*(y)$ is concave in $y$. More generally, $-\lambda f^*(y)$ is concave in $y$ if $\lambda$ is non-negative.
Our formulation of the dual problem has a constraint on $\lambda$ that it should be non-negative. Hence our objective function $g = -\lambda f^*(-\frac{1}{\lambda}c)$ is always concave. As we are maximizing over a concave function, it is similar to minimizing a convex function.
Hence, the Lagrange dual problem is a convex optimization problem.$\square$
Write down the dual problem for the specific constraint:
$$ f(x) = x^T Q x - 1, Q \in S^n_{++} $$Our problem now becomes
$$ \begin{align} \text{minimize}\qq & c^Tx \\ \text{subject to}\qq & x^T Q x - 1 \le 0 \end{align} $$The Lagrangian is
$$ \begin{gather} \lag(x, \lambda) = c^Tx + \lambda (x^T Q x - 1) \\ \lag(x, \lambda) = \lambda x^T Q x + c^Tx - \lambda \end{gather} $$Notice that $\lag$ is a quadratic function in terms of $x$. We know that $Q\in S^n_{++} \implies Q \succ 0$. Hence there is a unique minimizer $x^* = \frac{-Q^{-1}c}{2\lambda}$.
$$ \begin{gather} \inf\lag(x, \lambda) = \lambda (x^*)^T Q x + c^Tx^* - \lambda\\ \inf\lag(x, \lambda) = \frac{-c^TQ^{-1}c}{4\lambda} - \lambda\\ g(\lambda) = \frac{-c^TQ^{-1}c}{4\lambda} - \lambda \end{gather} $$The Lagrangian dual problem is
$$ \begin{align} \text{maximize}\qq & \boxed{g(\lambda) = \frac{-c^TQ^{-1}c}{4\lambda} - \lambda}\\ \text{subject to}\qq & \boxed{\lambda \ge 0}\\ \end{align} $$c) Give analytic solutions (in terms of $Q$ and $c$) for $x^*$ and $\lambda^*$ for the problem in (b)
$$ \begin{align} \text{minimize}\qq & c^Tx \\ \text{subject to}\qq & x^T Q x - 1 \le 0 \end{align} $$We can solve this using Lagrange multipliers and ensuring that $\lambda$ points in the right direction (opposite to $c$)

We know that
$$ \begin{gather} \nabla_x(c^Tx) = -\lambda \nabla_x(x^TQx - 1)\\ c = -\lambda 2 Qx\\ x = \frac{-Q^{-1}c}{2\lambda} \end{gather} $$Substituting this in $\frac{df}{d\lambda} = f(x) = 0$ we get
$$ \begin{align} (\frac{-Q^{-1}c}{2\lambda})^T Q (\frac{-Q^{-1}c}{2\lambda}) - 1 &= 0\\ (\frac{c^TQ^{-1}}{2\lambda}) Q (\frac{-Q^{-1}c}{2\lambda}) - 1 &= 0\\ \frac{c^TQ^{-1}c}{4\lambda^2} - 1 &= 0\\ \frac{c^TQ^{-1}c}{4\lambda^2} &= 1\\ \lambda &= \frac{\sqrt{c^TQ^{-1}c}}{2}\\ \end{align} $$We choose the positive root as the negative lambda will point in the same direction as c
We find
$$ x^* = \frac{-Q^{-1}c}{2\lambda} = \frac{-Q^{-1}c}{\sqrt{c^T Q^{-1} c}} $$Hence the analytical solutions are $\boxed{x^* = \frac{-Q^{-1}c}{\sqrt{c^T Q^{-1} c}}, \lambda^* = \frac{\sqrt{c^TQ^{-1}c}}{2}}$
Similarly we can solve the dual problem
$$ \begin{align} \text{maximize}\qq & g(\lambda) = \frac{-c^TQ^{-1}c}{4\lambda} - \lambda\\ \text{subject to}\qq & \lambda \ge 0\\ \end{align} $$Differentiating $g$ w.r.t $\lambda$ and setting to 0
$$ \begin{gather} \frac{dg}{d\lambda}= \frac{c^TQ^{-1}c}{4\lambda^2} - 1 = 0\\ \frac{c^TQ^{-1}c}{4\lambda^2} = 1\\ \frac{\sqrt{c^TQ^{-1}c}}{2} = \lambda\\ \end{gather} $$Again we pick the positive root as there is a constraint on $\lambda$.
The maximizer is then $\lambda^* = \frac{\sqrt{c^TQ^{-1}c}}{2}$ which is the same as the primal problem.
d) Is your problem in part b) strongly dual? Prove that it is or isn’t.
Since we have to optimizers we can just evaluate them
$$ \begin{align} f(x^*) &= f\left(\frac{-Q^{-1}c}{\sqrt{c^T Q^{-1} c}}\right) = c^T\frac{-Q^{-1}c}{\sqrt{c^T Q^{-1} c}} = -\sqrt{c^T Q^{-1} c}\\ g(\lambda^*) &= g\left(\frac{\sqrt{c^TQ^{-1}c}}{2}\right) = \frac{-c^TQ^{-1}c}{4\frac{\sqrt{c^TQ^{-1}c}}{2}} - \frac{\sqrt{c^TQ^{-1}c}}{2}\\ & = \frac{-c^TQ^{-1}c}{2\sqrt{c^TQ^{-1}c}} - \frac{\sqrt{c^TQ^{-1}c}}{2}\\ & = \frac{-\sqrt{c^TQ^{-1}c}}{2} - \frac{\sqrt{c^TQ^{-1}c}}{2}\\ &= -\sqrt{c^TQ^{-1}c}\\ \implies p^* = d^* & \end{align} $$Looking it from another perspective, we know that $c^Tx$ and $x^TQx - 1$ are both convex functions and hence this is a convex optimization problem. We also have $x=0$ strictly satisfying the inequality, in turn satisfying Slater’s constraint qualification and thereby having strong duality.
e) Again for the specific model in part (b), give an argument for why the optimal dual variable $\lambda^*$ is strictly positive.
The Lagrange multiplier being 0 implies that the constraint is inactive meaning the global optimum is inside the feasible region thereby making the problem essentially unconstrained. But our objective function $\nabla_x c^Tx = c$ is never 0 as $c\ne 0$. Therefore the constraint has to be active.
We can see this analytically in our Lagrange multiplier formulation
$$ \begin{gather} \nabla_x(c^Tx) = -\lambda \nabla_x(x^TQx - 1)\\ c = -\lambda 2Qx \end{gather} $$If $\lambda$ were 0 then $c = 0$, which is a contradiction.
2) A penalty method for equality constraints. We consider the problem
$$ \begin{align} \text{minimize}\qq & f_0(x) \\ \text{subject to}\qq & Ax = b \end{align} $$In a quadratic penalty method we form an auxiliary function
$$ \phi(x) = f_0(x) + \alpha \|Ax- b\|_2^2 $$Where $\alpha > 0$ is a parameter. Suppose $\tilde{x}$ is a minimizer of $\phi$, then show how to find, from $\tilde{x}$, a dual feasible point and find the corresponding lower bound on the optimal value.
Convexity of $\phi$
- $f_0$ is convex
- $Ax-b$ is convex
- $\|\cdot\|$ is convex as well as $\|\cdot\|^2$
- Composing two convex functions with the outer non-decreasing is convex
- Non negative sum of $f_0$ and $\|Ax-b\|^2$ is then convex
If $\phi$ is a convex, differentiable function and $\tilde{x}$ minimizes it, then $\nabla \phi(\tilde{x})= 0$
$$ \begin{align} \nabla \phi(\tilde{x}) & = \nabla f_0(\tilde{x}) + \alpha\nabla(\|A\tilde{x} - b\|_2^2)\\ & = \nabla f_0(\tilde{x}) + 2\alpha A^T (A\tilde{x} - b)\\ & = \nabla f_0(\tilde{x}) + A^T (2\alpha(A\tilde{x} - b)) \\ 0 & = \nabla f_0(\tilde{x}) + A^T (2\alpha(A\tilde{x} - b))\\ \nabla f_0(\tilde{x}) & = A^T (-2\alpha(A\tilde{x} - b)) \end{align} $$Let us form the Lagrangian of the original problem
$$ \begin{gather} \lag(x, \nu) = f_0(x) + \nu^T(Ax-b)\\ g(\nu) = \inf_x\{f_0(x) + \nu^T(Ax-b)\} \end{gather} $$As we don’t have any inequality constraints there are no constraints on the Lagrangian dual. Let us find the infimum.
$$ \begin{gather} \nabla_x\lag(x, \nu) = \nabla f_0(x) + \nabla(\nu^T(Ax-b))\\ \nabla_x\lag(x, \nu) = \nabla f_0(x) + A^T\nu \\ 0 = \nabla f_0(x) + A^T\nu\\ \nabla f_0(x) = -A^T\nu\tag{$\nu$ is unconstrained}\\ \nabla f_0(x) = A^T\nu \end{gather} $$So, we just need an $x$ whose gradient is in $\mathcal{R}(A^T)$. But we already have such an $x$
$$ \nabla f_0(\tilde{x}) = A^T (-2\alpha(A\tilde{x} - b)) $$This is a dual feasible point with $\nu = -2\alpha(A\tilde{x} - b)$
The Lagrangian value at $\tilde{x}, -2\alpha(A\tilde{x} - b)$ is
$$ \begin{gather} \lag(\tilde{x}, -2\alpha(A\tilde{x} - b)) = f(x_0) + (-2\alpha(A\tilde{x} - b))^T(A\tilde{x} - b)\\ = f_0(\tilde{x}) + (-2\alpha(A\tilde{x} - b))^T(A\tilde{x} - b)\tag{absorb 2}\\ = f_0(\tilde{x}) - \alpha(A\tilde{x} - b)^T(A\tilde{x} - b)\\ = f_0(\tilde{x}) - \alpha\|A\tilde{x} - b\|^2_2\\ = \phi(\tilde{x}) \le f_o(x) \end{gather} $$Hence $\phi(\tilde{x})$ is a lower bound of $f_0$
3)
$\newcommand{\R}{\mathbb{R}}$
Let us remind ourselves what Farkas’s Lemma is
Given some $A\in R^{n\times n}, c\in \R^n$
$$ \exists x\in\R^n,\text{s.t. } Ax \preceq 0,\ c^Tx<0\\ \text{xor}\\ \exists y\in\R^n,\text{s.t. } A^Ty+c = 0,\ y\succeq 0 $$Let us pick $A = P^T$
Let us also pick some $c^*\in \R^n$ such that $c^* \succeq 0$ and $\mathbf{1}^Tc^* = 1$. $c^*$ is a valid probability distribution.
Let us set our $c = -c^*$. Farkas’s Lemma tells us that
$$ \exists x\in\R^n,\text{s.t. } P^Tx \preceq 0,\ (-c^*)^Tx<0\\ \text{xor}\\ \exists y\in\R^n,\text{s.t. } (P^T)^Ty-c^* = 0,\ y\succeq 0 $$Which simplifies to
$$ \exists x\in\R^n,\text{s.t. } P^Tx \preceq 0,\ -(c^*)^Tx<0\\ \text{xor}\\ \exists y\in\R^n,\text{s.t. } (P^T)y = c^*,\ y\succeq 0 $$Consider the first statement $P^Tx \preceq 0$, $-(c^*)^Tx < 0$
We know that if the second statement is true then $Py = y$
$$ \begin{gather} (Py)^T x > 0\\ y^TP^T x > 0\\ \end{gather} $$But we know that every element of $P^Tx$ is non-positive and every element of $y$ is non-negative. Then $y^TP^Tx \le 0$ which contradicts the condition. Hence no such $x$ exists.
4)
a)
$$ (Py)_i = \sum_j p_{ij}y_j = \sum_j p_{ji}y_i = y_i \sum_j p_{ji} = y_i $$Repeating this for all $i$ yields back $y$ itself.$\square$