# Learning and Planning Based on Merged Experience from Multiple Situations for a Service Robot
## 2 Learning and Planning Methods
### Planning Based on Activity Schema with Merging Optimization and Partially Backtracking Techniques
#### 2.4.1 Planning Based on Activity Schema with Merging Optimization
Then, the children nodes of serve_a_coffee (guest1) in the task tree were updated from _a36_ as the Algorithm 2 and Algorithm 3, and a new optimal plan was generated after the merging optimization as the Algorithm 2. When the robot encountered the person who blocked the path towards Table 1, the free abstract method wait_unblock (?manArea)) was identified and translated to wait_unblock (mant1) through a binding \"mant1\". Then, the plan solution was successfully generated following Algorithm 3. The simulation result shows that, when using our replanning method and the learned activity schema with abstract methods, the robot's execution recovers from two failures automatically. By contrast, when using traditional SBP and learned activity schema without an abstract method, and if _a17_ and _a37_ failed, the plan would fail because SBP does not have the ability to update the task problem and replan automatically. The instructor needs to designate the activity schema to guide the planning. This process is detailed below. When the robot was to perform the action with the highest percentage of verified features in _a17_ (move(pmast1, mast1)) according to the plan \(\pi_{1}\) generated based on \(ma_{1}\), the robot cannot complete the action due to an unexpected obstacle table occupying mast1. However, the SBP does not have the ability to update the task problem and replan automatically. Therefore, when the current action fails,

Figure 6: The execution process of the abstract plan based on schema-based planner (SBP) and schema-based optimized planner (SBOP). The purple boxes above the plan are abbreviated intervention instructions from the instructor. Each blue box under the plan is a process of replanning based on partially backtracking. the subsequent actions in \(\pi_{1}\) could not be executed, and \(\pi_{1}\) was abandoned due to the unreachability of the target state. As a result, the request was made to the instructor. At this time, the instructor was required to guide the robot. The instructor assigned the current activity schema to \(ma_{3}\) according to the updated world state. Then, the SBP searched for a new plan--\(\pi_{2}\) based on \(ma_{3}\). The first action to be performed was move_base(pmast1, pmant1), which had the highest percentage of verified features in \(a36\) (move(pmaec1, pmant1)). That meant that the robot should place the coffee cup on the left side of the guest (the north side of Table 1). When the action with the highest percentage of verified features in a37 (move(pmant1, mant1)) was to be performed, the robot found that mant1 was occupied by a person, and the robot could not complete the action. Similarly, since the SBP could not update the task problem and replan automatically, the current action failed. When the follow-up action could not be performed, \(\pi_{2}\) failed because the target state of the plan could not be reached, and the request was made again to the instructor. At this time, the instructor was required to guide the robot. The instructor assigned the current activity schema to \(ma_{2}\) according to the updated world state. Then, the SBP searched for a new plan--\(\pi_{3}\) based on \(ma_{2}\). The first action to be performed was wait_unblock (mant1), which had the highest percentage of verified features in \(a27\) (wait_unblock(mast1)). That meant that the robot should wait until the person leaves. Finally, the task was completed. The performances of SBP and our planner SBOP were evaluated based on the aspects of autonomy, adaptability and efficiency. In terms of autonomy, SBP requires more than two intervention instructions during task execution, whereas SBOP does not require intervention instruction and can recover from failures automatically. In terms of adaptability, SBOP can adjust among multiple learned activity schemas during execution and generate the corresponding plans by detecting the preconditions. However, SBP does not have this capacity.