Algorithm-QuineMcCluskey
view release on metacpan or search on metacpan
for every single term against every single element three
loops deep. Since maskedmatch() has a set-up cost, this
seems wasteful. Created a new function maskedmatchindexes(),
which sets up the masks before going through the list once.
- Which means we no longer are using the indexes() function
from List::MoreUtils, which is now removed.
2018-08-29
- We now use Logic::Minimizer as a base class.
- Consequently, removed attributes and methods that are
now in Logic::Minimizer, and are provided automatically.
- Use L::M's catch_errors() for attribute validation.
- Update Build.PL with Logic::Minimizer requirement.
- And updated the version number everywhere.
0.19
2019-07-31
- There was more processing than needed in least_covered() to do
what was basically a find-the-minimum loop, plus it was
throwing away information that had to be re-created by the
next line of code.
Consolidated all of that, resulting in fewer hash-of-array
0.11
2016-8-25
- Add method all_solutions(). Update the POD concerning using
get_covers() to refer to all_solutions().
0.10
2016-7-20
- Check to see if the terms (minterms, maxterms, or
dont-cares) are larger than 'width' in bit size.
It's possible I made that mistake myself recently.
- And although it's not an error, run the terms through
sort and uniq before converting to bitstrings. It
makes visual inspection of the debug output easier.
0.09
2016-6-27
- Found a case where don't-care terms with no covers
were nonetheless included with the prime implicants.
Fixed by changing a map{}-everything-will-work into
a loop with an if statement to check for that.
- New test file 25-solve.t (Rock Paper Scissors) that
covers the above problem.
with different parameters.
2015-3-27
- Changed row_dom() and col_dom() to return the rows/cols
to remove, instead of removing them inside.
- Changed row_dom() and col_dom() from methods to functions,
and moved the code to Util.pm
2015-3-6
- Method find_essentials() is essentially a single-term search
through the hash of arrays. Changed it from a method to a
function and moved it to Util.pm.
- Found an error in remels(), which was only removing one
matched array element instead of all matched elements.
2015-1-26
- Changed argument list to purge_essentials(). Had been
taking an esssentials hash, but since it was only using the
keys of the hash, we only need to pass those.
- In purge_essentials() change the order of deletion. The
primes hash "rows" (hash entries) are removed first,
*before* going through the hash to look for the "column"
in the array ref. Shortens the search for the "column".
- The argument list change lets me use purge_essentials()
Practices manual.
- Changed the all the "terms" attributes to 'ro'.
2014-09-19
- For internal clarity, renamed allterms() to all_bit_terms(),
and minmax_terms() to minmax_bit_terms().
- Methods maskmatch() and maskmatches() now combined into a single
method (one called the other, but there was no reason for the
separate internal function, and it saved re-creating
utility variables over and over).
- Check if there's an overlap between the don't-care list and
the min or max term list, and call it an error if there is.
- Attributes actually check their type now (thanks Moose) so
the qw operators around the term lists are now removed in
the documentation and in the test files.
2014-08-20
- No more default arguments (in the form of $self->get_primes())
for row_dom(), col_dom(), and purge_essentials()). Always
pass in the argument -- it's less confusing that way.
- Trim Util.pm of tobits() -- it's embedded in BUILD now.
2014-08-19
- More work in find_primes(). An array slice in a hash isn't
working as originally coded (I seem to recall the rules
changing some time ago). Changed it to two statements for
now.
2014-07-07
- After looking over the labeling in the run.t file, added
a new attribute, "title". We can now say what the A::QMcC
object actually represents.
- Broke up run.t into separate test files. The original
file was compact and in theory easy to add to, but I was
having trouble figuring out what was causing my Moose
errors. Plus, there were too many eval calls in the code.
- The original code changed the minterms, maxterms, and
dontcares attributes from the passed-in list of decimal
into bitstrings, and saved them back in the attributes.
We can't do that now, because Moose has set those fields
typed as 'ArrarRef[Int]'.
So, set up three new fields that represent the three fields
in their bitstring form: min_bits, max_bits, and dc_bits.
2014-04-30
- Moosified ("has" declarations) the attributes.
- Achieved a compile-error-free version using Moose instead
of Alias. Now to make it runtime-error-free.
- As part of the compilation process, moved from a Makefile.PL
base (which was creating errors of its own) to Build.PL,
which Just Works.
- Turned attributes boolean, imp, and bits into a local
variables as they were only used in single functions.
- Defined and made use of predicate functions for attributes
minterms, maxterms, and dontcares. Simplifies some sanity
checks.
- Added methods allterms() and minmax_terms() to simplify
coding.
- List::MoreUtils isn't actually being used in A::QMcC (it is
used in A::QMcC::Util though).
lib/Algorithm/QuineMcCluskey.pm view on Meta::CPAN
our $VERSION = 1.01;
sub BUILD
{
my $self = shift;
my $w = $self->width;
my $last_idx = (1 << $w) - 1;
my @terms;
#
# Catch errors involving minterms, maxterms, and don't-cares.
#
$self->catch_errors();
#
# We've gotten past the error-checking. Create the object.
#
if ($self->has_columnstring)
{
my($min_ref, $max_ref, $dc_ref) =
$self->list_to_terms(split(//, $self->columnstring));
### min_ref: $min_ref
### max_ref: $max_ref
### don't cares: $dc_ref
( run in 0.317 second using v1.01-cache-2.11-cpan-65fba6d93b7 )