Skip to main content

An implementation of the Quine-McCluskey algorithm

Project description

qm.py

build

A Python implementation of the Quine McCluskey algorithm.

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.

Installation

The recommanded way of installing this package is by using pip

python3 -m pip install quine-mccluskey-tomas789

Note that on Windows you might need to use the py command instead.

py -m pip install quine-mccluskey-tomas789

There are some othere means of installing the package which are recommanded only in specific cases.

Development build

python3 -m pip install -e .

Build wheel files locally

Make sure you have the latest version of PyPA's build installed:

python3 -m pip install --upgrade build

Now run this command from the same directory where pyproject.toml is located:

python3 -m build

This command should output a lot of text and once completed should generate two files in the dist directory:

dist/
├── quine_mccluskey_tomas789-1.0-py2.py3-none-any.whl
└── quine_mccluskey_tomas789-1.0.tar.gz

Wheel file can then be distributed via your own means and installed using pip

python3 -m pip install dist/quine_mccluskey_tomas789-1.0-py2.py3-none-any.whl

Running tests

Unit tests

The library comes with a basic set of unit tests. They can be executed using pytest

pytest

Fuzz testing

We also have a fuzz testing. It generates random formulas, simplifies them and checks that the result is correct.

  quine-mccluskey-tomas789 git:(main) python fuzz.py   
Checked 24300 formulas and found 0 errors.
Checked 48400 formulas and found 0 errors.
Checked 72300 formulas and found 0 errors.
Checked 96300 formulas and found 0 errors.
Testing formulas ...  0:00:44

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quine_mccluskey_tomas789-0.2.5.tar.gz (21.9 kB view hashes)

Uploaded Source

Built Distributions

quine_mccluskey_tomas789-0.2.5-cp311-cp311-win_amd64.whl (290.4 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

quine_mccluskey_tomas789-0.2.5-cp311-cp311-win32.whl (242.2 kB view hashes)

Uploaded CPython 3.11 Windows x86

quine_mccluskey_tomas789-0.2.5-cp311-cp311-musllinux_1_1_x86_64.whl (650.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

quine_mccluskey_tomas789-0.2.5-cp311-cp311-musllinux_1_1_i686.whl (710.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

quine_mccluskey_tomas789-0.2.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

quine_mccluskey_tomas789-0.2.5-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (145.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

quine_mccluskey_tomas789-0.2.5-cp311-cp311-macosx_10_9_universal2.whl (174.6 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

quine_mccluskey_tomas789-0.2.5-cp310-cp310-win_amd64.whl (290.6 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

quine_mccluskey_tomas789-0.2.5-cp310-cp310-win32.whl (242.3 kB view hashes)

Uploaded CPython 3.10 Windows x86

quine_mccluskey_tomas789-0.2.5-cp310-cp310-musllinux_1_1_x86_64.whl (650.5 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

quine_mccluskey_tomas789-0.2.5-cp310-cp310-musllinux_1_1_i686.whl (711.2 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

quine_mccluskey_tomas789-0.2.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

quine_mccluskey_tomas789-0.2.5-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (145.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

quine_mccluskey_tomas789-0.2.5-cp310-cp310-macosx_10_9_universal2.whl (174.6 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

quine_mccluskey_tomas789-0.2.5-cp39-cp39-win_amd64.whl (290.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

quine_mccluskey_tomas789-0.2.5-cp39-cp39-win32.whl (243.3 kB view hashes)

Uploaded CPython 3.9 Windows x86

quine_mccluskey_tomas789-0.2.5-cp39-cp39-musllinux_1_1_x86_64.whl (650.7 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

quine_mccluskey_tomas789-0.2.5-cp39-cp39-musllinux_1_1_i686.whl (711.5 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

quine_mccluskey_tomas789-0.2.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

quine_mccluskey_tomas789-0.2.5-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (146.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

quine_mccluskey_tomas789-0.2.5-cp39-cp39-macosx_10_9_universal2.whl (175.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

quine_mccluskey_tomas789-0.2.5-cp38-cp38-win_amd64.whl (312.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

quine_mccluskey_tomas789-0.2.5-cp38-cp38-win32.whl (243.1 kB view hashes)

Uploaded CPython 3.8 Windows x86

quine_mccluskey_tomas789-0.2.5-cp38-cp38-musllinux_1_1_x86_64.whl (650.5 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

quine_mccluskey_tomas789-0.2.5-cp38-cp38-musllinux_1_1_i686.whl (711.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

quine_mccluskey_tomas789-0.2.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (136.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

quine_mccluskey_tomas789-0.2.5-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (145.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

quine_mccluskey_tomas789-0.2.5-cp38-cp38-macosx_10_9_universal2.whl (174.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64)

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-win_amd64.whl (312.7 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-win32.whl (243.6 kB view hashes)

Uploaded CPython 3.7m Windows x86

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-musllinux_1_1_x86_64.whl (654.3 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-musllinux_1_1_i686.whl (716.0 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138.0 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

quine_mccluskey_tomas789-0.2.5-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (148.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page