module Dlx:Knuth's dancing links (aka DLX) see http://en.wikipedia.org/wiki/Dancing_Linkssig
..end
type
t
val create : ?primary:int -> bool array array -> t
true
for primary
columns and at most one true
value for secondary columns.
If primary
is given, it means that the first primary
columns are
primary; otherwise, all columns are primary columns.
val create_sparse : ?primary:int -> columns:int -> int list array -> t
columns
is the total number of columns.
The array contains the rows, each row being the list of the columns
containing the value true
.type
solution
val list_of_solution : solution -> int list
val get_first_solution : t -> solution
Not_found
if the problem has no solution.val count_solutions : t -> int
val iter_solution : (solution -> unit) -> t -> unit
iter_solution f p
applies f
on each solution of the problem p
,
one at a time.
CAVEAT: a solution is no longer valid as soon as iteration restarts.
Therefore solutions must not be stored as they are discovered.
If this is necessary, they must be first decoded using
list_of_solution
.val print_solution : Format.formatter -> solution -> unit