zhchoward / kmap Goto Github PK
View Code? Open in Web Editor NEWA simple function to simplify boolean algebra expressions, inspired by Karnaugh Map.
A simple function to simplify boolean algebra expressions, inspired by Karnaugh Map.
I checked your code it seems that the don't care function is developed but it is not called anywhere in the kmap.py the don't care is missed in the minterms:
minterms = Minterms(minterms = t_minterms, not_cares)
but if you do so, in the Minterms function it adds up the not_cares with minterms and simplify them! which is not correct!
for example: if we have:
str_terms = ["0000","0001","0100","1000","1010","1011","1111"]
terms_not_care = ["0110","0101"]
so the final result should be: ["0 * 0 *", "1 * 1 1", "1 0 * 0"]
but since it is adding up the minterms and the not cares, it is generating ["0 * 0 *", "1 * 1 1", "0 1 * 0", "1 0 * 0"]
which means that all not_cares are considered to be one!
I think that can be fixed by developing a code. That is adding every not_care and its combinations (for not_care in not_cares) to the minterms and simplify for each of them and at the end, the final result will be the simplified minterms with the shortest length. I am trying to solve the issue. I will let you know when I could debug it, or let me know if you can fix it.
Thank you and you did a good job!
Hi @zhcHoward ,
There seems to be a bug in the algorithm.
I was trying with input
str_terms= ["0001","0010","1001","1011","1100","1110","1111"]
terms_not_care = []
The answer outputed by the code is:
[11*0, 0010, *001]
But the right answer is:
[11*0, 0010, *001, 1*11]
I was trying to debug the code, the issue seems to be with remove_repeated_sources which makes source list empty for everything except [11*0, 0010, *001]
.
Before remove_repeated_sources, we have the term 1*11 but it source list is made empty and then its removed by remove_redundant sources.
I did try to find a solution, but couldn't come across any.
Glad to work it out together.
hello, i didn't see the algorithm in your README, i was wondering if you can tell me~~
thank you~~
Hello, very pleasure to ask you a question.
In the example, the output is ['10**', '10', '110']('' means the variable on that position has been simplified).
But the result can't be counted, I want numbers of "*", or "0", "1",
What can i do?
Thank you very much~
Oh I got it~~~
Hi @zhcHoward , great project.
I have just a small question, what does "source" mean? What is it's role?
What is the maximum supported size? I tried it and there are more than 100 minimum terms that cannot be simplified.
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.