# Implementation and Evaluation of Dynamic Task Allocation for Human-Robot Collaboration in Assembly
## 2 Materials and Methods
### Dynamic Task Allocation Module
#### 2.2.2 Methodology for Dynamic Task Allocation  
The task allocation module of the presented system architecture (see Figures 3 and 4) implements the methodology for distributing tasks between humans and robots during execution of a created process flow. The proposed methodology for dynamic task allocation is described in the following. During the above explained process creation, the individual HRC nodes are created and interlinked, and the properties of these nodes are entered via input masks. As shown in Figure 5, these properties cover information about the task classification, the estimated execution time of the task for humans and robots, and the priority of the task. The latter serves as an additional decision criterion to determine a suitable prioritization with regard to the execution sequence of tasks. Figure 5: Conceptual representation of function blocks, which include sub-processes for the execution of the tasks by humans or robots (HRC nodes). As schematically illustrated in Figure 6, the created overall assembly process consists of a set of tasks \(T\). During execution, the tasks are executed progressively according to the precedence relationships and the task allocation logic until the process is terminated with the end node. During this, the states of the tasks change as follows (cf. Figure 6):  
* Not executed--not yet available (remaining tasks; highlighted in gray);
* Not executed--available (currently available tasks \(T_{\text{av}}\); yellow);
* In execution by robot (blue), or in execution by human (purple);
* Completed (finished tasks; green). Figure 7 shows the flowchart of the proposed methodology for dynamic task allocation. A more detailed version of the flowchart is provided in Appendix D in Figure A2. The variables are denoted as follows: \begin{tabular}{c c} \(T_{\text{av}}\) & Available tasks of current layer (see Figure 6, yellow); \\ \(T_{\text{av}}^{\text{i}}\) & The \(i^{\text{th}}\) task from available tasks \(T_{\text{av}}\) of current layer; \\ \(n(T)\) & Number of tasks \(T_{i}\); \\ \(L\) & Classification of task--available resource labels are H: human, R: robot, H/R: human or robot; \\ \(T_{\text{av},\ L=\{\chi\}}\) & Available tasks with resource label \(X\) (i.e., H, R, or H/R); \\ \(P_{T}\) & Priority of task; \\ \(T_{\{\chi\},\text{min}}\) & Task with minimal execution time among tasks with label \(X\); \\ \(T_{\{\text{term}\},P}\) & Task with highest priority \(P_{\text{min}}\), i.e., minimum numeric value \(P\), among tasks fulfilling the condition term; \\ \(T_{\{\chi Y\},\text{maxdiff}}\) & Task with a maximum difference between the execution times of resources \(X\) and Y among tasks with label \(XY\); \\ \(t_{\{\chi\}}(T)\) & Estimated execution time of resource \(X\) (H: human or R: robot) for task \(T\). \\ \end{tabular}   
The general idea of the dynamic task allocation methodology is to iteratively (either continuously or after finishing a task) request all currently available tasks \(T_{\text{av}}\) and decide for these which task should be performed next by either the human or the robot. For this decision, the abovementioned properties of the HRC nodes are utilized. The decision for the assignment of tasks is conducted according to the following scheme:  
1. The availability of the resources is checked. 2. For each available resource, the currently available task with an unambiguous, matching task classification and minimum execution time (see Equations (1) and (2) for calculation) is assigned. Figure 6: Schematic representation of a process flow during process execution with different states of tasks and task clusters highlighted. 3. If no more tasks with unambiguous task classification are currently available, tasks which are eligible for both the human and robot are considered, and the task in which the particular resource has the highest advantage in execution time over the other (see Equations (3) and (4) for calculation) is assigned to the respective available resource.