Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning

16
Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning Weiming Liu and Sanjiang Li Centre for Quantum Computation and Intelligent Systems, Faculty of Engineering and Information Technology, University of Technology Sydney, Australia Abstract. The minimal label problem (MLP) (also known as the deductive clo- sure problem) is a fundamental problem in qualitative spatial and temporal rea- soning (QSTR). Given a qualitative constraint network Γ , the minimal network of Γ relates each pair of variables (x, y) by the minimal label of (x, y), which is the minimal relation between x, y that is entailed by network Γ . It is well-known that MLP is equivalent to the corresponding consistency problem with respect to polynomial Turing-reductions. This paper further shows, for several qualitative calculi including Interval Algebra and RCC-8 algebra, that deciding the mini- mality of qualitative constraint networks and computing a solution of a minimal constraint network are both NP-hard problems. 1 Introduction Spatial and temporal information is pervasive and increasingly involved in both industry and everyday life. Many tasks in real or virtual world demand sophisticated spatial and temporal reasoning systems. The qualitative approach to spatial and temporal reasoning (QSTR) provides a promising framework and has boosted research and applications in areas such as natural language processing, geographical information systems, robotics, content-based image retrieval (see e.g. [5]). Concentrating on different aspects of the space and/or time, dozens of qualitative re- lation models have been proposed, which are called qualitative calculi in QSTR. While Point Algebra [2] and Interval Algebra [1] are two most popular qualitative temporal calculi, the Cardinal Relation Algebra [13] and the RCC-8 algebra [18] are two popular qualitative spatial calculi which model directional and, respectively, topological spatial information. Roughly speaking, a qualitative calculus has a fixed (usually infinite) uni- verse of entities (e.g., temporal points in the real line) and uses a finite vocabulary (viz., basic relations, e.g., <, > and =) to model the relationship between the entities. In a qualitative calculus, basic relations are used to represent the knowledge of which we are certain, while non-basic relations (e.g., , ) are used for uncertain knowledge. In QSTR, spatial or temporal information is usually represented in terms of basic or non-basic relations in a qualitative calculus, and reasoning tasks are formulated as solving a set of qualitative constraints (called a qualitative constraint network). A qual- itative constraint is a formula of the form xRy, which asserts that variables x and y should be interpreted by two entities in the universe such that relation R holds between them, where R could be a basic or non-basic relation. The consistency problem is to M. Milano (Ed.): CP 2012, LNCS 7514, pp. 464–479, 2012. c Springer-Verlag Berlin Heidelberg 2012

Transcript of Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning

Solving Minimal Constraint Networksin Qualitative Spatial and Temporal Reasoning

Weiming Liu and Sanjiang Li

Centre for Quantum Computation and Intelligent Systems, Faculty of Engineering andInformation Technology, University of Technology Sydney, Australia

Abstract. The minimal label problem (MLP) (also known as the deductive clo-sure problem) is a fundamental problem in qualitative spatial and temporal rea-soning (QSTR). Given a qualitative constraint network Γ , the minimal networkof Γ relates each pair of variables (x, y) by the minimal label of (x, y), which isthe minimal relation between x, y that is entailed by network Γ . It is well-knownthat MLP is equivalent to the corresponding consistency problem with respect topolynomial Turing-reductions. This paper further shows, for several qualitativecalculi including Interval Algebra and RCC-8 algebra, that deciding the mini-mality of qualitative constraint networks and computing a solution of a minimalconstraint network are both NP-hard problems.

1 Introduction

Spatial and temporal information is pervasive and increasingly involved in both industryand everyday life. Many tasks in real or virtual world demand sophisticated spatial andtemporal reasoning systems. The qualitative approach to spatial and temporal reasoning(QSTR) provides a promising framework and has boosted research and applications inareas such as natural language processing, geographical information systems, robotics,content-based image retrieval (see e.g. [5]).

Concentrating on different aspects of the space and/or time, dozens of qualitative re-lation models have been proposed, which are called qualitative calculi in QSTR. WhilePoint Algebra [2] and Interval Algebra [1] are two most popular qualitative temporalcalculi, the Cardinal Relation Algebra [13] and the RCC-8 algebra [18] are two popularqualitative spatial calculi which model directional and, respectively, topological spatialinformation. Roughly speaking, a qualitative calculus has a fixed (usually infinite) uni-verse of entities (e.g., temporal points in the real line) and uses a finite vocabulary (viz.,basic relations, e.g., <,> and =) to model the relationship between the entities. In aqualitative calculus, basic relations are used to represent the knowledge of which weare certain, while non-basic relations (e.g., ≤,≥) are used for uncertain knowledge.

In QSTR, spatial or temporal information is usually represented in terms of basicor non-basic relations in a qualitative calculus, and reasoning tasks are formulated assolving a set of qualitative constraints (called a qualitative constraint network). A qual-itative constraint is a formula of the form xRy, which asserts that variables x and yshould be interpreted by two entities in the universe such that relation R holds betweenthem, where R could be a basic or non-basic relation. The consistency problem is to

M. Milano (Ed.): CP 2012, LNCS 7514, pp. 464–479, 2012.c© Springer-Verlag Berlin Heidelberg 2012

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 465

decide whether a set of constraints can be satisfied simultaneously, i.e., whether thereis an interpretation of all the variables such that the constraints are all satisfied by thisinterpretation. Note that the universe of a qualitative calculus is usually infinite, whichimplies that the general techniques developed in the community of classical CSP canhardly be applied directly. Even though, researches have successfully solved the consis-tency problem in a number of qualitative calculi including Point Algebra [2], IntervalAlgebra [1,17] and the RCC-8 algebra [19].

The minimal label problem (MLP) (also known as the deductive closure problem) isanother fundamental problem in QSTR, which is equivalent to the corresponding con-sistency problem with respect to polynomial Turing-reductions. A qualitative constraintnetwork Γ is called minimal if for each constraint, say xRy, R is the minimal label of(x, y), i.e., R is the minimal relation between x, y that is entailed by Γ .

Since its introduction in 1974, minimal constraint network [16] has drawn attentionfrom both classical CSP (see [10] and references therein) and QSTR [4,9] researchers.In a recent paper [10], Gottlob proved that, in classical CSP, it is NP-hard to com-pute a solution of a minimal constraint network, which confirms a conjecture proposedby Dechter [6]. Inspired by this work, we investigate the same problem for minimalconstraint networks in the context of QSTR. For partially ordered Point Algebra (inwhich two points can be incomparable), Interval Algebra, Cardinal Relation Algebra,and RCC-8 algebra, we find that deciding the minimality of constraint networks is ingeneral NP-hard. Furthermore, we prove that it is also NP-hard to compute solutionsof minimal RCC-8 constraint networks, though it was assumed in [4] that this can beeasily accomplished. In fact, for all qualitative calculi mentioned above, it is NP-hardto compute even a single solution of a minimal constraint network.

The remainder of this paper proceeds as follows. Section 2 introduces basic notionsas well as the qualitative calculi discussed in this paper. Section 3 shows that computinga solution of a minimal constraint network in partially ordered Point Algebra and RCC-8 algebra is NP-hard, while Section 4 proves the same result for Cardinal RelationAlgebra and Interval Algebra. The last section concludes the paper.

2 Preliminaries

In this section, we introduce basic notions in qualitative constraint solving and the fourimportant qualitative calculi to be discussed later.

2.1 Qualitative Calculi

QSTR is mainly based on qualitative calculi. Suppose U is the universe of spatial ortemporal entities. Write Rel(U) for the Boolean algebra of binary relations on U . Bi-nary qualitative calculi (cf. e.g.[14]) on U are finite Boolean subalgebras of Rel(U).Note that M contains the universal relation (denoted by ?) which is defined as U × U .

Let M be a qualitative calculus on U . We call a relation α in M a basic relationif it is an atom in M. The converse of a binary relation α, denoted by α∼, is definedas α∼ = {(x, y) : (y, x) ∈ α}. We next recall the well-known Point Algebra (PA)[20,2,3], Cardinal Relation Algebra (CRA) [8,13], Interval Algebra (IA) [1], and RCC-8 algebra [18], which are all closed under converse.

466 W. Liu and S. Li

Definition 1 (partially ordered Point Algebra [3]). Let (U,≥) be a partial order. Thefollowing three relations on U (where a � b denotes that (a, b) is not in relation ≥),

> = {(a, b) ∈ U × U : a ≥ b, b � a},< = {(a, b) ∈ U × U : a � b, b ≥ a},|| = {(a, b) ∈ U × U : a � b, b � a},

together with the identity relation =, are a jointly exhaustive and pairwise disjoint(JEPD) set of binary relations on U . The Point Algebra is the Boolean subalgebragenerated by {<,>,=, ||}.

The following definition is a special case where ≥ is a total order.

Definition 2 (totally ordered Point Algebra [20]). Let (U,≥) be a totally ordered set.The (totally ordered) Point Algebra is the Boolean subalgebra generated by the JEPDset of relations {<,>,=}, where <,>,= are defined as in Definition 1.

Note that there are eight relations for totally ordered Point Algebra, viz. the three basicrelations <,>,=, the empty relation, and the four non-basic nonempty relations ≤,≥, �=, ?, where ? is the universal relation.

Definition 3 (Cardinal Relation Algebra [8,13]). Let U be the real plane. The Cardi-nal Relation Algebra (CRA) is generated by the nine JEPD relations NW,N,NE,W ,EQ,E, SW, S, SE defined in Table 1 (a).

Table 1. (a) Definitions of basic CRA relations between points (x, y) and (x′, y′) (b) Illustra-tions of CRA relations, where P1 NW Q and P2 E Q

Relation Converse DefinitionNW SE x < x′, y > y′

N S x = x′, y > y′

NE SW x > x′, y > y′

W E x < x′, y = y′

EQ EQ x = x′, y = y′

(a) (b)

The Cardinal Relation Algebra can be viewed as the Cartesian product of two totallyordered Point Algebras (with R as their domains).

Definition 4 (Interval Algebra [1]). Let U be the set of closed intervals on the realline. Thirteen binary relations between two intervals x = [x−, x+] and y = [y−, y+]

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 467

Table 2. Basic IA relations and their converses between intervals [x−, x+] and [y−, y+]

Relation Symbol Converse Meaningbefore p pi x− < x+ < y− < y+

meets m mi x− < x+ = y− < y+

overlaps o oi x− < y− < x+ < y+

starts s si x− = y− < x+ < y+

during d di y− < x− < x+ < y+

finishes f fi y− < x− < x+ = y+

equals eq eq x− = y− < x+ = y+

are defined by the order of the four endpoints of x and y (see below). The IntervalAlgebra is generated by these JEPD relations.

Definition 5 (RCC-8 Algebra[18]1). Let U be the set of nonempty regular closed setson the real plane. The RCC-8 algebra is generated by the eight topological relations

DC,EC,PO,EQ,TPP,NTPP,TPP∼,NTPP∼,

where EQ,DC,EC,PO,TPP and NTPP are defined as in Table 5, and TPP∼

and NTPP∼ are the converses of TPP and NTPP respectively.

Table 3. Definitions for basic RCC-8 relations between plane regions a and b, where a◦, b◦ arethe interiors of a, b respectively

Relation Meaning Relation Meaning Relation MeaningEQ a = b EC a ∩ b �= ∅, a◦ ∩ b◦ = ∅ TPP a ⊂ b, a �⊂ b◦

DC a ∩ b = ∅ PO a �⊆ b, b �⊆ a, a◦ ∩ b◦ �= ∅ NTPP a ⊂ b◦

Illustrations for basic RCC-8 relations are provided in Figure 2.1. Note that regionsin general may have multiple pieces or holes.

Fig. 1. Illustration for basic RCC-8 relations

1 We note that the RCC algebras have interpretations in arbitrary topological spaces. In thispaper, we only consider the interpretation in the real plane.

468 W. Liu and S. Li

2.2 Constraint Networks and Minimal Networks

A qualitative calculus M provides a constraint language by using formulas of the formviαvj , where vi, vj are variables and α is a relation in M. Formulas of the form viαvjare called constraints (in M). If α is a basic relation in M, viαvj is called a basicconstraint. The consistency problem over M can then be formulated as below.

Definition 6. [5] Let M be a qualitative calculus on universe U , and S be a subset ofM. The consistency problem CSPSAT(S) (in qualitative calculus M) is defined as:

Instance: A 2-tuple (V, Γ ). Here V is a finite set of variables {v1, · · · , vn}, and Γis a finite set of binary constraints of the form xαy, where α ∈ S and x, y ∈ V . 2

Question: Is there an assignment ν : V → U s.t. all constraints in Γ are satisfied?

If an assignment ν satisfies all constraints in Γ , we say ν is a solution of Γ and Γ issatisfiable or consistent.

Note that Point Algebras rely on the underlying (partial or total) orders. Consequently,the consistency of an instance in PA depends on both the underlying (partial or total)order and the constraint network. However, we are usually more interested in the con-straint network than in the particular underlying structure. Meanwhile, for the totallyordered Point Algebra, it is clear that if an instance is consistent in some Point Algebra,then it is also consistent in the PA generated by the total order (R,≤), i.e., any finitetotal order can be embedded into (R,≤). Therefore, we fix the underlying total order as(R,≤) for all totally ordered PA constraint networks. Similarly, we fix the underlyingpartial order for partially ordered PA as (N+,�), where a � b if there is an integer ksuch that a = bk, as any finite partial order can be embedded into (N+,�).

The consistency problem as defined in Dfn. 6 has been investigated for many dif-ferent qualitative calculi (see e.g. [1,2,17,19,15,3]). In particular it is shown in [2] thatthe consistency problem for the totally ordered Point Algebra can be solved in O(n2),where n is the number of variables. For most other qualitative calculi including thepartially ordered PA, IA, CRA, and RCC-8, the consistency problems are NP-hard.Nonetheless, researchers have proved that the consistency problems CSPSAT(S) aretractable for some subsets S in the qualitative calculi. Such a set S is called a tractablesubclass. A tractable subclass is called maximal if it has no proper superset which istractable. Maximal subclasses of IA and RCC-8 have been identified, see [17,7,19].

A set of constraints Γ is called a basic constraint network if Γ contains exactly onebasic constraint for each pair of variables. When only basic constraint networks areconsidered, the consistency problems of all qualitative calculi mentioned in Section 2can be decided in O(n3) time by enforcing path-consistency (cf. [12]).

Definition 7 (refinement, scenario). Let M be a qualitative calculus. Suppose (V, Γ )and (V, Γ ′) are two constraint networks over the same variable set V in M, whereΓ = {viαijvj}ni,j=1 and Γ ′ = {viβijvj}ni,j=1. We say (V, Γ ′) is a refinement of (V, Γ ),if for any 1 ≤ i, j ≤ n it holds that βij ⊆ αij . We say (V, Γ ′) is a scenario of (V, Γ ) ifit is a basic constraint network.

2 We may simply denote the instance by Γ when V is clear or less important.

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 469

A refinement of a constraint network is a network with stronger constraints. Scenar-ios are the finest refinements. It is clear that a constraint network is consistent iff it has aconsistent scenario. As we have mentioned, for all qualitative calculi considered in thispaper, the consistency of a scenario can be determined by checking path-consistency.

Next we introduce the concept of minimal network (cf. [16]).

Definition 8 (minimal network). Let Γ = {viαijvj}ni,j=1 be a constraint network inqualitative calculus M. We say Γ is minimal, if for any 1 ≤ i, j ≤ n and any basicrelation b ⊆ αij in M, the refinement of Γ obtained by refining αij to b is consistent.

There are two important problems regarding minimal networks. First, how to decidewhether a network is minimal and how to compute the equivalent minimal network(i.e., the minimal constraint network with the same solution set). Second, how to getone (or all) solution(s) of a minimal constraint network. In what follows, we call theproblem of deciding whether a constraint network in qualitative calculus M is minimalthe minimality problem in M.

For the minimality problem, we note that the problem can be decided in polynomialtime for tractable subclasses, as we only need to check the consistency of at most n2Bnetworks, where n is the number of variables and B is the number of basic relations.Meanwhile, if the equivalent minimal network of an input network can be computed inpolynomial time, then the minimality problem is also tractable (we may simply com-pare a network to its equivalent minimal network). In this sense, the minimality problemis simpler than the consistency problem and the problem of computing equivalent net-work, which are both known to be NP-hard in general. However, it is not clear beforethis paper whether a polynomial algorithm exists for the minimality problem. This paperproves that the problem is NP-hard for all qualitative calculi introduced above exceptthe totally ordered Point Algebra.

The main interest of this paper is the second problem. We prove that, for all qualita-tive calculi mentioned above except the totally ordered Point Algebra, it is also NP-hardto compute a single solution of a minimal constraint network.3 We do not distinguishthe semantic difference between ‘computing a solution’ and ‘computing a consistentscenario’. This is because, on one hand, polynomial algorithms to construct solutionsfor consistent scenarios have been proposed for all qualitative calculi discussed in thispaper (see e.g.[11]); and on the other hand, a consistent scenario can always be com-puted in polynomial time from a solution.

A strategy has been introduced in [10] to prove the NP-hardness of computing asolution of a minimal constraint network in classical CSP. We use the same strategy inQSTR. The general framework is as follows, where M is a qualitative calculus in whichthe consistency of any basic network (scenario) can be decided in polynomial time.

– Construct a polynomial reduction R from an NP-hard problem N (variants of theSAT problem in this paper) to the consistency problem CSPSAT(M) for M.

– Show any CSPSAT(M) instance generated by R is either inconsistent or minimal.

3 Note that computing a solution of a constraint network is not a decision problem (i.e., prob-lem with answer either ‘yes’ or ‘no’). So the ‘NP-hardness’ here means that, if we have apolynomial algorithm that computes a solution of a minimal network, then we can provide apolynomial algorithm that solves an NP-complete problem [10].

470 W. Liu and S. Li

We claim that the existence of such a reductionR implies the NP-hardness of computinga solution of a minimal constraint network in M. This is because, if some polynomialalgorithm A is able to compute a solution (or a consistent scenario) of a minimal con-straint network with upper bounding time p(x) (x is the size of input instance), then thefollowing polynomial algorithm A∗ would solve the NP-hard problem N , where i is aninstance of N .

– Compute the CSPSAT(M) instance R(i) by the reduction R.– Call Algorithm A with input R(i).– If A does not halt in p(size(R(i))) time, return ‘No’.– Verify whether the output of A is a solution of R(i). If not, return ‘No’.– Return ‘Yes’.

Because the consistency of any scenario in M can be determined in polynomial time,we knowA∗ is a polynomial algorithm. We next show that AlgorithmA∗ is sound. First,suppose i is a positive instance of N . Then R(i) is a minimal constraint network by theassumption of R. So Algorithm A should return a solution of R(i) in p(size(R(i)))time, and thus A∗ returns the correct output ‘Yes’. Second, suppose i is a negativeinstance of N , in which case R(i) is inconsistent, and Algorithm A gets an invalidinput. So Algorithm A may either not halt in p(size(R(i))) time, or halt with someoutput which is not a solution of R(i) (as R(i) is inconsistent). In both cases, AlgorithmA∗ returns ‘No’. Therefore, A∗ is sound and we conclude that computing a solution ofa minimal network in qualitative calculus M is NP-hard.

Note that the reduction R above (if it exists) is also a polynomial reduction from theNP-hard problemN to the minimality problem in M. Therefore the existence of R alsoimplies the NP-hardness of the minimality problem in M.

Theorem 1. Let M be a qualitative calculus in which the consistency of basic networkscan be decided in polynomial time. Suppose there exists a polynomial reduction R froman NP-hard problem to the consistency problem in M such that any CSPSAT(M) in-stance generated by R is either inconsistent or minimal. Then the minimality problemin M is NP-complete. Furthermore, it is also NP-complete to compute a solution of aminimal constraint network in M.

2.3 Variants of the SAT Problem

The NP-hardness results provided in the following sections are achieved by polyno-mial reductions from special variants of the SAT problem introduced below. Note thatDefinition 9 is original while Definition 10 comes from [10].

Definition 9 (symmetric SAT). We say a SAT instance φ is symmetric, if for any truthvalue assignment ν : Var(φ) → {true, false}, ν satisfies φ iff ν satisfies φ, where ν isdefined by ν(p) = true if ν(p) = false, and ν(p) = false if ν(p) = true, for p ∈ Var(φ).

It is clear that any unsatisfiable SAT instance is a symmetric instance.

Lemma 1. There exists a polynomial-time transformation that transforms each SATinstance φ into a symmetric instance φ′, such that φ is satisfiable iff φ′ is satisfiable.

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 471

Proof. Suppose φ =∧m

j=1 cj is a SAT instance with propositional variables Var(φ) =

{p1, p2, · · · , pn} and clauses cj =∨tj

k=1 lj,k, where lj,k are literals. For a literal l,its negation, denoted by l, is defined to be ¬pi if l = pi, or pi if l = ¬pi. Definecj =

∨tjk=1 lj,k. Clearly, a truth value assignment ν satisfies cj iff ν satisfies cj .

Now we define a SAT instance φ′ with Var(φ′) = Var(φ) ∪ {q} and 2m clauses,

φ′ =m∧

i=1

(ci ∨ q) ∧m∧

i=1

(ci ∨ ¬q).

It is straightforward to verify that φ is satisfiable iff φ′ is satisfiable. � Gottlob introduced the following concept of k-supersymmetry of SAT instances (k ≥ 1)and proved that any SAT instance can be transformed into a k-supersymmetric instancewhile preserving its satisfiability.

Definition 10 (k-supersymmetric SAT, [10]). Let φ be a SAT instance. We say φ is k-supersymmetric, if either it is unsatisfiable, or for any set of k propositional variablesVk ⊆ Var(φ), and any partial truth value assignment ν to Vk , there is an extension of νwhich satisfies φ.

Lemma 2 ([10]). For each fixed integer k ≥ 1, there exists a polynomial-time trans-formation that transforms a SAT instance φ into a k-supersymmetric instance φk , suchthat φ is satisfiable iff φk is satisfiable.

It is clear that a symmetric SAT instance is also 1-supersymmetric and a (k + 1)-supersymmetric instance is also k-supersymmetric. The following lemma synthesizesLemmas 1 and 2.

Lemma 3. For each fixed integer k ≥ 1, there exists a polynomial-time transformationthat transforms a SAT instance φ into a symmetric and k-supersymmetric instance φ∗,such that φ is satisfiable iff φ∗ is satisfiable.

Proof. We first transform φ into a symmetric SAT instance φ′ by Lemma 1, then trans-form φ′ into a k-supersymmetric instance φ∗ using the second transformation describedin [10, Lemma 2]. It can be straightforwardly verified that this transformation preservessymmetry. Therefore φ∗ is symmetric and k-supersymmetric. This procedure is poly-nomial as both of the two transformations are polynomial. �

3 Partially Ordered Point Algebra and RCC-8

We first prove that computing a solution of a minimal constraint network in partiallyordered Point Algebra is NP-hard. We achieve this by devising a reduction from thesymmetric and 3-supersymmetric SAT problem to the consistency problem in partiallyordered PA. Let φ =

∧mj=1 cj be a symmetric and 3-supersymmetric SAT instance

with Var(φ) = {p1, p2, · · · , pn} and clauses cj =∨tj

k=1 lj,k. We construct a constraintnetwork (Vφ, Γφ) in partially ordered PA.

472 W. Liu and S. Li

The variable set is Vφ = V0 ∪ V1 ∪ · · · ∪ Vm, where V0 = {xi, yi : 1 ≤ i ≤ n} andVj = {wj,k : 1 ≤ k ≤ tj}. The constraints in Γφ are as follows, where wj,tj+1 = wj,1.

– For xi, yi ∈ V0, xi {<,>} yi,– For k �= k′, wj,k {<,>} wj,k′ ,– If lj,k = pi, then xi {<,>} wj,k+1, yi {<,>} wj,k, xi || wj,k, yi || wj,k+1,– If lj,k = ¬pi, then xi {<,>} wj,k, yi {<,>} wj,k+1, xi || wj,k+1, yi || wj,k,– For j �= j′ and any w ∈ Vj , w

′ ∈ Vj′ , w || w′,– For any other pair of variables (u, v) ∈ Vφ, u {<,>, ||} v.

We next provide a brief explanation. We use variables xi, yi ∈ V0 to simulate propo-sitional variable pi. The case that xi < yi (xi > yi, resp.) corresponds to pi beingassigned true (false, resp.). Variables in Vj simulate clause cj in φ, where the rela-tionship (< or >) between wj,k and wj,k+1 corresponds to literal lj,k in cj . Supposelj,k ∈ {pi,¬pi}. Then the constraints between xi, yi, wj,k, wj,k+1 as specified aboveestablish the connection between the relation of xi and yi and that of wj,k and wj,k+1,which simulates the dependency of lj,k on pi. In detail, if lj,k = pi (¬pi, resp.), thenthe relation between wj,k and wj,k+1 should be the same as (opposite to, resp.) thatbetween xi and yi. For example, if lj,k = pi, then xi < yi implies xi < wj,k+1 (other-wise, we shall have wj,k+1 < xi < yi and yi ||wj,k+1, which is inconsistent). Similarlywe have yi > wj,k and wj,k < wj,k+1 in such case. See Figure 2 for illustration. Bythese constraints, we relate the case wj,k < wj,k+1 (wj,k > wj,k+1, resp.) to that lj,kbeing assigned true (false, resp.).

(a) constraints (b) a partial solution

Fig. 2. Passing the relation between xi and yi to that between wj,k and wj,k+1

Clause cj rules out the assignments that assign all the literals lj,k false. Because φis a symmetric SAT instance, any assignment ν that assigns all literals lj,k true wouldalso falsify φ (otherwise, φ should also be satisfied by ν, which fails to satisfy cj).Correspondingly, (Vφ, Γφ) is inconsistent if wj,1 > wj,2 > · · · > wj,tj > wj,1 orwj,1 < wj,2 < · · · < wj,tj < wj,1. Note that we only constrain variables in Vj byenforcing a total order and propagating the configuration of V0 to them. In summary,by introducing of variables in Vj (and related constraints), we forbid two certain kindsof configurations of V0, which respectively correspond to assignments of Var(φ) thatassign all literals in cj true or false.

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 473

Proposition 1. Let φ be a symmetric SAT instance, and (Vφ, Γφ) be the constraint net-work as constructed above. Then φ is satisfiable iff (Vφ, Γφ) has a consistent scenario.

Proof (sketch). Suppose φ is satisfiable and ν : Var(φ) → {true, false} is a truth valueassignment that satisfies φ. We construct a consistent scenario for (Vφ, Γφ).

The constraints between variables in V0 are as follows, see Figure 3 for illustration.

– If ν(pi) = true, then xi < yi; otherwise xi > yi,– Let bigi (smalli resp.) be the big one (small one resp.) in {xi, yi}. Then for i �= i′,

bigi || bigi′ , smalli || smalli′ , smalli < bigi′ .

Fig. 3. Constraints between variables in V0 in the scenario, where {bigi, smalli} = {xi, yi}

Assume lj,k ∈ {pi,¬pi}. The constraints between xi, yi, wj,k and wj,k+1 are de-cided by the constraint between xi and yi, as we have explained before the proof. Thescenario should provide a total order on Vj consistent to the determined orders of wj,k

and wj,k+1. Such a total order always exists, because the determined orders contain nocircles (due to the fact that ν satisfies clause cj). Pick arbitrary one if such total ordersare not unique.

It remains to refine constraints of the form u {<,>, ||} v, where u ∈ V0 and v ∈ Vj

for some j. Part of these constraints need to be refined to < (or >) due to the transitivityof < (or >). The rest are refined to ||.

We now get a scenario, the consistency of which can be verified by checking itspath-consistency. We omit the details here.

Now suppose (Vφ, Γφ) has a consistent scenario. We define a truth value assignmentν by ν(pi) = true if xi < yi in the scenario, or ν(pi) = false otherwise. For each clausecj in φ, it can be checked that ν satisfies cj because the constraints about variables inVj in the scenario are consistent. Therefore, φ is satisfiable. � The PA network (Vφ, Γφ) in the reduction above has 2n + T variables, where n =|Var(φ)|, and T = t1 + t2 + · · · + tm is the number of all literals in the SAT in-stance. Therefore the reduction is polynomial. We next prove, by exploiting the 3-supersymmetry of the SAT instance φ, that (Vφ, Γφ) is minimal if φ is satisfiable.

Proposition 2. Suppose φ is a symmetric and 3-supersymmetric SAT instance. Let(Vφ, Γφ) be the constraint network as constructed above. If φ is satisfiable, then (Vφ, Γφ)is a minimal constraint network.

474 W. Liu and S. Li

Proof (sketch). First note that (Vφ, Γφ) contains three forms of constraints, viz. u || v,u{<,>}v and u{<,>, ||}v. We aim to show the latter two forms of non-basic con-straints can be refined to any basic constraint without violating the consistency. Wehave proved that (Vφ, Γφ) has a consistent scenario, say, (Vφ, Γ0). Let (Vφ, Γ1) be thescenario of (Vφ, Γφ) which refines non-basic constraints in the opposite way, i.e.,

– Constraint u{<,>}v is refined to u < v (u > v resp.) if it is refined to u > v(u < v resp.) in Γ0.

– Constraint u{<,>, ||}v is refined to u < v (u > v, u || v resp.) if it is refined tou > v (u < v, u || v resp.) in Γ0.

It can be proved that scenario (Vφ, Γ1) is path-consistent (otherwise (Vφ, Γ0) would notbe path-consistent) and hence consistent.

Now we need only to show that constraint u{<,>, ||}v in (Vφ, Γφ) can be refined toany of u < v, u > v and u || v. There are only two possible cases of such u and v:

– u ∈ {xi, yi} and v ∈ {xi′ , yi′} for some i �= i′.– u ∈ {xi, yi} and v = wj,k for some i, j, k such that lj,k, lj,k+1 �∈ {pi,¬pi}.

For the first case, w.l.o.g., we may suppose u = xi and v = xi′ . Because φ is 3-supersymmetric and hence 2-supersymmetric, there exists a truth value assignment νwhich satisfies φ and ν(pi) = true, ν(pi′) = true. So we may get a consistent scenarioof (Vφ, Γφ) as in the proof of Proposition 1 according to ν. In this scenario, we havexi < yi, xi′ < yi′ and xi || xi′ . Therefore, there exists a consistent scenario of (Vφ, Γφ)in which xi || xi′ . Similarly, we may obtain consistent scenarios in which xi < xi′ orxi > xi′ , by other truth value assignments on pi and pi′ .

The second case is slightly complicated and is briefly described here. W.o.l.g., sup-pose we want to refine constraint xi{<,>, ||}wj,k to xi < wj,k, xi > wj,k andxi || wj,k respectively. For xi < wj,k, we need an assignment ν which satisfies φ andν(pi) = true, ν(lj,k−1) = true and ν(lj,k) = false. Such assignment ν exists as φ is 3-supersymmetric. We are able to get a scenario as in the proof of Proposition 1 in whichwe further require wj,k to be the maximal element in Vj (note wj,k > wj,k−1, wj,k+1 asν(lj,k−1) = true and ν(lj,k) = false). In this scenario either xi < wj,k or xi || wj,k. Inthe latter case, we replace it with xi < wj,k, which does not jeopardize the consistencyas xi is in the smaller part of V0 and wj,k is the maximal element in Vj . So we geta consistent scenario in which xi < wj,k . The other two cases are similar, where forxi > wj,k we need ν(pi) = false and wj,k to be the minimal element in Vj , and forxi || wj,k we need ν(pi) = true and wj,k to be the minimal element. � Now we have the following conclusion for partially ordered Point Algebra.

Theorem 2. Computing a solution of a minimal network in partially ordered PointAlgebra is NP-complete.

Proof. By Propositions 1, 2 and Theorem 1, we know that computing a solution (ora consistent scenario) of a minimal network in partially ordered PA is NP-hard. Theproblem is in NP as we may guess a consistent scenario by indeterminism. � The above technique can be directly applied to the RCC-8 algebra.

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 475

Theorem 3. Computing a solution of a minimal network in RCC-8 is NP-complete.

Proof. Given a symmetric and 3-supersymmetric 3-SAT instance φ, we may constructan instance of the consistency problem in RCC-8 by substituting PA relations <,>, ||in the reduction provided above with RCC-8 relations NTPP,NTPP∼,PO respec-tively. Propositions 1 and 2 still hold and can be proved in the same way. Therefore,computing a solution of a minimal RCC-8 network is NP-complete. �

4 Cardinal Relation Algebra and Interval Algebra

This section shows that computing a solution for a minimal CRA or IA constraint net-work is also NP-hard. The proof is similar to but simpler than that in previous section,as 3-supersymmetry is no longer necessary. We first introduce some abbreviations thatmay clarify the specification of constraints. For a CRA relation α, We use

a|b α c|d to denote constraints a α c, a α d and b α c, b α d,a

c

dto denote constraints a α c and b α d.

Now we discuss the Cardinal Relation Algebra. Suppose φ =∧m

j=1 cj is a symmetric

SAT instance with Var(φ) = {p1, p2, · · · pn} and clauses cj =∨tj

k=1 lj,k. We nowconstruct a CRA constraint network (Vφ, Γφ). The spatial variables for propositionalvariable pi are still xi and yi, while 2tj spatial variables cj,k, dj,k(k = 1, 2, · · · , tj) areintroduced for clause cj (which has tj literals). So the variable set is Vφ = V0 ∪ V1 ∪· · · ∪ Vm, where V0 = {xi, yi : 1 ≤ i ≤ n} and Vj = {cj,k, dj,k : 1 ≤ k ≤ tj}.

Fig. 4. Overview of the configuration of (Vφ, Γφ)

We describe the relative locations of variables which are implied by the CRA con-straints in Γφ. The variables in V0 will be located in the leftmost column (Column 0) inFigure 4. Among them, xi and yi will be located in the dashed small box which is in the

476 W. Liu and S. Li

i-th row. Meanwhile, xi is either to the northwest of or to the southeast of yi. Formally,we impose the following CRA constraints, where 1 ≤ i < i′ ≤ n,

xi {NW, SE} yi, xi|yi NW xi′ |yi′ .

The case that xi is to the northwest (southeast resp.) of yi corresponds to that pi isassigned true (false resp.).

The 2tj variables cj,k, dj,k(1 ≤ k ≤ tj) in Vj are all located in Column j in Figure 4.For the vertical positions, suppose lj,k ∈ {pi,¬pi}, then cj,k and dj,k are located in thei-th row. Precisely, we impose

xi

yiW

cj,kdj,k

,xi

yi{NW, SW} dj,k

cj,k,

and

cj,k {NW, SE} dj,k if lj,k = pi, or cj,k {NE, SW} dj,k if lj,k = ¬pi.

That is to say, cj,k (dj,k resp.) is to the east of xi (yi resp.). By these constraints, theCRA relation between cj,k and dj,k is decided by the relation between xi and yi andliteral lj,k (being positive or negative). In fact, it is straightforward to check that thehorizontal relation (i.e., west or east) between cj,k and dj,k is in accordance with thetruth value assigned to literal lj,k (true or false), see Figure 5. The relative positions (orconstraints) between cj,k, dj,k and xi′ , yi′ where i �= i′ can be completely decided bythe constraints above.

(a) lj,k = pi (b) lj,k = ¬pi

Fig. 5. Passing the relation between xi and yi to that between cj,k and dj,k, assuming xi NW yi

We now discuss the constraints between variables in Vj . Suppose u ∈ {cj,k, dj,k}and v ∈ {cj,k′ , dj,k′} are two variables in Vj , where k �= k′. Suppose lj,k ∈ {pi,¬pi}and lj,k′ ∈ {pi′ ,¬pi′} for some i �= i′ (if i = i′ then either one literal can be re-moved, or the clause is unsatisfiable and we may simply construct an inconsistent CRAinstance). We consider the constraint between u and v in the vertical direction and inthe horizontal direction separately. The vertical relation between u and v is determinedby i and i′, as u is in the i-th row and v is in the i′-th row.

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 477

The horizontal relation between u and v is the key point which connects the SATinstance φ and the CRA constraint network (Vφ, Γφ). Note that the j-th clause cj inφ rules out the assignments that assign all literals lj,k false. Therefore, we expect that(Vφ, Γφ) forbids the case that all dj,k are to the left (i.e., northwest or southwest) ofcj,k for k ∈ {1, 2, · · · , tj}. To this end, dj,k and cj,k+1 are required to lie on the samevertical line, while any other pair of variables in Vj are required not to, where tj + 1 isconsidered as 1. It is clear that dj,k (or equivalently cj,k+1) being to the west of cj,k forall k ∈ {1, 2, · · · , tj} is not realisable.

Note that the above constraints also forbid the case that all dj,k are to the right (i.e.,northeast of southeast) of cj,k for k ∈ {1, 2, · · · , tj}. This does not cause problemssince φ rules out the assignments that assign all literals lj,k in cj true by its symmetry.

Now we consider the constraint between u ∈ Vj and v ∈ Vj′ for j �= j′. Supposeu ∈ {cj,k, dj,k}, v ∈ {cj′,k′ , dj′,k′}, where lj,k ∈ {pi,¬pi}, lj′,k′ ∈ {pi′ ,¬pi′}. Thehorizontal relation between u and v is determined by j and j′ (u is in Column j and vis in Column j′). For the vertical constraint, note that u and v are located in the i-th andi′-th rows respectively. Therefore the case that i �= i′ is clear. If i = i′, cj,k and cj′,k′

are both to the east of xi, while dj,k and dj′,k′ are both to the east of yi. So we specifythe following constraints if j < j′. The case when j > j′ is similar.

cj,kdj,k

Ecj′,k′

dj′,k′,

cj,kdj,k

{NW,SW} dj′,k′

cj′,k′.

Proposition 3. Given a symmetric SAT instance φ, suppose (Vφ, Γφ) is the CRA in-stance as constructed above. Then φ is satisfiable iff (Vφ, Γφ) has a consistent scenario.

Proof. This part can be straightforwardly proved by the connection between φ and(Vφ, Γφ) described above. We omit the details here. � Therefore, we have a reduction from symmetric SAT to CSPSAT(CRA). Note that fora symmetric SAT instance φ with n propositional variables and T literals, the CRAinstance (Vφ, Γφ) consists 2n+ 2T spatial variables. So the reduction is polynomial.

Proposition 4. Suppose φ is a satisfiable symmetric SAT instance. Then the CRA con-straint network (Vφ, Γφ) constructed above is minimal.

Proof. We need to prove that, after refining a non-basic constraint to any basic relationit contains, the network is still consistent. Note that the CRA relation in any non-basicconstraints of (Vφ, Γφ) is exactly the union of two basic relations. Suppose Γ0 is aconsistent scenario of (Vφ, Γφ). Let Γ1 be the scenario obtained by refining non-basicconstraints in (Vφ, Γφ) to the basic constraint different from the one in Γ0. ScenarioΓ1 is also consistent by path-consistency (otherwise, Γ0 can not be path-consistent).Therefore, each non-basic constraint in (Vφ, Γφ) can be refined to any basic constraint(either in scenario Γ0 or in scenario Γ1). So (Vφ, Γφ) is a minimal CRA network. � Theorem 4. Computing a solution of a minimal CRA network is NP-complete.

Proof. The theorem can be proved in the same way as Theorem 2.

For Interval Algebra, observing that interval [a, b] (where a < b) naturally correspondsto the point (a, b) on the half plane, we can prove the following theorem.

478 W. Liu and S. Li

Theorem 5. Computing a solution of a minimal IA network is NP-complete.

Proof (sketch). We may translate the reduction for CRA into a reduction for IA byreplacing CRA relations with IA relations as in the following table.

CRA relation NW N NE W EQ E SW S SEIA relation di si oi fi eq f o s d

We then may prove Propositions 3 and 4 for IA in the same way. �

5 Conclusion and Future Work

In this paper we have discussed the minimal constraint networks in qualitative spatialand temporal reasoning. We have proved for four major qualitative calculi (viz., par-tially ordered Point Algebra, Cardinal Relation Algebra, Interval Algebra and RCC-8algebra) that deciding the minimality of networks and computing solutions of minimalconstraint networks are both NP-complete problems. We have provided a polynomialreduction from a specialized SAT problem to the consistency problem of each qualita-tive calculus, which maps positive SAT instances to minimal constraint networks. Thereduction exploits the symmetry of qualitative calculi, as it uses ‘symmetric’ intractablesubclasses of relations, for example, {||, {<,>}, {<,>, ||}} in partially ordered PointAlgebra, and {PO, {NTPP,NTPP∼}, {NTPP,NTPP∼,PO}} in RCC-8.

The work of Gottlob [10] reveals the intractability of solving minimal constraint net-works in classical CSP (with finite domains). This paper discussed the same problem,but in the context of QSTR. In this situation, the domains are infinite, and the con-straints are all taken from a fixed and finite set of relations in a qualitative calculus. Theminimality problem in such a qualitative calculus can also be regarded as a ‘special’problem in classical CSP. The NP-hardness of the general problem proved by Gottlob(where 2-supersymmetry is enough for the binary case) does by no means imply theNP-hardness of the special problems considered in this paper, where symmetry (and3-supersymmetry for CRA and IA) are required.

Acknowledgements. This work was partially supported by an ARC Future Fellowship(FT0990811) and an ARC Discovery Project (DP120104159). We thank the reviewersfor their helpful suggestions.

References

1. Allen, J.F.: Maintaining knowledge about temporal intervals. Commun. ACM 26(11), 832–843 (1983)

2. van Beek, P.: Reasoning about qualitative temporal information. Artif. Intell. 58(1-3), 297–326 (1992)

3. Broxvall, M., Jonsson, P.: Point algebras for temporal reasoning: Algorithms and complexity.Artif. Intell. 149(2), 179–220 (2003)

4. Chandra, P., Pujari, A.K.: Minimality and convexity properties in spatial CSPs. In: ICTAI,pp. 589–593. IEEE Computer Society (2005)

Solving Minimal Constraint Networks in Qualitative Spatial and Temporal Reasoning 479

5. Cohn, A.G., Renz, J.: Qualitative spatial reasoning. In: van Harmelen, F., Lifschitz, V., Porter,B. (eds.) Handbook of Knowledge Representation. Elsevier (2007)

6. Dechter, R.: Constraint processing. Elsevier Morgan Kaufmann (2003)7. Drakengren, T., Jonsson, P.: A complete classification of tractability in Allen’s algebra rela-

tive to subsets of basic relations. Artif. Intell. 106(2), 205–219 (1998)8. Frank, A.U.: Qualitative spatial reasoning with cardinal directions. In: Kaindl, H. (ed.)

OGAI. Informatik-Fachberichte, vol. 287, pp. 157–167. Springer (1991)9. Gerevini, A., Saetti, A.: Computing the minimal relations in point-based qualitative temporal

reasoning through metagraph closure. Artif. Intell. 175(2), 556–585 (2011)10. Gottlob, G.: On Minimal Constraint Networks. In: Lee, J. (ed.) CP 2011. LNCS, vol. 6876,

pp. 325–339. Springer, Heidelberg (2011)11. Li, S.: On topological consistency and realization. Constraints 11(1), 31–51 (2006)12. Li, S., Ying, M.: Region Connection Calculus: Its models and composition table. Artif. In-

tell. 145(1-2), 121–146 (2003)13. Ligozat, G.: Reasoning about cardinal directions. J. Vis. Lang. Comput. 9(1), 23–44 (1998)14. Ligozat, G., Renz, J.: What Is a Qualitative Calculus? A General Framework. In: Zhang,

C., Guesgen, H.W., Yeap, W.-K. (eds.) PRICAI 2004. LNCS (LNAI), vol. 3157, pp. 53–64.Springer, Heidelberg (2004)

15. Liu, W., Zhang, X., Li, S., Ying, M.: Reasoning about cardinal directions between extendedobjects. Artif. Intell. 174(12-13), 951–983 (2010)

16. Montanari, U.: Networks of constraints: Fundamental properties and applications to pictureprocessing. Inf. Sci. 7, 95–132 (1974)

17. Nebel, B., Burckert, H.J.: Reasoning about temporal relations: A maximal tractable subclassof Allen’s Interval Algebra. J. ACM 42(1), 43–66 (1995)

18. Randell, D.A., Cui, Z., Cohn, A.G.: A spatial logic based on regions and connection. In: KR,pp. 165–176 (1992)

19. Renz, J., Nebel, B.: On the complexity of qualitative spatial reasoning: A maximal tractablefragment of the Region Connection Calculus. Artif. Intell. 108(1-2), 69–123 (1999)

20. Vilain, M.B., Kautz, H.A.: Constraint propagation algorithms for temporal reasoning. In:AAAI, pp. 377–382 (1986)