## 4 Solving the Warehouse Delivery Problem
### Task Assignment and Sequencing
#### 4.3.2 Conflict Detection and Resolution
The given timing constraint thus amounts to the one required in Condition 14, namely, \(a+\kappa\leq a^{\prime}\). Finally, note that the rule's precondition includes the requirement that D 1= deliver, thus limiting its application to non-delivery dependent tasks. The reason for this restriction is simply that this rule is redundant for a pair of delivery dependent tasks. Delivery dependent tasks can only be assigned to the same robot and since the task sequencing for that robot guarantees the correct task execution order, the correctness of the timing is implicitly guaranteed by this ordering. This completes the explanation of the difference constraints and variables defined in Listing 9. The assignment to these integer variables in our example is output by using the binary predicate d1/2 in _cling[dl]_. The following expressions capture the arrival and exit times in the timed walks in Table 2.

d1(arrive(r1,0),0) d1(exit(r1,0),0) d1(arrive(r2,0),0) d1(exit(r2,0),0) d1(arrive(r1,1),15) d1(exit(r1,1),15) d1(arrive(r2,1),15) d1(arrive(r2,1),15) d1(arrive(r1,2),45) d1(exit(r1,2),45) d1(arrive(r2,2),30) d1(exit(r2,3),5) d1(arrive(r1,3),65) d1(arrive(r2,3),45) d1(exit(r2,3),55) d1(arrive(r1,4),80) d1(exit(r1,4),90) d1(arrive(r2,4),70) d1(exit(r2,4),70) d1(arrive(r1,5),105) d1(exit(r1,5),105) d1(arrive(r2,5),100) d1(exit(r2,5),100) d1(arrive(r1,6),175) d1(exit(r1,7),105) d1(arrive(r2,6),120) d1(arrive(r1,7),150) d1(arrive(r1,7),200) d1(arrive(r2,7),135) d1(arrive(r1,8),215) d1(arrive(r2,8),160) d1(arrive(r1,8),160) d1(arrive(r1,9),225) d1(arrive(r2,9),175) d1(arrive(r2,9),175) d1(arrive(r1,10),240) d1(exit(r1,10),240) d1(arrive(r2,10),190) d1(exit(r2,10),200) d1(arrive(r1,11),25) d1(arrive(r2,11),215) d1(arrive(r2,12),280) d1(exit(r2,12),235) d1(arrive(r1,13),300) d1(arrive(r2,13),253) d1(arrive(r2,13),253) d1(arrive(r2,13),253) d1(arrive(r1,13),253) d1(arrive(r1,14),315) d1(exit(r1,14),325) d1(arrive(r2,14),263) d1(exit(r2,14),263) d1(arrive(r1,15),340) d1(arrive(r1,15),340) d1(arrive(r1,16),341) d1(arrive(r1,16),341) d1(arrive(r1,17),390) d1(arrive(r2,17),328) d1(exit(r2,17),338) d1(arrive(r1,18),405) d1(exit(r1,18),405) d1(arrive(r2,19),368) d1(exit(r2,19),368) d1(arrive(r2,19),369) d1(arrive(r2,10),405) d1(arrive(r2,20),383) d1(exit(r2,20),405)

Note that \(\infty\) is replaced by the makespan, viz. the value of variable bound. #### 4.3.5 Stable Models of the Step-Based Encoding and Solutions to the Warehouse Delivery Problem

After examining the individual parts of our step-based encoding of the warehouse delivery problem, we now describe how the resulting stable models relate to solutions of the warehouse delivery problem. This is not meant as a formal correctness proof but rather an informal account providing a broader perspective. To this end, let \(F\) be the set of facts obtained from a given warehouse (\(V\),\(E\),\(f_{F}\),\(C\),\(R\),\(f_{H}\),\(f_{S}\)) and task execution graph (\(T\),\(D\),\(f_{D}\),\(f_{V}\)), as described in Section 4.1, and let \(P\) be the combined set of rules from Listings 2 to 9. A stable model \(X\) of logic program \(F\cup P\) induces the candidate robot assignment \((f_{T}^{X},f_{W}^{X})\) in the following way for \(r\in R\), \(t,t^{\prime}\in T\), \(v,v^{\prime}\in V\), and \(s,a,e\in\mathbb{N}\).