Ejemplo n.º 1
0
  def check_current_joins_three_two_edges_case1_next_2_l1_cN(self, l0_col_second, l0_col, l1_col):
    next_row = 2

    cds = CDS(self.session, 3, 2)
    self.session.run(tf.global_variables_initializer())
    cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
    cds.joins([(0, l0_col)], (1, l1_col), "l1_c0")
    cds.joins([(0, l0_col_second), (1, l1_col)], (next_row, 0), "next")
    return cds
Ejemplo n.º 2
0
def evaluate(string):
    max_length = 10
    max_depth = 6
    session_cds = tf.Session()
    cds = CDS(session_cds, max_length, max_depth)
    session_cds.run(tf.global_variables_initializer())
    expression = string.split()

    cds.initialize(expression)
    cds.show()

    print("Input Expression: {0}".format(expression))
    while len(expression) > 1:
        op_idx = chain_model.apply(session, expression)
        op = expression[op_idx]

        try:
            op_to_apply[op](op_idx, expression, cds)
            expression = [t[1] for t in cds.current()]
        except:
            break

    return [t[1] for t in cds.current()]
Ejemplo n.º 3
0
 def check_current_joins_three_one_edge_case5(self, next_row):
   cds = CDS(self.session, 3, 2)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   cds.joins([(0, 1)], (next_row, 1), "next")
   self.assertEqual([((0, 0), "l0_c0"), ((next_row, 1), "next"), ((0, 2), "l0_c2")], cds.current())
Ejemplo n.º 4
0
 def test_current_joins_initialize_three(self):
   cds = CDS(self.session, 3, 1)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   self.assertEqual([((0, 0), "l0_c0"), ((0, 1), "l0_c1"), ((0, 2), "l0_c2")], cds.current())
Ejemplo n.º 5
0
 def check_current_joins_three_three_edges_case1(self, to_column):
   cds = CDS(self.session, 3, 2)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0", "l0_c1", "l0_c2"])
   cds.joins([(0, 0), (0, 1), (0, 2)], (1, to_column), "next")
   self.assertEqual([((1, to_column), "next")], cds.current())
Ejemplo n.º 6
0
 def test_current_joins_initialize_one(self):
   cds = CDS(self.session, 1, 1)
   self.session.run(tf.global_variables_initializer())
   cds.initialize(["l0_c0"])
   self.assertEqual([((0, 0), "l0_c0")], cds.current())