def testApply(self): v1 = bdd.variable('v1') v2 = bdd.variable('v2') v1dv2 = bdd.disjunction(['v1', 'v2']) v1av2 = bdd.simplify( bdd.apply(v1, v2, bdd.orOperation, bdd.enumeratedVariablesOrdering(['v1', 'v2']))) self.assertEqual(v1dv2, v1av2)
def testOrderings(self): self.__allOrderings(bdd.leftistOrdering) self.assertTrue(bdd.leftistOrdering(None,None)) self.__allOrderings(bdd.rightistOrdering) self.assertFalse(bdd.rightistOrdering(None,None)) v1=bdd.enumeratedVariablesOrdering(['x1','x2','x3','x4']) self.__allOrderings(v1) self.assertTrue(v1(bdd.variable('x2'),bdd.variable('x4'))) self.assertFalse(v1(bdd.variable('x3'),bdd.variable('x2')))
def testOrderings(self): self.__allOrderings(bdd.leftistOrdering) self.assertTrue(bdd.leftistOrdering(None, None)) self.__allOrderings(bdd.rightistOrdering) self.assertFalse(bdd.rightistOrdering(None, None)) v1 = bdd.enumeratedVariablesOrdering(['x1', 'x2', 'x3', 'x4']) self.__allOrderings(v1) self.assertTrue(v1(bdd.variable('x2'), bdd.variable('x4'))) self.assertFalse(v1(bdd.variable('x3'), bdd.variable('x2')))
def testApply(self): v1=bdd.variable('v1') v2=bdd.variable('v2') v1dv2=bdd.disjunction(['v1','v2']) v1av2=bdd.simplify(bdd.apply(v1,v2,bdd.orOperation,bdd.enumeratedVariablesOrdering(['v1','v2']))) self.assertEqual(v1dv2,v1av2)