Assume you have $n$ independent binary variables $\{x_1,\dots,x_n\}$ and for each variable $x_i$ you know that its value is equal to $1$ with a probability $p_i$. I would like to enumerate the joint assignments of these variables in such a way that in $k$ steps I capture as much volume of the joint probability mass function as possible. Does there exist some approximation algorithm which runs faster than the algorithm which enumerates the assignments according to their joint probability $\Pi p_i$. Or something related?
-
1$\begingroup$ Do you know anything about the joint PMF a priori? Also, consider even the simplest case $k=1$. How do you measure how much a single assignment "captures" the distribution? $\endgroup$– RobPrattCommented Sep 16, 2022 at 20:40
-
$\begingroup$ I assume that the joint PMF is a product of the marginals $\Pi p_i(x_i)$. I do not assume anything about the marginals but we could assume some restrictions if it would help. If $k = 1$, then the best choice is to choose the assignment with the highest joint probability. Which assigns the most probable value to each variable (according to $p_i$). $\endgroup$– JanHulaCommented Sep 17, 2022 at 6:14
-
$\begingroup$ Another way to imagine this problem is to imagine an $n$-dimensional unit cube which is cut to pieces by doing a cut along each of the $n$ sides of the cube according to the proportion $p_i$. Then our task would be to choose $k$ different pieces to maximize the volume of the chosen pieces. $\endgroup$– JanHulaCommented Sep 17, 2022 at 6:15
2 Answers
You want to find a $k$-subset $S\subseteq\{0,1\}^n$ to maximize $$\sum_{(y_1,\dots,y_n)\in S} \prod_{i=1}^n \left(p_{i}y_i+(1-p_i)(1-y_i)\right).$$
Equivalently, find the $k$ largest (with multiplicity) $$\prod_{i=1}^n \left(p_{i}y_i+(1-p_i)(1-y_i)\right).$$
Equivalently, find the $k$ largest (with multiplicity) $$\sum_{i=1}^n \left((\log p_{i})y_i+(\log(1-p_i))(1-y_i)\right).$$
Some integer linear programming (ILP) solvers have an option to find the $k$ best solutions. An alternative approach to get the $k$ best solutions is to call an ILP solver $k$ times. After each solve, yielding optimal solution $\hat{y}\in\{0,1\}^n$, impose an additional no-good cut $$\sum_{i:\hat{y}_i = 0} y_i + \sum_{i:\hat{y}_i = 1} (1 - y_i) \ge 1$$ that excludes only that solution.
-
$\begingroup$ Thank you. I hoped there would be some way to enumerate the assignments faster if we accept to obtain a suboptimal solution with some approximation guarantee. Maybe I should test the ILP solver to see how fast it is. $\endgroup$– JanHulaCommented Sep 18, 2022 at 9:49
-
$\begingroup$ Glad to help. Please mark my answer as accepted. Also, ILP solvers have options to stop early based on optimality gap, but I suspect that will not be necessary here. $\endgroup$– RobPrattCommented Sep 18, 2022 at 13:58
There are no general shortcuts as far as I can see.
To simplify things, complement some variables $x_i$ and renumber so that you have $$ p_1\geq p_2 \geq p_3 \geq \cdots \geq p_n \geq \frac{1}{2},\qquad p_i=\mathbb{P}[x_i=1], \forall i. $$ The $k=1$ case will use the assignment $(x_1,\ldots,x_n)=(1,\ldots,1).$ If some $p_i=\frac{1}{2},$ whenever $i\in J \subset \{1,\ldots,n\},$ those variables $x_i$ can be chosen either as $x_i=1$ or as $x_i=0,$ and achieve the same maximum probability value of the $(1,\ldots,1)$ assignment, which gives you a total of $2^{\#J}$ such assignments. Thus if $k\leq 2^{\#J}$ you can choose these assignments and add terms of maximal probability.
So let's ignore this case which simply restates the problem on $n-\#J$ coordinates, and assume $p_n>1/2,$ which is the minimal probability after reassignment. We can also assume $p_1<1,$ to rule out another pathological case since complementing that will yield zero probability, with no further consideration needed.
You could start flipping $x_i$ in singletons from 1 to 0 and first flip $p_n,$ then $p_{n-1}$ etc (since $p_i\geq p_{i+1}$ in a greedy manner to obtain new probabilities that are the largest possible due to the renumbering. This will give you assignments $$ (1,\ldots,1,1,0),(1,\ldots,1,0,1),(1,\ldots,0,1,1),\ldots $$ in order. However, beyond the first two assignments in the list here one cannot give general guarantees of monotonicity of the newly added probabilities, since one might have $$ (1-p_i)(1-p_j) > (1-p_k) $$ for example and this requires checking assignments with two zeroes before exhausting those with one zeroes, hence the simple monotonicity of the problem is lost.
-
1$\begingroup$ Thank you. I understand that I can not simply enumerate the assignments according to the joint probability in some easy way. I hoped that there would be an approximation algorithm that would give me a suboptimal solution with some guarantee. And which may possibly assume some restrictions for the marginals $p_i$ . Because it seems to me that such enumeration may be desirable in many applications. $\endgroup$– JanHulaCommented Sep 17, 2022 at 20:34