Algorithm-QuineMcCluskey
view release on metacpan or search on metacpan
lib/Algorithm/QuineMcCluskey.pm view on Meta::CPAN
#
# The raw ones, zeroes, and dont-care characters.
#
print "'", join("', '", @cvs), "' => ";
#
# And the resulting boolean equation.
#
print $q->to_boolean(\@cvs), "\n";
}
prints
'-010', '-10-', '00-0', '001-', '11--' => (B'CD') + (BC') + (A'B'D') + (A'B'C) + (AB)
'-10-', '00-0', '001-', '1-10', '11--' => (BC') + (A'B'D') + (A'B'C) + (ACD') + (AB)
'-010', '-10-', '0-00', '001-', '11--' => (B'CD') + (BC') + (A'C'D') + (A'B'C) + (AB)
'-10-', '0-00', '001-', '1-10', '11--' => (BC') + (A'C'D') + (A'B'C) + (ACD') + (AB)
Note the use of the method to_boolean() in the loop. This is the method
solve() uses to create its equation, by passing it the first of the list
of covers.
=head3 to_columnstring()
Return a string made up of the function's column's values. Position 0 in
the string is the 0th row of the column, and so on. The string will consist
of zeros, ones, and the don't-care character (which by default is '-').
my $column = $self->to_columnstring();
=head1 AUTHOR
Darren M. Kulp B<darren@kulp.ch>
John M. Gamble B<jgamble@cpan.org> (current maintainer)
=cut
=head1 SEE ALSO
=over 3
=item
Introduction To Logic Design, by Sajjan G. Shiva, 1998.
=item
Discrete Mathematics and its Applications, by Kenneth H. Rosen, 1995
=back
=head1 LICENSE AND COPYRIGHT
Copyright (c) 2006 Darren Kulp. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
See L<http://dev.perl.org/licenses/> for more information.
=cut
1;
( run in 1.503 second using v1.01-cache-2.11-cpan-df04353d9ac )