本文整理匯總了Python中dd.bdd.BDD.reduction方法的典型用法代碼示例。如果您正苦於以下問題:Python BDD.reduction方法的具體用法?Python BDD.reduction怎麽用?Python BDD.reduction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dd.bdd.BDD
的用法示例。
在下文中一共展示了BDD.reduction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_reduce_combined
# 需要導入模塊: from dd.bdd import BDD [as 別名]
# 或者: from dd.bdd.BDD import reduction [as 別名]
def test_reduce_combined():
"""Fig.5 in 1986 Bryant TOC"""
ordering = {'x': 0, 'y': 1, 'z': 2}
g = BDD(ordering)
g.roots.add(2)
g._succ[2] = (0, 3, 4)
g._succ[3] = (1, -1, 5)
g._succ[4] = (1, 5, 6)
g._succ[5] = (2, -1, 1)
g._succ[6] = (2, -1, 1)
h = g.reduction()
assert 1 in h
assert ordering == h.ordering
r = nx.MultiDiGraph()
r.add_node(1, level=3)
r.add_node(2, level=0)
r.add_node(3, level=1)
r.add_node(4, level=2)
r.add_edge(2, 3, value=False, complement=False)
r.add_edge(2, 4, value=True, complement=False)
r.add_edge(3, 4, value=True, complement=False)
r.add_edge(3, 1, value=False, complement=True)
r.add_edge(4, 1, value=False, complement=True)
r.add_edge(4, 1, value=True, complement=False)
(u, ) = h.roots
compare(u, h, r)
示例2: test_elimination
# 需要導入模塊: from dd.bdd import BDD [as 別名]
# 或者: from dd.bdd.BDD import reduction [as 別名]
def test_elimination():
ordering = {'x': 0, 'y': 1}
g = BDD(ordering)
g.roots.add(2)
# high == low, so node 2 is redundant
g._succ[2] = (0, 3, 3)
g._succ[3] = (1, -1, 1)
h = g.reduction()
assert set(h) == {1, 2}
示例3: test_isomorphism
# 需要導入模塊: from dd.bdd import BDD [as 別名]
# 或者: from dd.bdd.BDD import reduction [as 別名]
def test_isomorphism():
ordering = {'x': 0}
g = BDD(ordering)
g.roots.update([2, 3])
g._succ[2] = (0, -1, 1)
g._succ[3] = (0, -1, 1)
h = g.reduction()
assert set(h) == {1, 2}, set(h)
assert 0 not in h
assert h._succ[1] == (1, None, None)
assert h._succ[2] == (0, -1, 1)
assert h.roots == {2}