## 4 Solving the Warehouse Delivery Problem
### Task Assignment and Sequencing
#### 4.3.2 Conflict Detection and Resolution
Note, that this last case does not increment the step count, since the transition between paths does not involve any change of location from the assigned robot. Now, let \(P\) be the logic program defined above and \(P^{\prime}\) its step-based counterpart, that is, the combined set of rules from Listings 2 to 9. Then, a stable model \(X\) of logic program \(F\cup P\) is mapped into a stable model \(Y\) of logic program \(F\cup P^{\prime}\). For \(r\in R\), \(t,t^{\prime}\in T\), \(p,p^{\prime}\in T\cup R,v,v^{\prime},v^{\prime\prime}\in V\), and \(s,a,d^{\prime},e,e^{\prime}\in\mathbb{N}\), we have

1. \(\texttt{assign}(r,t)\in Y\) if \(\texttt{assign}(r,t)\in X\)
2. \(\{\texttt{assign}(r,t),\texttt{assign}(r,t^{\prime}),\texttt{task\_sequence}(t,t^{ \prime})\}\subseteq Y\) if \(\{\texttt{assign}(r,t),\texttt{assign}(r,t^{\prime}),\texttt{task\_sequence}(t,t^{ \prime})\}\subseteq X\)
3. \(\texttt{same\_robot}(t,t^{\prime})\in Y\) if \(\texttt{same\_robot}(t,t^{\prime})\in X\)
4. \(\{\texttt{walk}(r,\pi_{X}(p,v),v),\texttt{walk}(r,\pi_{X}(p,v^{\prime}),v^{ \prime})\}\cup\{\texttt{dl}(\texttt{arrive}(r,\pi_{X}(p,v)),a),\texttt{dl}( \texttt{exit}(r,\pi_{X}(p,v)),e)\}\cup\{\texttt{dl}(\texttt{arrive}(r,\pi_{X}(p,v^{\prime})),a^{\prime}),\texttt{dl}(\texttt{exit}(r,\pi_{X}(p,v)),e^{ \prime})\}\subseteq Y\) if \(\{\texttt{move}(p,v,v^{\prime}),\texttt{move}(p,v^{\prime},v^{\prime\prime}), \texttt{path\_assign}(r,p)\}\cup\{\texttt{dl}(\texttt{arrive}(p,v),a),\texttt{dl}( \texttt{exit}(p,v),e)\}\cup\{\texttt{dl}(\texttt{arrive}(p,v^{\prime}),a^{ \prime}),\texttt{dl}(\texttt{exit}(p,v^{\prime}),e^{\prime})\}\subseteq X\)
5. \(\{\texttt{walk}(r,\pi_{X}(p,v^{\prime}),v^{\prime})\}\cup\{\texttt{dl}( \texttt{arrive}(r,\pi_{X}(p,v^{\prime})),a),\texttt{dl}(\texttt{exit}(r,\pi_{X} (p,v^{\prime})),e)\}\subseteq Y\) if \(\{\texttt{move}(p,v,v^{\prime}),\texttt{path\_assign}(r,p)\}\cup\{\texttt{dl}( \texttt{arrive}(p,v^{\prime}),a),\texttt{dl}(\texttt{exit}(p,v^{\prime}),e)\}\subseteq X\) provided that \(\texttt{move}(p,v^{\prime},v^{\prime\prime})\
ot\in X\)
6. \(\{\texttt{walk}(r,\pi_{X}(p,v^{\prime}),v^{\prime}),\texttt{proj}(p,\pi_{X}(p,v^{\prime}))\}\cup\{\texttt{dl}(\texttt{arrive}(r,\pi_{X}(p,v^{\prime})),a), \texttt{dl}(\texttt{exit}(r,\pi_{X}(p,v^{\prime})),e)\}\subseteq Y\) if \(\{\texttt{move}(p,v,v^{\prime}),\texttt{move}(p^{\prime},v^{\prime},v^{ \prime\prime})\}\cup\{\texttt{path\_sequence}(p,p^{\prime}),\texttt{path\_ assign}(r,p)\}\cup\{\texttt{dl}(\texttt{arrive}(p,v^{\prime}),a),\texttt{dl}( \texttt{exit}(p^{\prime},v^{\prime}),e)\}\subseteq X\) provided that \(\texttt{move}(p,v^{\prime},v^{\prime\prime})\
ot\in X\)
7. \(\{\texttt{before}((r,\pi_{X}(p,v)),(r^{\prime},\pi_{X}(p^{\prime},v^{\prime})))\}\subseteq Y\) if \(\{\texttt{before}((p,v),(p^{\prime},v^{\prime})),\texttt{path\_assign}(r,p), \texttt{path\_assign}(r^{\prime},p^{\prime})\}\subseteq X\)

We first establish that task assignment and task sequences function in the same way in both settings. Then, for intermediate moves along a path, we determine the timed walk for both vertices in 4. That is, we identify the robot assigned to the path and add both vertices to its walk at the step provided by function \(\pi_{X}\) as well as the arrival and exit times. The next two cases deal with the end of a path. If we have reached the final vertex, i.e., there are no more paths in the path sequence, we add the information provided by stable model \(X\) as is. If another path follows, we combine the duration of both paths on their shared vertex to define the timed walk. Looking at 6 in more detail. If robot \(r\) is assigned to paths \(p\) and \(p^{\prime}\), with \(p^{\prime}\) immediately following on from \(p\), and where vertex \(v^{\prime}\) is the target vertex of \(p\), then we add atoms representing that robot \(r\) visits vertex \(v^{\prime}\) at step \(\pi_{X}(p,v^{\prime})\), arriving at path \(p^{\prime}\)s arrival time at \(v^{\prime}\) and departing at path \(p^{\prime}\)'s exit time from \(v^{\prime}\).