---
title: Allen’s Interval Algebra
url: https://www.emergentmind.com/topics/allen-s-interval-algebra
type: topic
---

# Allen’s Interval Algebra

Allen’s Interval Algebra (IA) is a foundational formalism for qualitative temporal reasoning, offering a principled approach for representing and reasoning about temporal intervals and their possible configurations. Developed by James F. Allen, IA provides a set of 13 mutually exclusive binary relations that capture all possible orderings between two intervals. The algebra serves as a critical substrate for temporal constraint satisfaction, planning, scheduling, natural language understanding, and other domains requiring temporal consistency over infinite domains such as intervals on the rational or real line. 

## 1. Formal Structure and Relations

Let $\mathcal{I}$ denote the set of all closed intervals on the real or rational line, $\mathcal{I} = \{\, [a, b] \mid a, b \in \mathbb{Q} \text{ or } \mathbb{R},\, a < b \,\}$. Each interval $X$ is represented as a pair $(x^-, x^+)$ with $x^- < x^+$.

Between any two intervals $X = (x^-, x^+)$ and $Y = (y^-, y^+)$ exactly one of the following 13 base relations holds:

| Name        | Symbol | Defining Condition(s)                  |
|-------------|--------|----------------------------------------|
| before      | $<$ ($p$)  | $x^+ < y^-$                        |
| after       | $>$ ($\pi$) | $y^+ < x^-$                        |
| meets       | $m$    | $x^+ = y^-$                            |
| met-by      | $mi$   | $y^+ = x^-$                            |
| overlaps    | $o$    | $x^- < y^- < x^+ < y^+$                |
| overlapped-by| $oi$  | $y^- < x^- < y^+ < x^+$                |
| during      | $d$    | $y^- < x^- < x^+ < y^+$                |
| includes    | $di$   | $x^- < y^- < y^+ < x^+$                |
| starts      | $s$    | $x^- = y^- < x^+ < y^+$                |
| started-by  | $si$   | $y^- = x^- < y^+ < x^+$                |
| finishes    | $f$    | $y^- < x^- < x^+ = y^+$                |
| finished-by | $fi$   | $x^- < y^- < x^+ = y^+$                |
| equals      | $=$ ($e$)  | $x^- = y^-,\, x^+ = y^+$           |

Every instance may also specify constraints that are unions of these relation symbols, covering all $2^{13}$ possible binary relations. The algebra is closed under converse and composition operations, with a standard $13 \times 13$ composition table as defined by Allen [2305.15950, 2305.13889, 1909.01128]. 

A qualitative constraint network (QCN) in IA is a set $V$ of variables (intervals) and a set $C$ of constraints $c(X, Y) \subseteq \mathcal{B}$ for certain pairs, asking whether the instance is consistent—that is, whether an assignment of intervals to $V$ exists such that every constraint $c(X, Y)$ is respected.

## 2. Complexity and Algorithms

The core decision problem—determining the consistency of an IA network—is NP-complete [2305.15950, 2305.13889]. This complexity holds even when only unions of the 13 basic relations are allowed as constraints.

### Known Complexity Results

- **Brute-force algorithms** enumerate all total orderings of the $2n$ endpoints, with complexity $O^*((2n)!) = O^*(n^{2n})$.
- **Naïve propagation** may require up to $2^{O(n^2)}$ time.
- **Parameterized perspective**: The MinCSP$(\Gamma)$ for IA, parameterized by the number $k$ of unsatisfied constraints, admits a dichotomy: FPT for certain fragments, W[1]-hard otherwise [2305.13889].
- **Best lower bound**: Only $2^{o(n)}$ under ETH, leaving existence of truly single-exponential algorithms open.

### Advances in Fine-Grained Algorithms

Eriksson & Lagerkvist (2021) achieved the first fine-grained DP, running in $O^*((1.0615n)^{n})$. The latest improvement uses dynamic programming with sublinear partitioning, breaking the “$n^n$” barrier:

$$
O^*\!\left( \left( c\,n/\ln n \right)^{n} \right)
$$

with $c$ an absolute constant [2305.15950]. This approach, as detailed below, yields running times where the per-variable factor $n/\ln n$ is $o(n)$, giving a super-polynomial improvement in $n$.

## 3. Dynamic Programming with Sublinear Partitioning

The main conceptual advance is to encode partial orderings not as linear arrangements of all placed endpoints, but as partitions into “blocks”, each augmented with flags indicating if new points may be introduced ("open") or not ("closed”). A *record* is a tuple

$$
r = (S,\, (S_1, B_1), (S_2,B_2),\dotsc, (S_m, B_m))
$$

where $S$ is the set of endpoints already placed, $\{ S_i \}$ is a partition of $S$, and $B_i$ is a $0/1$ flag for openness.

Key technical aspects:

- New interval starts are placed in block 2; ends go to block $j \geq 2$ (if block $j$ is open).
- Generalization (merging blocks, adjusting flags) manages combinatorial blow-up.
- For $k$ interval pairs remaining, at most $4k+1$ blocks are required.
- The DP iterates over possible extensions, closing block-runs as needed, and generates all possible generalizations of updated records efficiently.

The resulting recurrence for the number of records leads to the $O^*((c\,n/\ln n)^{n})$ bound. Each record requires only polynomial time per step, and generates $O^*(3^m)$ generalizations, where $m$ is number of blocks.

Proof sketch of correctness shows that every satisfying model corresponds to a series of record transitions, and vice versa. The block bound ensures tractability throughout the search space [2305.15950].

## 4. Parameterized and Approximation Complexity

From the parameterized complexity viewpoint, the MinCSP framework for IA ($\operatorname{MinCSP}(\Gamma)$) studies whether deleting up to $k$ constraints can render an instance satisfiable. The results, presented in [2305.13889], provide the following dichotomy:

- FPT (fixed-parameter tractable) for $\Gamma \subseteq \{ m,p \}$ or $\Gamma \subseteq \{r_1, r_2, =\}$ with $r_1 \in \{s, f\}$ and $r_2 \in \{p,o,d\}$.
- W[1]-hard otherwise, established through reductions from Paired Cut and Simultaneous Feedback Arc Set.

Additionally, although MinCSP($\mathcal{A}$) is NP-hard to approximate within any constant (assuming UGC), it is FPT-approximable within factor 2 in $O^*(2^{O(k^3)})$ time, and within factor 4 in $O^*(2^{O(k)})$ time via reduction to Subset Directed Feedback Arc Set [2305.13889].

## 5. Practical Encodings and Experiments

Allen’s Interval Algebra is naturally encoded in answer-set programming extended by difference logic (ASP(DL)). For each variable $X$, integer variables $sp(X)$ and $ep(X)$ denote its start and end, with basic constraints as rules linking $sp(X)$ and $ep(Y)$ according to the semantics of each IA relation [1909.01128].

For example, the precedes relation $p$ corresponds to $ep(X) < sp(Y)$, encoded in ASP(DL) as

```prolog
&diff { ep(X) - sp(Y) } <= -1 :- chosen(X,Y,p).
```

Preliminary experiments show that such ASP(DL) encodings are robust and scalable: for random instances with $n=100$ variables, backbone computation and satisfiability checking were feasible within a few minutes for the majority of cases. Only about 10% of hard instances hit a 300s timeout, a marked improvement over pure-ASP encodings, which timeout at $n \approx 50$. Equivalent checks with specialized QSTR solvers (e.g., GQR) are faster for satisfiability, though less flexible for backbone or minimum-labeling tasks [1909.01128].

## 6. Generalizations and Extensions

The sublinear-partitioning technique generalizes to other qualitative calculi. For the Cardinal Direction Point Algebra (CDPA), which seeks two total orderings for $n$ points in two dimensions consistent with binary constraints on allowed $(\odot_x, \odot_y)$ relations, the algorithm achieves $O^*((c\,n/\ln n)^{2n/3})$ running time [2305.15950]. This exploits a geometric lemma bounding the necessary size of partial orderings.

Potential extensions include further qualitative spatial calculi (e.g., RCC-8) and certain CSPs over infinite domains that admit similar partial ordering encodings.

## 7. Applications and Open Problems

Allen’s algebra pervades applications in AI planning, scheduling, NLP, and bioinformatics, underpinning the consistency and repair of temporal networks. Parameterized and approximation algorithms allow “repairing” up to $k$ errors or inconsistencies efficiently, critical in modelling noisy sensor data or resolving conflicts in temporal narratives [2305.13889].

Significant open questions include:

- Explicit determination of the constant $c$ in the current $O^*((c\,n/\ln n)^{n})$ bound.
- Elimination or relaxation of the left-heaviness restriction in block partitioning.
- Development of truly single-exponential ($O^*(c^n)$) algorithms for general IA or CDPA.
- Applicability of sublinear partitioning to further NP-hard qualitative calculi and infinite-domain CSPs.

Dynamic programming with sublinear partitioning constitutes a major theoretical advance, sharply reducing asymptotic complexity and informing the design of temporal reasoning tools in practice [2305.15950, 2305.13889, 1909.01128].

Source: https://www.emergentmind.com/topics/allen-s-interval-algebra