示例#1
0
    def test_no_numeric_bounds(self):
        b = build.Builder()
        b.ints("x", "y")

        diagram = b.test("x <= y + 10") * b.test("x >= y - 10") * b.exp(
            "10 * x * y")
        matrix_vector.sum_out(diagram.pool, diagram.root_id, ["x"])
示例#2
0
    def build_diagram_2():
        b = build.Builder()
        b.ints("x", "y")
        test_1 = b.test("x >= 1") * b.test("y >= 1")
        test_10 = b.test("x <= 10") * b.test("y <= 10")
        test_y = b.test("x <= y")
        test_y_plus_1 = b.test("x <= y + 1")

        tree = b.ite(test_y, b.ite(test_y_plus_1, 3, 5), b.ite(test_y_plus_1, 7, 11))
        diagram1 = test_1 * test_10 * tree
        return diagram1
示例#3
0
    def build_diagram_1():
        b = build.Builder()
        b.ints("x")
        test_1 = b.test("x >= 1")
        test_10 = b.test("x <= 10")
        test_5 = b.test("x <= 5")
        test_6 = b.test("x <= 6")

        tree = b.ite(test_5, b.ite(test_6, 3, 5), b.ite(test_6, 7, 11))
        diagram1 = test_1 * test_10 * tree
        return diagram1
示例#4
0
    def setUp(self):
        b = build.Builder()
        b.ints("x", "a", "b", "c", "d")
        self.builder = b
        a_test = b.test("x", "<=", "a")
        b_test = ~b.test("x", "<=", "b")
        c_test = b.test("x", "<=", "c")
        shared_node = b.ite(b.test("x", "<=", "d"), "3*x + 7", "5*x + 11")
        self.diagram1 = b.ite(a_test, b_test * shared_node,
                              c_test * shared_node)

        self.diagram2 = a_test * b_test * c_test * b.exp("19*x")

        self.exporter = export.Exporter(
            os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         "visual"), "rename")
示例#5
0
 def __init__(self, pool=None):
     self.builder = build.Builder(pool)