## 2 Methods
### Integrated Task and Path Planning
#### 2.2.1 Looking-Backward Search Strategy (LSS)  
Traditionally, a task will be assigned to a machining center at the time point right after the last task assigned to this machining center is finished. This treatment is named the Baseline method (or the traditional method) in our study, and may lead to unnecessary waiting time since the time periods before starting the last assigned task might be free for inserting the current task. Thus, we propose the Looking-backward Search Strategy (LSS) to reduce the operating time. The basic idea is to search the available time periods before the starting time of the last assigned task (i.e., looking backward) and try to identify whether the current task can fit in any of those time periods.  
Algorithm 1 shows the pseudo-code for updating the processing sequence via LSS. \(t_{k}^{i}\) denotes the time taken for machining center \(k\) to process task \(i\). \(t_{j}^{i}\) denotes the time when robot \(j\) finishes the transporting task \(i\) to the machining center \(k\), and \(t_{cur\_max}\) represents the current total time taken by the machining center \(k\) to complete the last task that was assigned. Equation (13) describes \(\Delta t_{i}\), the search space of inserting task \(i\) (i.e., the feasible time periods) when the looking-backward search is performed. Specifically, a counter function count is performed to keep track of the time periods when the machining center  
Figure 2: The overall workflow of the integrated task and path planning approach. CA* [27] is used in the path planning process.  
is idle. Here the greedy search strategy is used, which means that once we find the first feasible time period insert, the search will stop and the identified period will be the time period for machining center \(k\) to process task \(i\).  
\[\Delta t_{i}=\left(t_{j}^{i},t_{cur\_max}\right) \tag{13}\]  
```
1:Input: current task \(i\), robot \(j\), machining center \(k\)
2:Output: processing mapping table \(MT_{kt}\)
3:Initialize \(count=0\)
4:for all\(t\in\left(t_{j}^{i},t_{cur\_max}\right)\)do
5:if\(MT_{kt}==0\)then
6:\(count++\)
7:if\(count==t_{k}^{i}\)then
8:for all\(t^{\prime}\in\left(t,t+t_{k}^{i}-1\right)\)do
9:\(MT_{kt^{\prime}}=i\)
10:endfor
11:endif
12:if\(MT_{kt^{\prime}}!=0\)then
13:\(count=0\)
14:endif
15:endfor
```  
**Algorithm 1** Update Processing Sequence via LSS [28]  
Figure 3 shows an example case of updating the task assignment based on LSS. The gray boxes represent the time periods occupied by assigned tasks (e.g., tasks \(a,b,c\in T\)) and they cannot be replaced with new tasks. The yellow box represents the insertion time period using the traditional selection method (i.e., the Baseline method). As shown in Figure 3, it is right after the occupied time of the assigned task \(c\). In other words, the traditional method does not take into account the idle time of the machining center, but simply adds the needed time period of processing the new task to the end of the machining center's processing queue. The blue box represents the first feasible insertion time period following LSS, while the white boxes represent unoccupied time periods based on LSS. The search space of the insertion time is \((t_{j}^{i},t_{cur\_max})\). Obviously, the new insertion strategy can reduce the idle time for the machining center, and the total time and energy consumption can be saved.