← All problemsFree · Python · 50 min

Algorithm design / guarantees under an adversary

The Committee's Wishes

Meet as many weighted yes-or-no wishes as possible. Price fair coins, build the instance where the LP overpromises, then round any fractional solution so that it expects at least 3/4 of the LP, and prove why.

0 / 3 graded parts passSaved in this browser · loading saved work…
Jump to your work ↓

A committee must settle four yes-or-no decisions, x1 to x4. Its members have sent in wishes, each with a weight. A wish is met when at least one of its conditions holds, such as "x1 yes or x3 no". The committee wants to meet as much total weight as possible. That is weighted MAX-SAT, and it is NP-hard.

x1 x2 x3 x4 wish 1 weight 3 wish 2 weight 2 wish 3 weight 4 wish 4 weight 1 wish 5 weight 2 wish 6 weight 3 wants yes wants no

The figure's wishes, as conditions:

Wish Weight Met when
1 3 x1 yes, or x2 yes
2 2 x1 no, or x3 yes
3 4 x2 no, x3 no, or x4 yes
4 1 x4 yes
5 2 x4 no, x1 yes, or x3 yes
6 3 x2 no

The LP relaxation lets each decision be fractional: yi∈[0,1], where a condition "xi yes" counts yi and "xi no" counts 1−yi. A wish C is met to the extent zC=min(1,the sum of its conditions' values). The LP maximizes ∑CwCzC. Since every real choice of decisions is also a fractional one, the LP's optimum is at least the best real one.

Randomized rounding turns y back into decisions: say yes to xi with some probability pi, independently. The question is how to pick p so that the expected weight met is a large fraction of the LP's, on every input.

In code, a wish is (weight, literals) with literal i for "xi yes" and -i for "xi no".

Background: Approximation Algorithms.

easy · Part A

Fair coins

Ignore the LP and flip a fair coin for each decision. What is the expected total weight of the figure's wishes that are met?

Explore in the sandbox

Experiment here, then copy a rule into the editor and test its guarantees.