# Learning and Planning Based on Merged Experience from Multiple Situations for a Service Robot
## 2 Learning and Planning Methods
### Learn Activity Schema with Abstract Methods
#### 2.3.1 Relevant Predicates Extraction  
The first problem we try to solve is how to extract the predicate list of an abstract method from the robot's experience. The number of predicates in a robot system with complex scenes and tasks is large, but the predicates in preconditions of a method are limited. We found that most predicates in a precondition of a method can be grouped into two categories. The first category contains one of the subtask's arguments and the second category contains another argument of a predicate belonging to the first category.  
In the property graph for a concept, nodes within a semantical distance of 2 are considered as relevant [23]. Given that the goal of a task is to change the state of some objects, the objects used as arguments of the taught task, the preconditions and effects of actions are considered as the **key** arguments. The predicates that connect an argument of a subtask with a key argument within a two-step relationships are considered as relevant predicates and extracted as the precondition of the taught task (an activity schema or an abstract method). In the system, all predicates follow one of the following two forms: (Instance class instance_name) and (property instance_name filler). The former states the existence of an instance of the class type and the latter is used to represent the properties of that instance.  
Let \(L_{1}\) be the predicates following the first form, and let \(L_{2}\) be the predicates following the second form. The relationship from one argument \(x\) to another parameter \(y\) is calculated by the number of predicates connecting them that follow the second form, and the sign of the relationship is determined by the direction. However, if the number of connected predicates is 2, and the intermediate argument is reified relation (e.g., at, on), the distance is considered as 1 (as in Formula (3)). Additionally, a predicate in the form of (Instance class instance_name) that contains an argument \(x\) is regarded as distance 0. According to such rules, the relevant predicates for a branch \(b\) of an abstract method are computed as follows:  
\[F(b)=\cap_{i=1}^{n}F(t_{i}), \tag{1}\]  
\[F(t)\!\!=F_{0}(t)\;\cup\;F_{1}(t)\;\cup\;F_{2}(t)\;\cup\;F_{-1}(t)\;\cup\;F_{ -2}(t), \tag{2}\]  
\[F_{1}(t)=\{\tau(p(x,\,y))\;|\;p\in L_{2},\;x\in A,\;y\in B\}\cup\{\tau(p(x, \,z)),\;\tau_{2}(q(z,\,y))\;|(p,\,q)\in L_{2},\;x\in A,\;y\in B,\;z\in R\}, \tag{3}\]\[F_{-1}(t)=\{\tau(p(y,\ x))\mid p\in L_{2},\ x\in A,\ y\in B\}\cup\{\tau_{1}(q(y,z)), \ \tau_{2}(p(z,\ x))\mid(p,\ q)\in L_{2},\ x\in A,\ y\in B,\ z\in R\}, \tag{4}\]  
\[F_{2}(t)=\{\tau_{1}(p(x,\ z)),\ \tau_{2}(q(z,\ y))\mid(p,\ q)\in L_{2},\ x\in A,\ y\in B,\ z\
otin R\}, \tag{5}\]  
where \(t_{i}\) is the \(i\)th subtask in \(b\); \(p\) and \(q\) are predicates; \(\tau\), \(\tau_{1}\) and \(\tau_{2}\) are qualitative timestamps; \(A\) is the set of arguments of a task \(t\); \(B\) is the set of key arguments; and \(F_{1}(t)\) is the collection of predicates that connect \(x\) with \(y\) with distance \(i\). \(R\) is a set of arguments that are refiled relations.  
To support similarity-based planning, the relevant predicates are also used as features for each abstract operator via the same calculation as mentioned above. In the RACE system, propositions in the form of first-order binary predicates with qualitative time stamps are called fluents, and are gathered by an experience extractor.