Hello all,
I'm trying to use sympy.logic.inference, specifically the satisfiable
function, to evaluate a large number of boolean expressions automatically.
My rules look something like (b2314 AND b0089) AND (NOT b0089)
I substituted AND, OR and NOT by standard python operators &, | and ~
I also mapped the names of the expression's variables into 'a', 'b', etc
for simplicity
a = Symbol('a')
b = Symbol('b')
c = sympy.Symbol('c')
d = sympy.Symbol('d')
e = sympy.Symbol('e')
f = sympy.Symbol('f')
g = sympy.Symbol('g')
h = sympy.Symbol('h')
i = sympy.Symbol('i')
j = sympy.Symbol('j')
k = sympy.Symbol('k')
myrules = []
m={0:'a',1:'b',2:'c',3:'d',4:'e',5:'f',6:'g',7:'h',8:'i',9:'j',10:'k'}
...
bnumber_pattern = re.compile(r"b\d{4}", re.IGNORECASE)
if bnumber_pattern.search(y):
bnumber_list=bnumber_pattern.findall(y)
i=0
for bnumber in bnumber_list:
print(bnumber)
rpl_str=m[i]
print(rpl_str)
y=y.replace(bnumber,rpl_str)
print(y)
i+=1
print(y)
print(satisfiable(y))
So the above rule looks like (a & b) & (~b)
But when running print(satisfiable(y))
I get an exception: AttributeError: 'str' object has no attribute 'atoms'
I don't know that much of sympy or python to understand what I am doing
wrong here.
Could someone help me with this please?
Regards,
AnĂ¡lia
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/yJydX9zSLOEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.