GithubHelp home page GithubHelp logo

dantemazza / boolean-solver Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 3.0 109 KB

Flask app that uses Quine-McCluskey/Petrick's algorithms to find least-cost boolean expressions

Python 82.85% HTML 17.15%
tabulation quine-mccluskey-algorithm python petrick-method boolean-algebra quine-mccluskey flask

boolean-solver's Introduction

www.booleansolver.com

BooleanSolver

A python implementation of the Quine-McCluskey algorithm and Petrick's method, inspired by the content of ECE124 and my own independent research.

Project Setup

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

Running

Here is a sample test case expressed as a minterm expansion:

8
m(0,1,2,5,6,13,14,15,137,124,198,199)
d(3,11)

Here is a maxterm expansion:

6
M(0,1,2,5,6,35,36,39,41,45,49,62,63)
d(3,11,50,51,54,55,56,57)

The case should be formatted as such:

  • The first line is the amount of boolean inputs. Rather than writing, for example, f(a,b,c,d), we would put a 4.
  • The second line is the max/min expansion. It is important that you include brackets, no spaces, and seperate each value with a comma
  • The third line is dontcares, formatted in the same way as the second line. This is optional.

To run a test case, use the invoke task

inv solve <test_case_path>

or use the flask app!

python3 boolean_solver/__init__.py

and connect to http://localhost:5000

About

The program uses a prime implicant chart (as specified in the tabulation method) to locate all essential prime implicants. The remaining ones are covered using a Petrick's method expansion. Algebraic expressions are stored in list data structures as follows:

<class 'list'>: [[[0], [2]], [1, 3], [2, 5], [3, 6], [5, 6, 7]]

Inner-most lists are products. Lists of the innermost lists are sums. Lists of these lists are products and so on. The program represents our variables as numbers here; assuming we map each number to its alphabetical letter (i.e 0->a, 1->b, etc.), the equivalent boolean expression would be: (a + c)(bd + cf + dg + fgh)

boolean-solver's People

Contributors

dantemazza avatar

Stargazers

 avatar

Watchers

 avatar  avatar

boolean-solver's Issues

Add documentation

you need to add a README.md file so that viewers of this repository know what they're looking at! Additionally, you should include details on how to set up your repo, testing, etc.

need to improve runtime

test_case2 cannot finish, presumably because the Petrick's implementation is quite brute force and slow. Need to look into this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.