## 4 Solving the Warehouse Delivery Problem
### Task Assignment and Sequencing
#### 4.3.2 Conflict Detection and Resolution
**Condition 6-7: Complete and Non-Overlapping Assignment**. As already mentioned, Lines 1 and 2 of Listing 2 assign each task \(t\) to exactly one robot \(r\). Thus, all tasks are assigned and no task is assigned twice in \(f_{T}^{X}\). **Condition 8-11: Starting and Homing Assignment**. Line 10 of Listing 6 ensures that each robot is initially at its starting vertex; and Line 11 of Listing 6 guarantees that they finish at their respective home docking vertices. Clearly, this establishes Condition 8 and 9 for \(f_{W}^{X}\). In terms of timing, the difference constraints in Lines 6 and 7 of Listing 9 set the arrival times at the starting vertices to 0, and thus fulfill Condition 10. Similarly, Lines 9 to 11 of Listing 9 set the exit time at the last position of each walk to the makespan in view of all timed walks. While this does not satisfy Condition 11 in an exact manner, the replacement of \(\infty\) by the makespan amounts to the same condition, since the makespan is greater than or equal to any other time point in the timed walks. It is also, clearly, more informative. **Condition 12: Collision-free Assignment**. Listing 7 is dedicated to detecting conflicts, and in particular deciding whether Condition 12a or 12b is used to resolve a conflict. More precisely, for distinct robots \(r,r^{\prime}\) with route points \((v,e,a)\in f_{W}^{X}(r)\), \((v^{\prime},a^{\prime},e^{\prime})\in f_{W}^{X}(r^{\prime})\) at steps \(s\) and \(s^{\prime}\), respectively, facing a conflict at \((v,v^{\prime})\in C\), we have that either before\(((r,s),(r^{\prime},s^{\prime}))\in X\) or before\(((r^{\prime},s^{\prime}),(r,s))\in X\). Then, in Line 14 of Listing 9, we use this decision to derive difference constraints either expressing that arrive\((r,s+1)\ \leq\ \mathtt{arrive}(r^{\prime},s^{\prime})\) or arrive\((r^{\prime},s^{\prime}+1)\ \leq\ \mathtt{arrive}(r,s)\). If \((v^{\prime\prime},a^{\prime\prime},e^{\prime\prime})\) and \((v^{\prime\prime\prime},a^{\prime\prime\prime},e^{\prime\prime\prime})\) are the route points following \((v,a,e)\) and \((v^{\prime},e^{\prime},a^{\prime})\) in \(f_{W}^{X}(r)\) and \(f_{W}^{X}(r^{\prime})\), respectively, then the difference constraints enforce either \(a^{\prime\prime}\leq a^{\prime}\) or \(a^{\prime\prime\prime}\leq a\), thus establishing Condition 12. **Condition 13-15: Executable Assignment**. A pivotal concept for establishing a solution is the set of projections on the robots walks warranting that all tasks can be executed. In the step-based encoding, we do not explicitly represent the projection for every robot but rather rely upon atoms over predicate proj/2. Specifically, an atom proj\((t,s)\) represents that task \(t\) is projected on some walk at position \(s\). We can retrieve the projected walk via atoms assign\((r,t)\) and \(\mathtt{walk}(r,s,v)\) telling us that we project on the walk of robot \(r\). This, as well as \(\mathtt{task}(t,v)\), also provides the task's action execution vertex \(v\). Note that encoding projections in this way reduces the number of ground atoms compared to a more direct representation with proj\((r,s,v)\). A stable model \(X\) of logic program \(F\cup P\) induces a set \(P^{X}\) of projections in the following way for \(r\in R\), \(t,t^{\prime},t^{\prime\prime}\in T\), \(v,v^{\prime},v^{\prime\prime}\in V\), and \(s,s^{\prime},s^{\prime\prime},a,a^{\prime},e,e^{\prime}\in\mathbb{N}\).