## 3 Task Scheduling with Mixed-Integer Programming
### Task Scheduling with the Kinematic Constraints
\begin{split}& t_{l}^{b}-t_{k+1}^{a}+B(1-\delta_{kl}^{ab})\geq 0, \\ & t_{k}^{a}-t_{l+1}^{b}+B\delta_{kl}^{ab}\geq 0,\\ &\text{for }(a,b,k,l)\in\mathbb{N}\,:(a,b)\in[1,n],\;k\in[1,m_{a}],\;l \in[1,m_{b}].\end{split}  \tag{2}\]  
Our goal is to minimize the time the last task to finish. \(t_{\mathcal{C}}\) is defined as makespan, and it is greater than or equal to the completion time of each dish. It can be expressed \(t_{\mathcal{C}}\geq t_{x_{i}}^{i}+\tau_{x_{i}}^{i}\) for all \(\mathcal{D}\) when each \(\mathcal{D}_{i}\) has \(x_{i}\) tasks. The list of conflicting tasks \(\mathcal{C}\) was defined above, and the collision avoidance constraints need to be added with all of the components in \(\mathcal{C}\). If the number of components of \(\mathcal{C}\) is \(k\), then the constraint \(2k\) is added. If the number of \(\mathcal{D}\) is \(n\), then the total number of constraints are \(n+2\cdot\sum_{i=1}^{n}x_{i}+2k\). The formulation that considers every constraints is as follows:  
\[ \begin{split}\underset{l}{\text{minimize}}& t_{ \mathcal{C}}\\ \text{subject to}& t_{\mathcal{C}}\geq t_{x_{i}}^{i}+ \tau_{x_{i}}^{i}\qquad\text{for }i=1,...,n\\ & t_{j}^{i}\geq 0\\ & t_{j+1}^{i}\geq t_{j}^{i}+\tau_{j}^{i}\qquad\text{when }c_{j}^{i}=0,\text{ for }i=1,\cdots,n,\;j=m_{1}^{i},\cdots,m_{x_{i}}^{i}\\ & t_{j+1}^{i}=t_{j}^{i}+\tau_{j}^{i}\qquad\text{when }c_{j}^{i}=1,\text{ for }i=1, \cdots,n,\;j=m_{1}^{i},\cdots,m_{x_{i}}^{i}\\ & t_{l}^{b}-t_{k+1}^{a}+B(1-\delta_{kl}^{ab})\geq 0\\ & t_{k}^{a}-t_{l+1}^{b}+B\delta_{kl}^{ab}\geq 0\qquad\text{for } \forall(a,b,k,l)\in\mathcal{C}\\ &\delta_{kl}^{ab}\in\{0,1\}.\end{split}  \tag{3}\]```
1:procedureSolveOptimization(\(\mathbb{T}\))
2:\(\mathbb{T}=\{\mathcal{D}\}=\{(\mathcal{T},\tau,\mathcal{L}_{s},\mathcal{L}_{e},A)\}\)
3:\(n\leftarrow\) number of \(\mathcal{D}\)
4:\(x_{i}\leftarrow\) number of \(\mathcal{T}_{i}^{j}\) in \(\mathcal{D}_{i}\)
5:for\(a=1\) to \(n\) and \(b=1\) to \(n\)do
6:for\(k=m_{1}^{a}\) to \(m_{x_{a}}^{a}\) and \(l=m_{1}^{b}\) to \(m_{x_{a}}^{b}\)do
7:if\(M_{R}(k,l)=0\) and \(M_{R}(l,k)=0\)then
8:\(\mathcal{C}\_{\text{insert}}(a,b,k,l)\)
9: find\(\underset{t}{\text{minimize}}\quad t_{\mathcal{C}}\)
10: subject to \(t_{\mathcal{C}}\geq t_{x_{a}^{i}}^{i}+\tau_{x_{i}}^{i}\) for \(i=1,\cdots,n\)
11:\(t_{j}^{i}\geq 0\)
12:\(t_{j+1}^{i}\geq t_{j}^{i}+\tau_{j}^{i}\) when \(c_{j}^{i}=1,\text{ for }i=1,\cdots,n\), \(j=m_{1}^{i},\cdots,m_{x_{i}}^{i}\)
13:\(t_{j+1}^{i}=t_{j}^{i}+\tau_{j}^{i}\) when \(c_{j}^{i}=0,\text{ for }i=1,\cdots,n\), \(j=m_{1}^{i},\cdots,m_{x_{i}}^{i}\)
14:\(t_{1}^{b}-t_{k+1}^{k}+B(1-\delta_{kl}^{ab})\geq 0\)
15:\(t_{k}^{a}-t_{l+1}^{b}+B\delta_{kl}^{ab}\geq 0\) for \(\forall(a,b,k,l)\in\mathcal{C}\)
16:\(\delta_{kl}^{ab}\in\{0,1\}\). 17:for\(j=1\) to \(N\)do
18:\(\mathbb{D}\_{\text{insert}}(\|p(\mathcal{L}_{s,j})-p(\mathcal{L}_{e,j+1})\|)\)
19: find\(\underset{L(\mathcal{T}),R(\mathcal{T})}{\text{minimize}}\quad D_{t}\)
20: subject to \(D_{t}\geq L(\mathcal{T})\cdot\mathbb{D}\)
21:\(D_{t}\geq R(\mathcal{T})\cdot\mathbb{D}\)
22:\(L(\mathcal{T}_{j})+R(\mathcal{T}_{j})=\mathcal{A}_{j}\) for \(j=1,...,N\)
23:\(L(\mathcal{T}_{l})=1,R(\mathcal{T}_{l})=0,L(\mathcal{T}_{k})=0,R(\mathcal{T} _{k})=1\) for \(\forall(k,l)\in\mathcal{C}\)
24: when \(M_{R}(k,l)=0\) and \(L(\mathcal{T}_{j})+R(\mathcal{T}_{j})=1\). 25:return\(t,L(\mathcal{T}),R(\mathcal{T})\)
```

**Algorithm 2**Optimization solver. ### Assigning Arm to the Tasks

In this section, the formulation that assigns the robot arms to each task and minimizes the transition distance between tasks is proposed. The \(t_{ji}\) values for all \(\mathcal{T}_{j}^{i}\) are decided in Section 3.1. Thus, the results from Section 3.1 is used as the input of our second-step formulation. The constraint of the second-step formulation is mainly related to \(\mathcal{A}_{j}^{i}\), which is the number of arms needed to proceed \(\mathcal{T}_{j}^{i}\). Let the sum of the number of tasks be \(N=\sum_{i=1}^{n}x_{i}\).