Exact cover problem¶
Suppose we have a set $S$ and are given subsets $T_0, T_1, \ldots, T_{N-1}$ of $S$.
The problem of choosing some of $T_0, T_1, \dots, T_{N-1}$ and determining whether the chosen
multiple
subsets can be partitions of $S$ is called the exact covering problem. That is,
determine
whether any element of $S$ can be contained in exactly one of the chosen subsets.
For example, if $S = \{1, 2, 3, 4, 5, 6, 7, 8, 9\}$, as shown in the figure below, then $T_0 = \{1,
2, 3,
6, 9\}$, $T_1 = \{1, 2, 5, 8\}$, $T_2 = \{4, 7\}$, $T_3 = \{4, 5\}$, $T_4 = \{6, 9\}$, $T _5 = \{3\}$.
If
we choose $T_1$, $T_2$, $T_4$, and $T_5$, these are the partitions of $S$.
This example program uses Fixstars Amplify to solve the exact cover problem. The formulation follows
that
of Sec. 4.1 of A. Lucas,
Front. Phys. (2014).