Exact Cover - Generalizations

Generalizations

In a standard exact cover problem, each constraint must be satisfied exactly once. It is a simple generalization to relax this requirement slightly and allow for the possibility that some "primary" constraints must be satisfied by exactly one selection but other "secondary" constraints can be satisfied by at most one selection.

As Knuth explains, a generalized exact cover problem can be converted to an equivalent exact cover problem by simply appending one row for each secondary column, containing a single 1 in that column. If in a particular candidate solution a particular secondary column is satisfied, then the added row isn't needed. But if the secondary column isn't satisfied, as is allowed in the generalized problem but not the standard problem, then the added row can be selected to ensure the column is satisfied.

But Knuth goes on to explain that it is better working with the generalized problem directly, because the generalized algorithm is simpler and faster: A simple change to his Algorithm X allows secondary columns to be handled directly.

The N queens problem is an example of a generalized exact cover problem, as the constraints corresponding to the diagonals of the chessboard need not be satisfied.

Read more about this topic:  Exact Cover