Quantcast
Channel: Counting number of assignments restricted by implications - Computer Science Stack Exchange
Viewing all articles
Browse latest Browse all 2

Counting number of assignments restricted by implications

$
0
0

Suppose we have $n$ boolean variables, $x_1, \dots, x_n$. Some boolean variables can have implication relationships, e.g. $x_2 \implies x_5$, which means that if $x_2$ is true $x_5$ must also be true. There are no negations.

How do we efficiently count the number of distinct solutions?


I do have some ideas on how we can simplify the problem:

  1. If the implication graph is not connected we can compute the number of valid assignments for all disconnected parts independently and multiply their counts for the final result as they are completely independent.

  2. If there is a cycle in the implication graph we can replace all occurrences of all variables that participate in the cycle with a new single variable, as they must all be equal.

  3. We can remove all implications of the form $x_i \implies x_i$ as they are useless.

Repeating the above operations until fixed point occurs we are left with a bunch of connected directed acyclic graphs. But solving the problem efficiently for the DAG case still eludes me.


Viewing all articles
Browse latest Browse all 2

Trending Articles