Expressive and efficient temporal reasoning is essential to a number of areas in Artificial Intelligence (AI)[8, 14, 15]. Over the past few years, many constraint-based formalisms have been developed to represent and reason about time in automated planning and temporal scheduling [4, 12]. We begin by recalling the Disjunctive Temporal Problem (DTP) [13, 16, 17]. The general form of a DTP being, given a finite set of temporal variables (i.e., time-points), to schedule them on the real line in such a way as to satisfy a prescribed finite set of temporal constraints over . Every constraint is a disjunction of the form , where every is a simple temporal constraint of the form for some integers and reals .
Although DTPs are expressive enough to capture many tasks in automated planning and temporal scheduling, they are NP-complete . The principal direct approach taken to solve DTPs has been to convert the original problem into one of selecting a disjunct from each constraint [16, 17], then to check whether the set of selected disjuncts forms a consistent Simple Temporal Problem (STP) . This can be done in strongly polynomial time by computing single-source shortest paths (e.g., with the Bellman-Ford’s algorithm ). Under this prospect, of course the prohibitive complexity of solving DTPs comes from the fact that there are exponentially many disjunct combinations possible.
In [9, 10], T.K.S. Kumar studied the Restricted Disjunctive Temporal Problem (RDTP), a tractable subclass of DTPs strictly including the classical and well established STPs . In RDTPs, each constraint can be either one of the following three types: () , for real (a simple temporal difference-constraint); () , for reals (a single-variable disjunction of many interval-constraints); () , for reals (a two-variable disjunction of two interval-constraints).
It was shown in  that RDTPs are solvable in deterministic strongly polynomial time by reducing them to the Connected Row-Convex (CRC)  constraint satisfaction problem, faster randomized algorithms were also proposed. CRC constraints generalize many other known tractable classes of constraints like 2-SAT, implicational, and binary integer-weighted linear constraints . Particularly, Kumar’s deterministic algorithm for solving RDTPs works by reducing them into binary Constraint Satisfiability Problems (CSPs) over meta-variables representing or constraints, meanwhile showing that such binary constraints are indeed CRC constraints, finally exploiting the algorithmic tractability of CRC constraints.
An instantiation of a consistency checking algorithm (e.g., ) that further exploits the structure of CRC constraints leads to a time complexity of , where is the set of constraints (respectively), and is the maximum number of disjuncts possible per single constraint . Randomization reduces the running time to , where is the degree of the CRC network (i.e., the maximum number of constraints any variable participates into) .
Notable applications of RDTPs include solving STPs with Taboo Regions, cfr. .
Contributions. This work offers a deeper comprehension on the tractability of RDTPs, leading to elementary deterministic strongly polynomial time algorithms, significantly improving the asymptotic running times of both the Kumar’s deterministic and randomized solutions. Our time complexity is , where is the total number of disjuncts counting over all -constraints. Since , this improves over all of the previous solutions. The result is obtained by reducing RDTPs to the Single-Source Shortest Paths (SSSP) and the 2-SAT problem (jointly), instead of reducing to CRCs. So the full expressive power of CRCs is not needed, binary linear and 2-SAT constraints are enough. In passing, we obtain a faster (quadratic time) deterministic algorithm for solving temporal problems having only -constraints and no -constraint.
As a second main contribution, we study the tractability frontier of RDTPs widened with another kind of restricted disjunctive constraints, i.e., Hyper Temporal Networks (HyTNs) , a strict generalization of STNs grounded on directed hypergraphs and introduced to overcome the limitation of considering only conjunctions of constraints but maintaining a practical efficiency in the consistency check of the instances. In a HyTN a single temporal multi-tail (or multi-head) hyperarc-constraint is defined as a set of two or more maximum delay (minimum anticipation, respectively) constraints which is satisfied when at least one of these delay constraints is so. We prove that solving temporal problems having only -constraints and either only multi-tail or only multi-head hyperarc-constraints lies in and admits deterministic pseudo-polynomial time algorithms; on the other hand, solving temporal problems having only -constraints and either only multi-tail or only multi-head hyperarc-constraints turns out strongly NP-complete. See Table 1 below for a summary.
|Problem||Complexity||Improved Time Bound||Cfr.|
|HyTPs||NP-complete||n.a. (exponential time)||Sect. 5|
Table 1 Summary of main results.
A Simple Temporal Network (STN) is a pair , where is a set of real-valued variables called time-points, and is a set of linear real-weighted binary constraints over called simple (or ) temporal constraints, each having the form:
An STN is consistent if it admits a feasible schedule, i.e., some such that for all . So the Simple Temporal Problem (STP) is that of determining whether a given STN is consistent or not.
Any STN can be seen as a directed weighted graph with vertices and arc set . So, a path in is any finite sequence of vertices (some ) such that for every ; the total weight of is then . A cycle in is any set of arcs cyclically sequenced as where an head equals a tail, i.e., , iff ; it is called a negative cycle if , where stands for . A graph is called conservative when it contains no negative cycle. A schedule is any function . So the reduced weight of an arc with respect to a schedule is defined as . A schedule is feasible iff for every .
It is also worth noticing that, given two feasible schedules of any STN, the pointwise-minimum schedule, is also feasible. Indeed, among all of the possible feasible schedules of a given consistent STN, it is natural to consider the least feasible one; i.e., is the least feasible schedule of STN if is feasible for and, for any other non-negative feasible schedule of , it holds .
Remarkably, finding the least feasible schedule of an STN takes polynomial time .
Theorem 1 ().
Let be an STN. The Bellman-Ford (BF) algorithm (cfr. ) produces in time: either the least feasible schedule , in case is consistent; or a certificate that is inconsistent in the form of a negative cycle. Moreover, if the weights of the arcs are all integers, then the scheduling values of are all integers too.
Concerning the BF algorithm itself, it’s worth considering an improved variant of it that we call the Bellman-Ford Value-Iteration (BF-VI). The basic idea of BF-VI is the same as the original BF algorithm in that each vertex is used as a candidate to relax its adjacent vertices. The improvement is that instead of trying all vertices blindly, BF-VI maintains a queue of candidate vertices and adds a vertex to only if that vertex is relaxed. A candidate vertex is extracted from according to a fixed policy (e.g., LIFO), and then the adjacent vertices of are possibly relaxed as usual and added to (if they are not already in there, no repetitions are allowed). This process repeats until no more vertex can be relaxed.
BF-VI serves us as a basic model, to be leveraged to design faster algorithms for RDTPs.
2.1 Restricted Disjunctive Temporal Problems
A Restricted Disjunctive Temporal Network (RDTN) is a pair , where is a set of time-points and is a set of restricted disjunctive temporal constraints over , each being either one of the following three types:
: , where and ;
: , where and for every ;
: , where and for .
An RDTN is consistent if it admits a feasible schedule, i.e., some satisfying all of the disjunctive temporal constraints in . The Restricted Disjunctive Temporal Problem (RDTP) is that of determining whether a given RDTN is consistent or not.
Notice that -constraints do coincide with simple temporal constraints of STNs.
We assume w.l.o.g. that the disjuncts of any -constraint are arranged in ascending order of the end points of their corresponding intervals, i.e., , whenever ; these natural orderings on the interval domains of the time-points will be referred to as as their nominal ordering. For any , denotes the number of -constraints (i.e., the cardinality of , not the encoding length). Also, for any , denotes the number of disjuncts of , and . Finally, let us fix a total ordering on the time-points, i.e., , this induces an ordering on the pair of disjuncts in any -constraint; so, provided, , for some , then, and are called the first and the second disjunct of (respectively).
2.2 Hyper Temporal Networks
In order to study the tractability frontier of RDTPs, we shall consider the HyTN model which is grounded on directed hypergraphs as defined next.
Definition 3 ().
A directed hypergraph is a pair , where is the set of nodes, and is the set of hyperarcs. Each hyperarc is either multi-head or multi-tail:
A multi-head hyperarc has a distinguished node , called the tail of , and a non-empty set containing the heads of ; to each head , it is associated a weight , which is a real number (unless otherwise specified). Fig. 3 depicts a possible representation of a multi-head hyperarc: the tail is connected to each head by a dashed arc labeled by the name of the hyperarc and the weight associated to the considered head.
A multi-tail hyperarc has a distinguished node , called the head of , and a non-empty set containing the tails of ; to each tail , it is associated a weight , which is a real number (unless otherwise specified). Fig. 3 depicts a possible representation of a multi-tail hyperarc: the head is connected to each tail by a dotted arc labeled by the name of the hyperarc and weights.
The cardinality of a hyperarc is if is multi-head, and if is multi-tail; when , then is a standard arc. The order and size of a directed hypergraph are and (respectively).
Definition 4 (General-HyTN ).
A general-HyTN is a directed hypergraph where each node represents a time-point, and each multi-head/multi-tail hyperarc stands for a set of temporal distance constraints between the tail/head and the heads/tails.
In general-HyTNs, an hyperarc is satisfied when at least one of its distance constraints is satisfied. Then, a HyTN is consistent when it is possible to assign a value to each time-point so that all of its hyperarcs are satisfied. More formally, in the HyTN model the consistency-checking problem is the following decision problem.
Definition 5 (General-HyTP ).
Given a general-HyTN , the General Hyper Temporal Problem (General-HyTP) is that of deciding whether or not there exists a schedule such that, for every hyperarc , the following hold:
if is a standard arc, then: ;
if is a multi-head hyperarc, then: ;
if is a multi-tail hyperarc, then: .
Any such schedule is called feasible. A HyTN that admits at least one feasible schedule is called consistent.
Comparing the consistency of HyTNs with the consistency of STNs, the most important aspect of novelty is that, while in a distance graph of STNs each arc represents a distance constraint and all such constraints have to be satisfied by any feasible schedule, in a HyTN each hyperarc represents a disjunction of one or more distance constraints and a feasible schedule has to satisfy at least one of such distance constraints for each hyperarc.
Let us survey some interesting properties about the consistency-checking problem above. The first one is that any integer-weighted HyTN admits an integer-valued feasible schedule when it is consistent, as stated in the following proposition.
Proposition 1 ().
Let be an integer-weighted***Integer-weighted means that for every and for which is defined. and consistent general-. Then admits an integer feasible schedule , where .
The following theorem states that General-HyTP is NP-complete, in a strong sense.
Theorem 2 ().
General-HyTP is an NP-complete problem even if the input instances are restricted to satisfy and for every .
As observed in , Theorem 2 motivates the study of consistency problems on HyTNs having either only multi-head or only multi-tail hyperarcs. In the former case, the consistency-checking problem is called head-HyTP, while in the latter it is Tail-HyTP; as stated in Theorem 3, the complexity of checking these two problems turns out to be lower than that for DTPs, i.e., both , instead of being NP-complete.
So it’s worth considering the following specialized notion of consistency for HyTNs.
Definition 6 (head-HyTP).
Given a multi-head HyTN , the head-HyTP problem is that of deciding whether or not there exists a schedule such that:
The tightest currently known worst-case time complexity upper-bound for solving (integer-weighted) head-HyTPs was established in  and it is expressed in the following theorem.
Theorem 3 ().
The following proposition holds on (integer-weighted, multi-head) HyTNs. There exists an pseudo-polynomial time algorithm for checking head-HyTP; given any HyTN , if is consistent the same algorithm also returns an integer-valued feasible schedule of ; otherwise, it returns a negative certificate in the form of a negative hypercycle (cfr. Appendix A for more details on that).
Above, is the maximum absolute value among the weights.
Concluding this section we recall that the two problems head-HyTP and Tail-HyTP are actually inter-reducible, i.e., one can check any one of the two models in -time whenever there’s an -time procedure for checking the consistency of the other one.
Theorem 4 ().
head-HyTP and Tail-HyTP are inter-reducible by means of -space, linear-time, local-replacement reductions.
Thus, Theorem 3 extends to multi-tail HyTNs (i.e., they’re checkable in pseudo-poly time).
3 Faster Deterministic Algorithm for DTPs
This section offers a deterministic quadratic time algorithm for solving temporal problems having only -constraints, as defined below.
The same algorithm will be leveraged to solve RDTPs fastly, later on in Section 4.
Any RDTN having is called DTN.
So, DTNs are denoted simply as . The corresponding temporal problem, i.e., DTP, is that of determining whether a given DTN is consistent or not.
One possible solution to DTPs is Kumar’s reduction from RDTPs to CRCs . Our solution, named , employs kind of a value-iteration approach in which all are initially set to zero and then updated monotonically upwards by necessary arc relaxations – this is somehow reminiscent of the BF-VI algorithm for STPs mentioned in Section 2. Indeed, given a DTN , we firstly solve the STP (e.g., with BF-VI). If is consistent, the returned least feasible schedule provides an initial candidate, the next step in mind being that of satisfying all the -constraints. For this, recall that the disjuncts of any are arranged according to their nominal ordering, so that we can try to satisfy any given by iteratively picking the next (i.e., in ascending order) unsatisfied disjunct of and by enforcing its lower-bound constraint in an auxiliary STN as if it were a -constraint. While there’s an unsatisfied -constraint , the current candidate schedule is thus increased by the least necessary amount satisfying both and the whole . It turns out that this can be done efficiently by performing calls to the Dijkstra shortest paths algorithm . In order to show this, let us point out two key facts (i.e., Lemma 1 and 2).
Let be any STN, and let be any pair of schedules of .
Let be the STN reweighted according to the reduced-costs weight transformation (i.e., each weight in is simply replaced by ), let be the same w.r.t. . Let be the length of the shortest path in from any to , and let be the same w.r.t. .
Then for every , either and are both , or the following holds:
Let (arbitrarily), w.l.o.g. is reachable from in (otherwise, and are both ). Consider any path from to in , i.e., for some :
Then, the following holds by telescoping:
Thus, provided is the shortest path distance from to in the original network , we have:
|(by def. of )|
|( is constant here)|
|(by def. of )|
For the same reason, . Therefore,
This concludes the proof. ∎
Let be any STN, and let be the least feasible schedule of . Fix some and some real value . Let be the auxiliary STN obtained by introducing a corresponding lower-bound -constraint over , i.e.,
Let be the STN reweighted according to the reduced-costs weight transformation , and let be the length of the shortest path in from (any) to .
Then, for every , the least feasible schedule of is given by:
Let w.l.o.g. . In order to become feasible for we claim, for every , that the least feasible schedule must be increased by at least time units (because of the lower-bound constraint ). Indeed, for any that reaches in , the -constraint (which is induced by telescoping all of the -constraints along any shortest path from to ) must be satisfied. On the other hand, by Lemma 1 (applied to and to the anywhere-zero†††The anywhere-zero schedule is that defined as, for every . schedule), it holds . This can be seen as follows: if is kept fixed, then can be increased by at most time units without breaking the induced constraint . Here, must be increased by at least time units in order to satisfy , so must be increased by at least the amount said above.
Next, we claim this increase also preserves feasability, i.e., it is the least feasible increase. For ease of notation, let and .
In order to prove that satifies all the constraints in , pick any . By hypothesis, it holds:
For the sake of the argument, let us define: .
So, the following holds:
Then, either one of the following two cases holds:
If , then , so . Therefore,
(by (2)) (by (1))
If , it is easy to check that .
By definition of and since , then . Therefore,
So, in either case, .
Finally, clearly , so is also satisfied.
This proves is a feasible schedule of . All in, it is the least feasible, i.e., . ∎
With this two facts in mind, the description of can now proceed more smoothly.
Recall that, firstly, the STN is checked. If is already inconsistent, so it is ; otherwise, is the least feasible schedule of . So, for every constraint in . Now, for each target node , the Dijkstra algorithm on input computes . The whole distance matrix is computed here, and kept stored in memory. Multiple-sources single-target shortest paths are needed, actually, but these can be easily computed with the traditional Dijkstra’s algorithm, e.g., just reverse the direction of all arcs in the input network and treat the single-target node as if it were a single-source. What follows aims, if there’s still an unsatisfied -constraint , at increasing the candidate schedule by the least necessary amount satisfying both and the whole . So, let us initialize . Then the following iterates.
While some and s.t. doesn’t satisfy :
So, by Lemma 2, the following updating rule:
yelds the least feasible schedule for the next auxiliary STN obtained by adding the new lower-bound -constraint . At each iteration of the while-loop is enriched with an additional lower-bound -constraint as above. So, has time-points ( included) and at most -constraints (one -constraint per is enough, as for each only its greatest lower-bound counts). If the while-loop completes without ever finding to be inconsistent (because, eventually, for some at some point), then the last updating of yelds the least feasible schedule of (as shown below in Theorem 5). This concludes the description of .
Notice that, during the whole computation, the scheduling values can only increase monotonically upwards – like in a value-iteration process.
is correct, i.e., on any input DTN , it returns a feasible schedule , if is consistent; otherwise, it recognizes as inconsistent.
Let be all the iterations of the while-loop of , where is assumed to be the last iteration where the updating is applied.
For every iteration , the auxiliary STN is formally defined as:
where, for all , is the (unique) appearing in some -constraint that is considered at the while-loop’s -th iteration, and is its corresponding lower-bound.
Also, let be the candidate schedule as updated by during the -th iteration.
Concerning actual correctness, firstly, assume that recognizes as inconsistent.
If was already inconsistent (cfr. Theorem 1), so is too. Otherwise, the inconsistency of really holds because of these two facts jointly: (i) the key invariant mentioned above; and, (ii) at the end of the while-loop, it must be