Algorithm-SetCovering
view release on metacpan or search on metacpan
The underlying problem is called "set covering problem" and the
corresponding decision problem is NP-complete.
Methods
$alg = Algorithm::SetCovering->new(columns => $cols, [mode => $mode]);
Create a new Algorithm::SetCovering object. The mandatory parameter
"columns" needs to be set to the number of columns in the matrix
(the number of locks in the introductory example).
"mode" is optional and selects an algorithm for finding the
solution. The following values for "mode" are implemented:
"brute_force"
Will iterate over all permutations of keys. Only recommended for
very small numbers of keys.
"greedy"
Greedy algorithm. Scales O(mn^2). Can't do much better for a
NP-hard problem.
SetCovering.pm view on Meta::CPAN
=head2 Methods
=over 4
=item $alg = Algorithm::SetCovering->new(columns => $cols, [mode => $mode]);
Create a new Algorithm::SetCovering object. The mandatory parameter
C<columns> needs to be set to the number of columns in the matrix
(the number of locks in the introductory example).
C<mode> is optional and selects an algorithm for finding the solution.
The following values for C<mode> are implemented:
=over 4
=item "brute_force"
Will iterate over all permutations of keys. Only recommended for
very small numbers of keys.
=item "greedy"
( run in 0.549 second using v1.01-cache-2.11-cpan-49f99fa48dc )