A logic calculator capable of solving complex boolean expression
This model can be used like this:
model = Resolver.logicConn()
model.add_conn(And('name1', Or('name2', 'name3', exc=True), 'name2')
for result in model.calc_poss():
print(result)
{'name1' : True,
'name2' : True,
'name3' : False}
This model can be used like this:
known_parameters = {'animal': And(Or('fly', 'swim', exc=False), Or('carnivorous', 'omnivorous', 'erbivorous', exc=True)),
'plant': And(Or('green', 'brown', exc=False), Or('tall', 'small', exc=True), Or('fruit', 'flower', exc=False))}
model = Resolver.dictConn()
model.load_dict(known_parameters)
predictions = model.calc_poss_dict(And('brown', 'tall'))
for prediction in predictions:
print(predictions)
{'animal' : False,
'plant' : True}