Don't care
elmiramou opened this issue · 2 comments
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!
Sorry for the delay, I have been kind of busy this weekend.
For the bug of don't care, I didn't figure out why it happens. I guess it may have something to do with the PR that I merged for issue #5. However, I rewrite this project with 2 new algorithms called Quine–McCluskey algorithm and petrick's method.
I have tested the new implementation with your input, it works fine now. You can try the latest code with some more different inputs. Let me know if you encounter any bug.
Since there is no response for more than 1 month, I'm going to close this issue.