Cobweb

slama.dev

Cobweb

YouTube Icon Best-SAT

This post is an expanded translation of my lecture notes from a Randomized and Approximation Algorithms course that I took, and a more detailed explanation of the topics covered in my video about BEST-SAT.

Basic definitions

An example problem could be minimum spanning trees:

  • input instances: set of all weighted graphs
  • permissible inputs: spanning trees for the given weighted graph
  • utility function: the spanning tree weight (sum of its edges)
  • we’re minimizing

Definition (Optimalization problem) is a tuple I,F,f,g\mathcal{I}, \mathcal{F}, f, g

Definition (NP-Optimalization problem) is an optimalization problem I,F,f,g\mathcal{I}, \mathcal{F}, f, g, for which we additionally require that:

For minimalization problem, we ensure that the solution is always small enough.

For maximalization problem, we ensure that the solution is always large enough.

Definition: algorithm AA is RR-approximation, if:

MAX-SAT

We also assume that:

RAND-SAT

Algorithm (RAND-SAT):

  1. choose all literals randomly (independently, for p=1/2p = 1/2)
  2. profit?

Theorem: RAND-SAT is a 22-approximation algorithm.

Proof: we’ll create an indicator variable YjY_j for each clause

Since the size of the clause kβ‰₯1k \ge 1, we get E[Yj]=Pr[CjΒ isΒ satistied]=1βˆ’12kβ‰₯12\mathbb{E}\left[Y_j\right] = \mathrm{Pr}\left[C_j\ \text{is satistied}\right] = 1 - \frac{1}{2^k} \ge \frac{1}{2} , thus E[βˆ‘j=1nYj]=linearityofΒ expectationβˆ‘j=1nE[Yj]β‰₯βˆ‘j=1n12β‰₯12OPT\mathbb{E}\left[\sum_{j = 1}^{n} Y_j\right] \overset{\text{linearity} \atop \text{of expectation}}{=} \sum_{j = 1}^{n} \mathbb{E}\left[Y_j\right] \ge \sum_{j = 1}^{n}\frac{1}{2} \ge \frac{1}{2}\mathrm{OPT}

LP-SAT

We’re using the optimal solution to the linear program (and generally the formula, if we allow real vlaues for literals) as a guide for our randomized algorithm.

Algorithm (LP-SAT):

  1. build an integer linear program:
    • variables will be:
      • yiy_i for each literal
      • zjz_j for each clause
    • inequalitites will be one for each clause, in the form zjβ‰€βˆ‘positiveyi+βˆ‘negative(1βˆ’yi)z_j \le \sum_{\text{positive}} y_i + \sum_{\text{negative}} (1 - y_i)
    • we’ll maximize the number of satisfied clauses βˆ‘zj\sum z_j
  2. relax the program (allow real variables instead of integers) and calculate the optimum yβˆ—,zβˆ—y^*, z^*
  3. set literals xix_i to 11 with probability yiβˆ—y_i^*

Theorem: LP-SAT is a (1βˆ’1e)\left(1 - \frac{1}{e}\right)-approximation algorithm.

To prove this, we’ll use a few lemmas/theorems that aren’t difficult to prove, but aren’t really interesting. I left links to (Wikipedia and I don’t feel bad about it) articles with proofs for each, if you’re interested.


Fact (A - A/G mean inequality): ∏i=1nai1n≀1nβˆ‘i=1nai\prod_{i = 1}^{n} a_i^{\frac{1}{n}} \le \frac{1}{n} \sum_{i = 1}^{n} a_i

Proof: https://en.wikipedia.org/wiki/Inequality_of_arithmetic_and_geometric_means

Fact (B - Jensen’s inequality): if a function is concave on the interval [0,1]\left[0, 1\right] and f(0)=a,f(1)=a+bf(0) = a, f(1) = a + b, then βˆ€x∈[0,1]:f(x)β‰₯a+bx\forall x \in \left[0, 1\right]: f(x) \ge a + bx

Proof: https://en.wikipedia.org/wiki/Jensen%27s_inequality

Fact (C - 1/e inequality): (1βˆ’1n)n≀1e\left(1 - \frac{1}{n}\right)^n \le \frac{1}{e}

Proof: https://en.wikipedia.org/wiki/E_(mathematical_constant)#Inequalities


Proof (of the main theorem): consider yβˆ—,zβˆ—y^*, z^* and CjC_j with kjk_j literals; then

Pr[CjΒ isΒ notΒ satisfied]=∏i:Β xi∈Cj(1βˆ’yiβˆ—)⏞positive∏i:Β xβ€Ύi∈Cjyiβˆ—βžnegative≀A[1kj(βˆ‘i:Β xi∈Cj(1βˆ’yiβˆ—)+βˆ‘i:Β xβ€Ύi∈Cjyiβˆ—)]kj=[1βˆ’1kj(βˆ‘i:Β xi∈Cjyiβˆ—+βˆ‘i:Β xβ€Ύi∈Cj(1βˆ’yiβˆ—))]kj≀(1βˆ’zjβˆ—kj)kj \begin{aligned} \mathrm{Pr}\left[C_j\ \text{is not satisfied}\right] &= \overbrace{\prod_{i:\ x_i \in C_j} (1 - y^*_i)}^{\text{positive}} \overbrace{\prod_{i:\ \overline{x}_i \in C_j} y^*_i}^{\text{negative}} & \\ &\overset{A}{\le} \left[\frac{1}{k_j} \left(\sum_{i:\ x_i \in C_j} (1 - y^*_i) + \sum_{i:\ \overline{x}_i \in C_j} y^*_i\right)\right]^{k_j} & \\ &= \left[1 - \frac{1}{k_j} \left(\sum_{i:\ x_i \in C_j} y^*_i + \sum_{i:\ \overline{x}_i \in C_j} (1 - y^*_i)\right)\right]^{k_j} & \\ &\le \left(1 - \frac{z_j^*}{k_j}\right)^{k_j} \end{aligned}

We’re interested in the satisfied ones, so Pr[CjΒ isΒ satisfied]β‰₯1βˆ’(1βˆ’zjβˆ—kj)kj⏞ourΒ functionΒ f(zjβˆ—)β‰₯B[1βˆ’(1βˆ’1kj)kj]zjβˆ—β‰₯C(1βˆ’1e)zjβˆ— \begin{aligned} \mathrm{Pr}\left[C_j\ \text{is satisfied}\right] &\ge \overbrace{1 - \left(1 - \frac{z_j^*}{k_j}\right)^{k_j}}^{\text{our function}\ f(z_j^*)} \\ & \overset{B}{\ge} \left[1 - \left(1 - \frac{1}{k_j}\right)^{k_j}\right] z_j^* & \overset{C}{\ge} \left(1 - \frac{1}{e}\right) z_j^* \end{aligned}

To use fact BB, we observed that a=f(0)=0a = f(0) = 0 and that the second derivation is non-positive (so the function is concave). Now to formally count how many our program satisfies: E[βˆ‘j=1mYj]=βˆ‘j=1mE[Yj]β‰₯βˆ‘j∈UPr[CjΒ isΒ satisfied]β‰₯βˆ‘j∈U(1βˆ’1e)zjβˆ—=(1βˆ’1e)OPT \begin{aligned} \mathbb{E}\left[\sum_{j = 1}^{m} Y_j\right] &= \sum_{j = 1}^{m} \mathbb{E}\left[Y_j\right] \\ &\ge \sum_{j \in U} \mathrm{Pr}\left[C_j\ \text{is satisfied}\right] \\ &\ge \sum_{j \in U} \left(1 - \frac{1}{e}\right) z_j^* \\ &= \left(1 - \frac{1}{e}\right) \mathrm{OPT}\\ \end{aligned}

BEST-SAT

Algorithm (BEST-SAT):

  1. assign a value of a literal using RAND-SAT with probability 1/21/2, else use BEST-SAT
  2. have an existential crisis about the fact that this works and is asymptotically optimal

Theorem: BEST-SAT is 34\frac{3}{4}-approximation.

Proof: we want to prove that Pr[CjΒ isΒ satisfied]β‰₯34zjβˆ— \mathrm{Pr}\left[C_j\ \text{is satisfied}\right] \ge \frac{3}{4} z^*_j .

Let’s look at the probability that each algorithm satisfies a clause of kk variables:

Now the proof boils down to the following table:

kjk_j RAND-SAT LP-SAT BEST-SAT
11 12β‰₯12zjβˆ—\frac{1}{2} \ge \frac{1}{2} z_j^* 1β‹…zjβˆ—1 \cdot z_j^* 1212+12zjβˆ—β‰₯34zjβˆ—\frac{1}{2} \frac{1}{2} + \frac{1}{2} z_j^* \ge \frac{3}{4} z_j^*
22 β‰₯34zjβˆ—\ge \frac{3}{4} z_j^* 34β‹…zjβˆ—\frac{3}{4} \cdot z_j^* β‰₯34zjβˆ—\ge \frac{3}{4} z_j^*
β‰₯3\ge3 β‰₯78zjβˆ—\ge \frac{7}{8} z_j^* β‰₯(1βˆ’1e)β‹…zjβˆ—\ge\left(1 - \frac{1}{e}\right) \cdot z_j^* >34zjβˆ—> \frac{3}{4} z_j^*