예제 #1
0
    def test_find_conj2(self):
        a = self.a

        conj = (a.add(
            t.AtTimeLink,
            out=[
                a.add(t.TimeNode, '11210347010'),
                a.add(t.EvaluationLink,
                      out=[
                          a.add(t.PredicateNode, 'increased'),
                          a.add(t.ListLink,
                                out=[
                                    a.add(t.EvaluationLink,
                                          out=[
                                              a.add(t.PredicateNode,
                                                    'EnergyDemandGoal'),
                                              a.add(t.ListLink, out=[])
                                          ])
                                ])
                      ])
            ]),
                a.add(
                    t.AtTimeLink,
                    out=[
                        a.add(t.TimeNode, '11210347000'),
                        a.add(
                            t.EvaluationLink,
                            out=[
                                a.add(t.PredicateNode, 'actionDone'),
                                a.add(
                                    t.ListLink,
                                    out=[
                                        a.add(
                                            t.ExecutionLink,
                                            out=[
                                                a.add(t.GroundedSchemaNode,
                                                      'eat'),
                                                a.add(t.ListLink,
                                                      out=[
                                                          a.add(
                                                              t.AccessoryNode,
                                                              'id_-54646')
                                                      ])
                                            ])
                                    ])
                            ])
                    ]),
                a.add(t.SequentialAndLink,
                      out=[
                          a.add(t.TimeNode, '11210347000'),
                          a.add(t.TimeNode, '11210347010')
                      ]))
        conj = tuple(map(tree.tree_from_atom, conj))

        res = tree.find_conj(conj, a.get_atoms_by_type(t.Atom))
예제 #2
0
    def  test_find_conj2(self):
        a = self.a
        
        conj = (
            a.add(t.AtTimeLink, out=[a.add(t.TimeNode, '11210347010'), a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'increased'), a.add(t.ListLink, out=[a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'EnergyDemandGoal'), a.add(t.ListLink, out=[])])])])]),
            a.add(t.AtTimeLink, out=[a.add(t.TimeNode, '11210347000'), a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'actionDone'), a.add(t.ListLink, out=[a.add(t.ExecutionLink, out=[a.add(t.GroundedSchemaNode, 'eat'), a.add(t.ListLink, out=[a.add(t.AccessoryNode, 'id_-54646')])])])])]),
            a.add(t.SequentialAndLink, out=[a.add(t.TimeNode, '11210347000'), a.add(t.TimeNode, '11210347010')])
        )
        conj = tuple(map(tree.tree_from_atom, conj))

        res = tree.find_conj(conj,a.get_atoms_by_type(t.Atom))
예제 #3
0
    def test_find_conj(self):
        conj = (tree.tree_from_atom(self.l1), tree.tree_from_atom(self.l2))

        matches = tree.find_conj(conj, self.a.get_atoms_by_type(t.Atom))

        self.assertEquals(len(matches), 1)

        if len(matches) == 1:
            first = matches[0]

            self.assertEquals(first.subst, {})
            self.assertEquals(first.atoms, [self.l1, self.l2])
예제 #4
0
 def  test_find_conj(self):
     conj = (tree.tree_from_atom(self.l1), tree.tree_from_atom(self.l2))
     
     matches = tree.find_conj(conj, self.a.get_atoms_by_type(t.Atom))
     
     self.assertEquals(len(matches), 1)
     
     if len(matches) == 1:
         first = matches[0]
         
         self.assertEquals(first.subst, {})
         self.assertEquals(first.atoms, [self.l1, self.l2])
예제 #5
0
    def  test_find_conj3(self):
        a = self.a
        
        t1 = tree.atom_from_tree(tree.new_var(), a)
        t2 = tree.atom_from_tree(tree.new_var(), a)
        action = tree.atom_from_tree(tree.new_var(), a)
        goal = tree.atom_from_tree(tree.new_var(), a)
        
        conj = (
            a.add(t.AtTimeLink, out=[t1, a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'actionDone'), action])]),
            a.add(t.AtTimeLink, out=[t2, a.add(t.EvaluationLink, out=[a.add(t.PredicateNode, 'increased'), a.add(t.ListLink, out=[a.add(t.EvaluationLink, out=[goal, a.add(t.ListLink, out=[])])])])]),
            a.add(t.SequentialAndLink, out=[a.add(t.TimeNode, '11210347000'), a.add(t.TimeNode, '11210347010')])
        )
        conj = tuple(map(tree.tree_from_atom, conj))

        res = tree.find_conj(conj,a.get_atoms_by_type(t.Atom))