# Centralized Task Allocation and Alignment Based on Constraint Table and Alignment Rules
## 5 Algorithm  
The algorithm of centralized TACTAR including scoring and scheduling schemes as described in Sections 3 and 4, respectively, can be summarized as in Algorithm 5. In line 1 of Algorithm 5, variables for centralized TACTAR are set where \(\mathbf{X}_{t}\) is positions of agents, \(\mathbf{X}_{t}\) is task points, and \(\mathbf{D}_{t}\) and \(\mathbf{T}_{t}\) are spatial and temporal constraint matrix, respectively. In line 2 of Algorithm 5, constants for centralized TACTAR are set where \(\mathbf{T}_{t,\textit{d}ur}\) is duration time of tasks, \(\mathbf{V}_{max,a}\) is maximum velocity of each agent, \(\mathbf{F}_{bil,a}\) is bidding flags whether each agent can bid to tasks or not, and \(\mathbf{T}_{min,\textit{d}ur}\) is minimum overlapping time between working time of tasks in'start during' or 'end during' relationship. \(\overline{c}\) is time-invariant maximum reward for each task, \(\mathbf{\rho}\) is decreasing ratio of it for each task as described in Equation (7), \(\mathbf{w}_{arr}\) and \(\mathbf{w}_{end}\) are weight of arrival and end-reward (cost) for Equation (7), respectively. \begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Description** \\ \hline Local Mutual Exclusive & Only either task A or B can be allocated to \\  & each agent at each time \\  & Only either task A or B can be allocated to \\  & all agents at each time \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Spatial coupled constraints in centralized TACTAR. \begin{table}
\begin{tabular}{c c} \hline \hline
**Entry Code (\(\mathbf{D(q,p)}\))** & **Description** \\ \hline
0 & Task \(p\) can be allocated independently of task \(q\) \\
1 & Task \(p\) and \(q\) are locally mutual exclusive \\
2 & Task \(p\) and \(q\) are globally mutual exclusive \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Entry for temporal constraint matrix in centralized TACTAR. \begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Description** \\ \hline Simultaneous & Task A and B must start at the same time \\ After & Task A must start after task B ends \\ Start during & Task A must start between task B starts and ends \\ End during & Task A must end between task B starts and ends \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Temporal coupled constraints in centralized TACTAR. ```
1:set variables \(\mathbf{X}_{a}^{(0)}\), \(\mathbf{X}_{t}^{(0)}\), \(\mathbf{D}_{t}\), \(\mathbf{T}_{t}\)
2:set constants \(\mathbf{T}_{t,dir}\), \(\mathbf{V}_{max,x,t}\), \(\mathbf{F}_{bild,a}\), \(\mathbf{T}_{min,dir}\), \(\mathbf{\bar{r}}\), \(\mathbf{\rho}\), \(\mathbf{w}_{arr}\), \(\mathbf{w}_{end}\)
3:While (at least one capable task is remained incompletion)
4:initialize uncompleted tasks
5:make sequence of tasks
6:endwhile
```  
**Algorithm 5** Centralized TACTAR: main  
In lines 3-7 of Algorithm 5, task allocation and alignment are performed until all tasks are completed. At the first iteration, variables for uncompleted tasks need to be initialized. The initialization for iterations is as below:  
In Algorithm 6, lines 2-15 are performed for each agent. In lines 3-9 of Algorithm 6, initialization is performed based on condition of each task where \(\mathbf{p}_{m}\) is sequence of tasks for agent \(m\). If the agent has not arrived at the task point, initialization in line 4 of Algorithm 6 is performed. In the case that the agent has arrived at the task point or started the task, initialization in line 7 of Algorithm 6 is performed. \(\mathbf{t}_{arr}\), \(\mathbf{t}_{s}\), and \(\mathbf{t}_{e}\) are arrival time, start-time, and end-time of tasks, respectively, \(\mathbf{z}\) is the agent in charge of each task. If the user chooses accumulated distance cost scheme, lines 11-13 of Algorithm 6 are performed for recalculating accumulated distance, \(d_{accum}\). After all, constraints made by deleted tasks in lines 4 or 7 of Algorithm 6 are deleted from the constraint table in line 14 of Algorithm 6.