Algorithm-X-DLX
view release on metacpan or search on metacpan
lib/Algorithm/X/DLX.pm view on Meta::CPAN
=head1 SYNOPSIS
use Algorithm::X::DLX;
my $problem = Algorithm::X::ExactCoverProblem->new($width, \@input_rows, $secondary_column_count);
my $dlx = Algorithm::X::DLX->new($problem);
my $result = $dlx->search();
foreach my $row_indices (@{$result->{solutions}}) {
...
Or better, especially with searches taking a very long time
my $iterator = $dlx->get_solver();
while (my $row_indices = &$iterator()) {
...
=head1 The Example applications provided under examples/...
There are scripts and modules for various exact cover problems:
N-queens, Langford, Sudoku, N-pieces and Pentominoes
See L<Algorithm::X::Examples>.
=head2 L<examplesE<sol>dlx.pl|https://metacpan.org/dist/Algorithm-X-DLX/source/examples/dlx.pl>
And a more generic script that makes use of this lib.
examples$ ./dlx.pl -pv < data/knuth_example.txt
1 0 0 1 0 0 0
0 0 1 0 1 1 0
0 1 0 0 0 0 1
solutions: 1
=head1 DEPENDENCIES
=over 5
=item * L<Carp>
=back
=head1 COPYRIGHT AND LICENSE
The following copyright notice applies to all the files provided in
this distribution, unless explicitly noted otherwise.
This software is copyright (c) 2025 by Steffen Heinrich
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
=head1 SEE ALSO
Donald E. Knuth, Stanford University 2000 L<Dancing Links|http://arxiv.org/pdf/cs/0011047v1>
L<Introduction to Exact Cover Problem and Algorithm X|https://www.geeksforgeeks.org/introduction-to-exact-cover-problem-and-algorithm-x/>
Peter Pfeiffer BSc, Linz 2023 L<Uncovering Exact Cover Encodings|https://epub.jku.at/obvulihs/download/pdf/9260418>
=cut
( run in 0.537 second using v1.01-cache-2.11-cpan-df04353d9ac )