Exemplo n.º 1
0
 def construct_diagram():
     pool = Pool(empty=True)
     pool.int_var("x")
     x = pool.terminal("x")
     zero = pool.terminal("0")
     test1 = pool.internal(LinearTest("x - 5", "<="), x, zero)
     test2 = pool.internal(LinearTest("x + 1", ">="), test1, zero)
     test3 = pool.internal(LinearTest("x + 2", "<="), x, test2)
     root = pool.internal(LinearTest("x", ">="), test1, test3)
     return Diagram(pool, root)
Exemplo n.º 2
0
 def get_looping_diagram():
     pool = Pool()
     pool.int_var("x")
     test = LinearTest("x", "<=", "2")
     zero = pool.terminal(0)
     one = pool.terminal(1)
     node1 = pool.internal(test, one, zero)
     node2 = pool.internal(test, node1, zero)
     diagram = pool.diagram(node2)
     return diagram
Exemplo n.º 3
0
 def construct_diagram():
     pool = Pool(empty=True)
     pool.int_var("x")
     x = pool.terminal("x")
     zero = pool.terminal("0")
     test1 = pool.internal(LinearTest("x - 5", "<="), x, zero)
     test2 = pool.internal(LinearTest("x + 1", ">="), test1, zero)
     test3 = pool.internal(LinearTest("x + 2", "<="), x, test2)
     root = pool.internal(LinearTest("x", ">="), test1, test3)
     return Diagram(pool, root)
Exemplo n.º 4
0
 def get_unordered_diagram():
     pool = Pool()
     pool.int_var("x")
     test1 = LinearTest("x", "<=", "2")
     test2 = LinearTest("x", "<=", "3")
     zero = pool.terminal(0)
     one = pool.terminal(1)
     pool.internal(test1, one, zero)
     pool.internal(test2, one, zero)
     # test2 => test1 => 1
     node1 = pool.internal(test1, one, zero)
     node2 = pool.internal(test2, node1, zero)
     diagram = pool.diagram(node2)
     return diagram