ORF523: Getting around NP-hardness

In this post I would like to argue that showing $latex {\mathbf{NP}}&fg=000000$-completeness of a problem is in fact only a weak certificate of difficulty.

Dynamic Programming

Consider the problem $latex {\mathrm{PARTITION}}&fg=000000$ of the previous lecture (which is $latex {\mathbf{NP}}&fg=000000$-complete): given $latex {n}&fg=000000$ positive integers $latex {a_1, \hdots, a_n}&fg=000000$, does there exist $latex {S \subset \{1, \hdots, n\}}&fg=000000$ such that $latex {\sum_{i \in S} a_i = \sum_{i \in S^c} a_i}&fg=000000$?

Let $latex {N = \sum_{i=1}^n a_i}&fg=000000$. We will describe an algorithm which has a time complexity of $latex {O(n N)}&fg=000000$. At first sight this looks like a polynomial-time complexity, but if it was the case it would prove that $latex {\mathbf{P} = \mathbf{NP}}&fg=000000$. In fact this complexity is not quite polynomial: Note that the size of the encoding of the input for the problem (that is the integers $latex {a_1, \hdots, a_n}&fg=000000$) is of order $latex {\sum_{i=1}^n \log a_i}&fg=000000$. Thus $latex {N = \sum_{i=1}^n a_i}&fg=000000$ is exponential in the size of the encoding, which means that the time complexity $latex {O(n N)}&fg=000000$ is not polynomial. However the algorithm is polynomial with respect to the ‘numerical value’ of the input, and we say in that case that the algorithm is pseudo-polynomial. An $latex {\mathbf{NP}}&fg=000000$-complete problem with a pseudo-polynomial algorithm is called weakly $latex {\mathbf{NP}}&fg=000000$-complete. In particular $latex {\mathrm{PARTITION}}&fg=000000$ is weakly $latex {\mathbf{NP}}&fg=000000$-complete. On the contrary a problem is strongly $latex {\mathbf{NP}}&fg=000000$-complete if it is $latex {\mathbf{NP}}&fg=000000$-complete even when one uses unary coding for numbers rather than binary codin (this is a trick to enforce that polynomial-time now refers to polynomial-time in the numerical size of the input).

Let us now describe the algorithm with $latex {O(n N)}&fg=000000$-time complexity for $latex {\mathrm{PARTITION}}&fg=000000$. The idea is very simple, yet very powerful. It builds on the following observations: First remark that the question equivalently asks to find $latex {S \subset \{1, \hdots, n\}}&fg=000000$ such that $latex {\sum_{i \in S} a_i = N/2}&fg=000000$ ($latex {N}&fg=000000$ has to be even otherwise the partition problem is clearly impossible). Now Let $latex {T(j,\alpha) = \mathbf{1} \{\exists S\subset\{1,\hdots,j\} : \sum_{i \in S} a_i = \alpha\}}&fg=000000$, we want to know the value of $latex {T(n, N/2)}&fg=000000$. Note that $latex {T(j, \alpha)}&fg=000000$ is one if and only if either $latex {T(j-1, \alpha)}&fg=000000$ is one, or if $latex {T(j-1, \alpha -a_j)}&fg=000000$ is one. This relation gives us a dynamic programming algorithm: First compute $latex {T(1, \alpha), \alpha =1, \hdots, N/2}&fg=000000$, then using these values compute $latex {T(2, \alpha), \alpha =1, \hdots, N/2}&fg=000000$, and repeat this iteratively until computing $latex {T(n, N/2)}&fg=000000$ with the previously computed values $latex {T(n-1, \alpha), \alpha =1, \hdots, N/2}&fg=000000$. Each step of this iterative procedure is of complexity $latex {O(N)}&fg=000000$, and there is a total of $latex {n}&fg=000000$ steps, resulting in a complexity of $latex {O(n N)}&fg=000000$ to solve $latex {\mathrm{PARTITION}}&fg=000000$.

In general the idea of dynamic programming is to break down recursively the problem into a limited number of simpler pieces. It is a very powerful technique of wide applicability, but we won’t have time to see other examples.


SDP relaxations

We discuss now the problem $latex {\mathrm{MAXCUT}}&fg=000000$, which is the optimization version of the decision problem $latex {\mathrm{CUT}}&fg=000000$ that we have seen in the previous lecture, where one is looking for the cut of maximal size. Let $latex {A \in \{0,1\}^{n \times n}}&fg=000000$ be the adjacency matrix of the graph $latex {G = ([n],E)}&fg=000000$, or more generally let $latex {A \in {\mathbb R}_+^{n \times n}}&fg=000000$ be a symmetric matrix of non-negative weights. We encode a partition of $latex {[n]}&fg=000000$ into two sets as a vector $latex {x \in \{-1,1\}^n}&fg=000000$. Then $latex {(1-x_i x_j)}&fg=000000$ is equal to $latex {0}&fg=000000$ if both $latex {i}&fg=000000$ and $latex {j}&fg=000000$ are in the same element of the partition, and it is equal to $latex {2}&fg=000000$ if they are in different elements. In particular the value of the cut corresponding to $latex {x}&fg=000000$ is given by

$latex \displaystyle \frac1{4} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) .&fg=000000$

Thus finding the maximal cut is equivalent to the following optimization problem:

$latex \displaystyle \max_{x \in \{-1,1\}^n} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) \ \ \ \ \ (1)&fg=000000$

Since $latex {\mathrm{MAXCUT}}&fg=000000$ is $latex {\mathbf{NP}}&fg=000000$-complete (in the sense that the corresponding decision problem $latex {\mathrm{CUT}}&fg=000000$ is $latex {\mathbf{NP}}&fg=000000$-complete) we know that the above problem is ‘hard’, in the sense that a polynomial-time algorithm solving (1) would prove that $latex {\mathbf{P} = \mathbf{NP}}&fg=000000$. Note that naively one may overlook the difficulty of (1) since it is ‘simply’ a quadratic objective with quadratic equality constraints ($latex {x_i^2 = 1}&fg=000000$). Remark in particular that if one replaces in the constraint the hypercube $latex {\{-1,1\}^n}&fg=000000$ by the Euclidean sphere, then one obtains an efficiently solvable problem (it is the problem of computing the maximal eigenvalue of some symmetric matrix).

We will see now that while (1) is a difficult optimization problem, it is in fact possible to find relatively good approximate solutions! Let $latex {\zeta}&fg=000000$ be uniformly drawn on the hypercube $latex {\{-1,1\}^n}&fg=000000$, then clearly:

$latex \displaystyle \mathop{\mathbb E} \sum_{i,j} A_{i,j} (1-\zeta_i \zeta_j) = \sum_{i,j} A_{i,j} \geq \frac12 \max_{x \in \{-1,1\}^n} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) .&fg=000000$

This means that on average, the obtained cut is at least half as good (in terms of the value of the cut) than the optimal cut. In fact this implies that with probability at least $latex {\epsilon}&fg=000000$, the obtained cut is a $latex {(1/2-\epsilon)}&fg=000000$-approximation of the maximum. Thus by repeatedly sampling from the hypercube, one can get arbitrarily close (with probability approaching $latex {1}&fg=000000$) to a $latex {1/2}&fg=000000$-approximation of $latex {\mathrm{MAXCUT}}&fg=000000$!

Next we show that in fact one can get much better than a $latex {1/2}&fg=000000$-approximation with a more subtle sampling strategy. First note that:

$latex \displaystyle \max_{x \in \{-1,1\}^n} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) = \sum_{i,j=1}^n A_{i,j} – \min_{x \in \{-1,1\}^n} \langle A, x x^{\top} \rangle \leq \sum_{i,j=1}^n A_{i,j} – \min_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \langle A, X \rangle ,&fg=000000$

and the last optimization problem is an SDP (with linear equality constraints) which can thus be solved efficiently. We call the solution to the problem

$latex \displaystyle \min_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \langle A, X \rangle , \ \ \ \ \ (2)&fg=000000$

the SDP relaxation of $latex {\mathrm{MAXCUT}}&fg=000000$.

The next theorem is of tremendous importance. It gives a bound on the quality of the SDP relaxation, and the proof gives a randomized algorithm to compute an $latex {0.87}&fg=000000$-approximate solution to (1).

Theorem 1 (Goemans and Williamson 1995) The SDP relaxation for $latex {\mathrm{MAXCUT}}&fg=000000$ satisfies

$latex \displaystyle \begin{array}{rcl} \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \left( \sum_{i,j=1}^n A_{i,j} – \langle A, X \rangle \right) & \geq & \max_{x \in \{-1,1\}^n} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) \\ & \geq & 0.87 \ \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \left( \sum_{i,j=1}^n A_{i,j} – \langle A, X \rangle \right) . \end{array} &fg=000000$

The proof of this result is based on the following elementary geometric lemma.

Lemma 2 Let $latex {\xi \sim \mathcal{N}(0,\Sigma)}&fg=000000$ with $latex {\Sigma_{i,i}=1}&fg=000000$ for $latex {i=1, \hdots, n}&fg=000000$, and $latex {\zeta = \mathrm{sign}(\xi)}&fg=000000$. Then

$latex \displaystyle \mathop{\mathbb E} \ \zeta_i \zeta_j = \frac{2}{\pi} \mathrm{arcsin} \left(\Sigma_{i,j}\right) .&fg=000000$

Proof: Let $latex {V \in {\mathbb R}^{n \times n}}&fg=000000$ (with $latex {i^{th}}&fg=000000$ row $latex {V_i^{\top}}&fg=000000$) be such that $latex {\Sigma = V V^{\top}}&fg=000000$. Note that since $latex {\Sigma_{i,i}=1}&fg=000000$ one has $latex {\|V_i\| = 1}&fg=000000$ (remark also that necessarily $latex {|\Sigma_{i,j}| \leq 1}&fg=000000$, which will be important in the proof of the theorem). Let $latex {\epsilon \sim \mathcal{N}(0,I_n)}&fg=000000$ be such that $latex {\xi = V \epsilon}&fg=000000$. Then $latex {\zeta_i = \mathrm{sign}(V_i^{\top} \epsilon)}&fg=000000$, and in particular

$latex \displaystyle \begin{array}{rcl} \mathop{\mathbb E} \ \zeta_i \zeta_j & = & 2 \mathop{\mathbb P}(V_i^{\top} \epsilon \geq 0 \ \text{and} \ V_j^{\top} \epsilon \geq 0) – 2 \mathop{\mathbb P}(V_i^{\top} \epsilon \geq 0 \ \text{and} \ V_j^{\top} \epsilon < 0) \\ & = & 1 – 2 \mathop{\mathbb P}(V_j^{\top} \epsilon < 0 | V_i^{\top} \epsilon \geq 0) . \end{array} &fg=000000$

Now a quick picture shows that $latex {\mathop{\mathbb P}(V_j^{\top} \epsilon < 0 | V_i^{\top} \epsilon \geq 0) = \frac{1}{\pi} \mathrm{arccos}(V_i^{\top} V_j)}&fg=000000$. Using the fact that $latex {V_i^{\top} V_j = \Sigma_{i,j}}&fg=000000$ and $latex {\mathrm{arccos}(x) = \frac{\pi}{2} – \mathrm{arcsin}(x)}&fg=000000$ conclude the proof. $latex \Box&fg=000000$

We can now get to the proof of the Goemans and Williamson’s result.

Proof: Let $latex {X}&fg=000000$ be the solution to the SDP relaxation of $latex {\mathrm{MAXCUT}}&fg=000000$ (that is a solution of (2)), $latex {\xi \sim \mathcal{N}(0, X)}&fg=000000$, and $latex {\zeta = \mathrm{sign}(\xi) \in \{-1,1\}^n}&fg=000000$. We shall use the following inequality:

$latex \displaystyle 1 – \frac{2}{\pi} \mathrm{arcsin}(t) \geq 0.87 (1-t), \ \forall t \in [-1,1] .&fg=000000$

Now remark that, thanks to the previous lemma and the facts that $latex {A_{i,j} \geq 0}&fg=000000$ and $latex {|X_{i,j}| \leq 1}&fg=000000$, one has

$latex \displaystyle \begin{array}{rcl} \max_{x \in \{-1,1\}^n} \sum_{i,j=1}^n A_{i,j} (1-x_i x_j) & \geq & \mathop{\mathbb E}\sum_{i,j=1}^n A_{i,j} (1-\zeta_i \zeta_j) \\ & = & \sum_{i,j=1}^n A_{i,j} \left(1- \frac{2}{\pi} \mathrm{arcsin} \left(X_{i,j}\right)\right) \\ & \geq & 0.87 \sum_{i,j=1}^n A_{i,j} \left(1- X_{i,j}\right) \\ & = & 0.87 \ \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \left( \sum_{i,j=1}^n A_{i,j} – \langle A, X \rangle \right). \end{array} &fg=000000$

$latex \Box&fg=000000$

The previous result crucially used the form of the $latex {\mathrm{MAXCUT}}&fg=000000$ objective. We show next a result that applies more generally but with a worse constant of approximation. First note that, as we already pointed out, the $latex {\mathrm{MAXCUT}}&fg=000000$ objective is of the form:

$latex \displaystyle \max_{x \in \{-1,1\}^n} x^{\top} B x , \ \ \ \ \ (3)&fg=000000$

where $latex {B \in \mathbb{S}_+^n}&fg=000000$. Indeed in $latex {\mathrm{MAXCUT}}&fg=000000$ one has $latex {B = \mathrm{diag}(\sum_{j=1}^n A_{i,j}) – A}&fg=000000$ which is also called the graph Laplacian $latex {L}&fg=000000$ of $latex {G}&fg=000000$, and it is easy to verify that in this case $latex {x^{\top} L x = \frac12 \sum_{i,j} A_{i,j} (x_i – x_j)^2}&fg=000000$ which shows that $latex {L \in \mathbb{S}_+^n}&fg=000000$.

Theorem 3 (Nesterov 1997) Let $latex {B \in \mathbb{S}_+^n}&fg=000000$, then

$latex \displaystyle \frac{2}{\pi} \ \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \langle B, X \rangle \leq \max_{x \in \{-1,1\}^n} x^{\top} B x \leq \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \langle B, X \rangle .&fg=000000$

Proof: Let $latex {X}&fg=000000$ be the solution of

$latex \displaystyle \max_{X \in \mathbb{S}_+^n, X_{i,i}=1, i=1,\hdots, n} \langle B, X \rangle ,&fg=000000$

$latex {\xi \sim \mathcal{N}(0, X)}&fg=000000$, and $latex {\zeta = \mathrm{sign}(\xi) \in \{-1,1\}^n}&fg=000000$. Remark that thanks to the previous lemma one has

$latex \displaystyle \mathop{\mathbb E} \ \zeta^{\top} B \zeta = \sum_{i,j=1}^n B_{i,j} \frac{2}{\pi} \mathrm{arcsin} \left(X_{i,j}\right) = \frac{2}{\pi} \langle B, \mathrm{arcsin}(X) \rangle .&fg=000000$

Thus to prove the result it is enough to show that $latex {\langle B, \mathrm{arcsin}(X) \rangle \geq \langle B, X \rangle}&fg=000000$, which is itself implied by $latex {\mathrm{arcsin}(X) \succeq X}&fg=000000$ (since $latex {B}&fg=000000$ is positive semi-definite, just write the eigendecomposition). Now the last inequality is true thanks to a simple Taylor expansion. Indeed recall that $latex {|X_{i,j}| \leq 1}&fg=000000$ and thus denoting by $latex {A^{\circ \alpha}}&fg=000000$ the matrix where the entries are raised to the power $latex {\alpha}&fg=000000$ one has

$latex \displaystyle \mathrm{arcsin}(X) = \sum_{k=0}^{+\infty} \frac{{2k \choose k}}{4^k (2k +1)} X^{\circ (2k+1)} = X + \sum_{k=1}^{+\infty} \frac{{2k \choose k}}{4^k (2k +1)} X^{\circ (2k+1)}.&fg=000000$

Finally one can conclude using the fact if $latex {A,B \succeq 0}&fg=000000$ then $latex {A \circ B \succeq 0}&fg=000000$. (This can be seen by writing $latex {A= V V^{\top}}&fg=000000$, $latex {B=U U^{\top}}&fg=000000$, and thus $latex {(A \circ B)_{i,j} = V_i^{\top} V_j U_i^{\top} U_j = \langle V_i U_i^{\top}, V_j U_j^{\top} \rangle}&fg=000000$, which means that $latex {A \circ B}&fg=000000$ is a Gram-matrix and thus it is positive semi-definite.) $latex \Box&fg=000000$


Hardness of approximation

In this previous section we have seen how to improve a trivial $latex {1/2}&fg=000000$-approximation algorithm to a highly non-trivial $latex {0.87}&fg=000000$-approximation algorithm. Of course at this point one may wonder whether better approximation guarantees are possible for $latex {\mathrm{MAXCUT}}&fg=000000$. In the last two decades some technology have been developed to answer this question. In the early Nineties, Sanjeev Arora and his co-authors have discovered the so-called $latex {\mathbf{PCP}}&fg=000000$ Theorem (Probabilistically Checkable Proofs). This result gives a new randomized perspective on the class $latex {\mathbf{NP}}&fg=000000$, and it can be used to prove theorems such as the following one. We refer the interested reader to Chapter 11 in Arora and Barak for more details on this (including the proof).

Theorem 4 There is some $latex {\gamma <1}&fg=000000$ such that computing a $latex {\gamma}&fg=000000$-approximation to $latex {\mathrm{MIN-VERTEXCOVER}}&fg=000000$ is $latex {\mathbf{NP}}&fg=000000$-hard. For every $latex {\rho < 1}&fg=000000$, computing a $latex {\rho}&fg=000000$-approximation to $latex {\mathrm{MAX-INDSET}}&fg=000000$ is $latex {\mathbf{NP}}&fg=000000$-hard.

The above theorem is nice, but for example for $latex {\mathrm{MIN-VERTEXCOVER}}&fg=000000$ it might not give a sharp constant in terms of difficulty of approximation. The Unique Games Conjecture, a now decade-old conjecture made by Subhash Khot, implies sharper results for approximation. For example this conjecture (together with $latex {\mathbf{P} \neq \mathbf{NP}}&fg=000000$) implies that the constant derived by Goemans and Williamson for $latex {\mathrm{MAXCUT}}&fg=000000$ is unimprovable: there is no polynomial-time algorithm that achieve a better constant in terms of approximation.


Extended formulations

Remark that (3) can be written as

$latex \displaystyle \max_{x \in \{-1,1\}^n} \langle B, x x^{\top} \rangle = \max_{X \in \mathrm{conv}(x x^{\top}, \ x \in \{-1,1\}^n)} \langle B, X \rangle ,&fg=000000$

which is ‘just’ a linear optimization over the polytope $latex {\mathrm{conv}(x x^{\top}, \ x \in \{-1,1\}^n)}&fg=000000$ (which is called the correlation polytope). We have seen in previous lectures that linear optimization over a polytope can be solved in polynomial-time if the polytope can be described with a polynomial number of faces. Of course here we can immediately see that the correlation polytope has an exponential number of vertices. But this tells us nothing in terms of the faces, as one can see with the hypercube $latex {[-1,1]^n}&fg=000000$ for example ($latex {2^n}&fg=000000$ vertices but only $latex {2n}&fg=000000$ faces). Even worse, the number of faces in the ambient space tells us nothing about possible representations of the polytope in higher dimension (in the sense that the polytope would be a projection of this higher dimensional representation). Think for example of the $latex {\ell_1}&fg=000000$-ball which can represented as follows:

$latex \displaystyle \left\{x \in {\mathbb R}^n : \sum_{i=1}^n |x_i| \leq 1 \right\} = \left\{x \in {\mathbb R}^n : \exists y \in {\mathbb R}_+^{2 n} \ \text{s.t.} \ x_i = y_i – y_{n + i}, i=1\hdots,n, \ \text{and} \ \sum_{i=1}^{2 n} y_i \leq 1 \right\} .&fg=000000$

In other words while the $latex {\ell_1}&fg=000000$-ball has $latex {2^n}&fg=000000$ faces, it can be represented as the projection of a polytope in dimension $latex {3n}&fg=000000$ with only $latex {2n+1}&fg=000000$ faces. This type of representation is called an extended formulation. Let $latex {P \subset {\mathbb R}^n}&fg=000000$ be a polytope, then $latex {Q \subset {\mathbb R}^m, m \geq n}&fg=000000$ is an extension of $latex {P}&fg=000000$ if

$latex \displaystyle P = \{x \in {\mathbb R}^n : \exists y \ \text{s.t.} \ (x, y) \in Q \}.&fg=000000$

A quantity of great interest, called the extension complexity of $latex {P}&fg=000000$, is the minimal number of faces of an extension of $latex {P}&fg=000000$. The extension complexity characterizes in some sense the difficulty of linear optimization over $latex {P}&fg=000000$ when one restricts to Linear Programming techniques. While this quantity seems completely untractable, a famous result of Yannakakis shows that it can be described as a completely combinatorial quantity: it is equal to the non-negative rank of the slack matrix of $latex {P}&fg=000000$ (the matrix where each row corresponds to a vertex $latex {v}&fg=000000$ of $latex {P}&fg=000000$, and each column corresponds to a face $latex {a^{\top} x \leq b}&fg=000000$, and the corresponding entry if $latex {b – a^{\top} v}&fg=000000$). Controlling the non-negative rank is no easy task, but in some cases it can be done. For instance a very recent results of Fiorini et al. shows that the extension complexity of the correlation polytope is at least $latex {2^{c n}}&fg=000000$ for some constant $latex {c>0}&fg=000000$. This can be viewed as an unconditional lower bound on $latex {\mathrm{MAXCUT}}&fg=000000$ when one restricts to Linear Programming techniques.


Average-case complexity, smoothed analysis

So far we restricted ourselves to worst-case complexity: An algorithm is polynomial only if for every instance $latex {x \in \{0,1\}^n}&fg=000000$ the running time is polynomial in $latex {n}&fg=000000$. This may be considered too strict, as it might be that an algorithm run in polynomial time on any ‘real-life’ instance $latex {x}&fg=000000$, but it could have very bad running time on artificial instances. This is exactly what happens with the simplex method that you have studied in ORF522: there are instances of $latex {LP}&fg=000000$ where the simplex method takes exponential time (the Klee-Minty cube), yet in practice it is much more efficient than the ellipsoid method (and it is competitive with interior-point methods). A great result of Spielman and Teng from 2001 shows that indeed the examples that make the simplex method fail are artificial: if one adds a little bit of noise to the instance, then with high probability the simplex method will run in polynomial time. This is called the smoothed analysis of the simplex method, and it falls under the more general research agenda of understanding average-case complexity rather than worst-case complexity.

This entry was posted in Theoretical Computer Science. Bookmark the permalink.