The QuineMcCluskey Python class minimises boolean functions to a sum of products. This implementation of the Quine McCluskey algorithm has no inherent limits (other than the calculation time) on the size of the inputs.
Also, in the limited tests of the author of this module, this implementation is considerably faster than other public Python implementations for non-trivial inputs.
Another unique feature of this implementation is the possibility to use the XOR and XNOR operators, in addition to the normal AND operator, to minimise the terms. This slows down the algorithm, but in some cases the result can be much more compact than a sum of product.
Use the QuineMcCluskey class like this:
from qm import QuineMcCluskey qm = QuineMcCluskey() ones = [0, 2, 3] dontcares = [4, 5, 6, 7] print(qm.simplify(ones, dontcares))
This will return the following set:
set(['1--', '-1-', '--0'])
Please note that the least significant bit in the output is in the leftmost position (a position 0 for the string). If the bits are called ABC then the result should be interpreted as:
C or B or (not A)
The latest released version is:
Fork QuineMcCluskey on GitHub.
Older news can be read in the QuineMcCluskey news archive.
No known bugs or issues.