simsso / quine-mccluskey-algorithm Goto Github PK
View Code? Open in Web Editor NEWC# implementation of the Quine-McCluskey algorithm and Petrick's method
C# implementation of the Quine-McCluskey algorithm and Petrick's method
For the appended input the output is correct, but not fully minified. Right now it seems like the bug is within the Quine-McCluskey implementation, more specifically in the way it deals with don't-care fields (X
) and the number of different columns between two rows that of which at least one contains a don't-care field.
E.g. the two rows
I7 I6 I5 I4 I3 I2 I1 I0 O1
0 1 X X X X X X 1
1 X X X X X X X 1
should result in I7 + I6
not in !I7 * I6 + I7
.
I7 I6 I5 I4 I3 I2 I1 I0 O1
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 1 X 0
0 0 0 0 0 1 X X 1
0 0 0 0 1 X X X 1
0 0 0 1 X X X X 0
0 0 1 X X X X X 0
0 1 X X X X X X 1
1 X X X X X X X 1
O1 = !I7 * !I6 * !I5 * !I4 * !I3 * I2 + !I7 * !I6 * !I5 * !I4 * I3 + !I7 * I6 + I7
Table format
I7 I6 I5 I4 I3 I2 I1 I0 O1
0 0 0 0 0 1 X X 1
0 0 0 0 1 X X X 1
0 1 X X X X X X 1
1 X X X X X X X 1
O1 = I7 + I6 + !I5 * !I4 * I3 + !I5 * !I4 * I2
The current implementation does not remove non-essential prime implicants. A final processing of the output table with the Petrick's method (https://en.wikipedia.org/wiki/Petrick%27s_method) would minify all remaining prime implicants properly.
Example input resulting in an output that is not entirely minified.
D C B A X
0 0 0 0 0
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 0
1 1 1 1 0
Original output | After implementing Petrick's method |
---|---|
D C B A X |
D C B A X |
0 0 X 1 1 |
0 0 X 1 1 |
0 X 0 1 1 |
not necessary |
X 0 1 X 1 |
X 0 1 X 1 |
X 1 0 1 1 |
X 1 0 1 1 |
Second example (from Wikipedia)
C B A X
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.