From Lo cal to Global Consistency in Temp oral

?

Constraint Networks

Manolis Koubarakis

Dept of Computation

UMIST

PO Box

Manchester M QD

UK

manolissnacoumistacuk

Abstract

We study the problem of global consistency for several classes of quantitative

temp oral constraints which include inequalities inequations and disjunctions of in

equations In all cases that we consider we identify the level of lo cal consistency

that is necessary and sucient for achieving global consistency and present an al

gorithm which achieves this level As a bypro duct of our analysis we also develop

an interesting minimal network algorithm

Intro duction

One of the most imp ortant notions found in the lit

erature is global consistency Fre In a global ly consistent constraint set

all interesting constraints are explicitly represented and the pro jection of the

solution set on any subset of the variables can b e computed by simply col

lecting the constraints involving these variables An imp ortant consequence of

this prop erty is that a solution can b e found by backtrackfree search Fre

Enforcing global consistency can take an exp onential amount of time in the

worst case FreCo o As a result it is very imp ortant to identify cases

in which which presumably can b e enforced in p olynomial

time implies global consistency Dec

Invited submission to the sp ecial issue of Theoretical Computer Science dedi

cated to the st International Conference on Principles and Practice of Constraint

Programming CP Editors U Montanari and F Rossi Forthcoming

In this pap er we study the problem of enforcing global consistency for sets

of quantitative temp oral constraints over the rational or real numb ers The

class of constraints that we consider includes

equalities of the form x y r

inequalities of the form x y r

inequations of the form x y r and

disjunctions of inequations of the form

x y r x y r

1 1 1 n n n

where x y x y x y are variables ranging over the rational numb ers

1 1 n n

and r r r are rational constants For the representation of equalities

1 n

inequalities and inequations we utilize binary temporal constraint networks

Disjunctions of inequations are represented separately

Disjunctions of inequations have b een intro duced in Kou following the ob

servation that in the pro cess of eliminating variables from a set of temp oral

1

constraints an inequation can give rise to a disjunction of inequations In

related temp oral reasoning research VKvBaGS GSS have consid

ered inequations of the form t t in the context of p oint algebra PA

1 2

networks Also Meia has studied inequations of the form t r r a real

constant in the context of p oint networks with almostsingleinte rval domains

In a more general context researchers in constraint logic programming orig

inally LM and later IvHImbImb have studied disjunctions of

arbitrary linear inequations eg x x x x x x

1 2 3 2 3 5

LM IvH concentrate on deciding consistency and computing canonical

forms while ImbImb deal mostly with variable elimination It is inter

esting to notice that the basic algorithm for variable elimination in this case

has b een discovered indep endently in Kou and Imb although Kou

has used the result only in the context of temp oral constraints

The contributions of this pap er can b e summarized as follows

i We show that strong consistency is necessary and sucient for achiev

ing global consistency in temp oral constraint networks for inequalities

2

and inequations Corollary This result and all subsequent ones

rely heavily on an observation of LM Kou Imb disjunctions of

inequations can be treated indep endently of one another for the purposes

of deciding consistency or performing variable elimination

4

We give an algorithm which achieves global consistency in O H n

1

Elimination of variables is a very imp ortant op eration in temp oral constraint

databases KoucKouaKoub

2

As shown in DMP if only inequalities are considered path consistency is nec

essary and sucient for achieving global consistency

where n is the numb er of no des in the network and H is the numb er

of inequations Theorems and The analysis of this algorithm

demonstrates that there are situations where it is impossible to enforce

global consistency without intro ducing disjunctions of inequations

A detailed analysis of the global consistency algorithm also gives us

an algorithm for computing the minimal temp oral constraint network in

2 3

this case The complexity of this algorithm is O maxH n n Theorem

ii We also consider global consistency of p oint algebra networks VK In

this case strong consistency is also necessary and sucient for achieving

global consistency Theorem This result which answers an op en

problem of vBa also follows from Kou but the b ounds of the

algorithms given there were not the tightest p ossible

iii Finally we consider global consistency when disjunctions of inequations

are also allowed in the given constraint set This case is mostly of theoret

ical interest and is presented here for completeness In this case strong

V consistency is necessary and sucient for achieving global con

sistency Corollary The parameter V is the maximum numb er of

variables in any disjunction of inequations

Most of the ab ove results come from the authors PhD thesis Kouc or are

renements of ideas presented there

The pap er is organized as follows The next section presents denitions and

preliminaries Section discusses global consistency of temp oral constraint

networks while Section presents an algorithm for computing the minimal

network Section considers the case of p oint algebra networks Section

considers the case of arbitrary temp oral constraints Finally Section sum

marizes our results App endix A contains two long pro ofs

Denitions and Preliminaries

We consider time to b e linear dense and unb ounded Points will b e our only

time entities Points are identied with the rational numb ers but our results

still hold if p oints are identied with the reals The set of rational numb ers

will b e denoted by Q

0 0 0

Denition A temporal constraint is a formula t t r t t r t t

0 0 0 0 0

are t r where t t t t t r t t r or t t

n 1 n 1 n 1

n 1 n 1

variables and r r r are rational constants

1 n

The rationale for studying disjunctions of inequations has b een given in Kou

Denition Let C b e a set of temp oral constraints in variables t t

1 n

The solution set of C denoted by S ol C is

n

f Q and for every c C satises cg

1 n 1 n 1 n

Each memb er of S ol C is called a solution of C A set of temp oral constraints

is called consistent if and only if its solution set is nonempty

If c is a disjunction of inequations then c denotes the complement of c ie

the conjunction of equations obtained by negating c If C is a set of equalities

n

in n variables the solution set of C is an ane subset of Q If C is a set

of inequalities in n variables the solution set of C is a convex p olyhedron

n

in Q If C is a set of disjunctions of inequations the solution set of C is

n

Q n S ol f c c C g The interested reader can nd background material on

ane spaces and convex p olyhedra in Sch

Let C b e a set of temp oral constraints in variables x x which contains

1 n

only equations inequalities and inequations but not disjunctions of inequa

tions The temporal constraint network TCN asso ciated with C is a lab eled

directed graph G V E where V f ng No de i represents variable

x and edge i j represents the binary constraints involving x and x As

i i j

usual unary constraints will b e represented as binary constraints with the in

tro duction of a sp ecial variable x The set of constraints asso ciated with

0

a TCN N will b e denoted by C onstr aintsN

Denition Let I b e a set of rational numb ers I will b e called an almost

convex interval if it is of the form

l r r r r r r u

1 1 2 k 1 k k

where l r r r u are rational numb ers such that l r r

1 k 1 k 1 k 1

r u and k An almost convex interval is also allowed to b e op en from

k

the right or left

The k values r r will b e called the holes of interval I We dene a

1 k

function hol es such that for each almost convex interval I as ab ove

hol esI fr r g

1 k

Let us assume that the set of constraints c on x x is

ij j i

h

j i

1

x x r g fx x d x x d x x r

j i j i ij j i j i j i

j i

j i

x

2

R x

1 [ 1

3

x

1

R

x

4

Fig A temp oral constraint network

h

j i

1

where d r r d Then the corresp onding TCN N will have

j i ij

j i

j i

an edge i j lab eled by the almostconvex interval

h 1 h h

j i j i j i

1 1 2

N d r r r r r r d

ij j i ij

j i j i j i

j i j i j i

Example The TCN of Figure represents the constraints

x x x x x x

2 1 2 3 4 1

x x x x

4 3 4 2

Given an interval I conv I will denote the convex hul l of I ie the minimal

in the settheoretic sense convex interval which includes I Formally

conv l r r r r r r u l u

1 1 2 k 1 k k

and conv I I if I is convex If N is a TCN then conv N denotes the TCN

which is obtained from N by substituting each interval N by conv N

ij ij

If N is a TCN then its solution set is S ol N S ol C onstr aintsN A

TCN is called consistent i its solution set is nonempty Two TCN are called

equivalent i their solution sets are equal DMP Meib

For the case of TCN the op erations of comp osition and intersection of almost

convex intervals are dened as usual Meib

Denition Let I I b e almost convex intervals The composition of I

1 2 1

and I denoted by I I is dened as follows

2 1 2

I I fz x I y I and x y z g

1 2 1 2

The intersection op eration has the usual settheoretic semantics

The following prop osition is straightforward

Prop osition The class of almostconvex intervals over Q is closed under

composition and intersection

Global Consistency of a TCN

We will rst consider enforcing global consistency in a TCN

Notation Let C b e a set of constraints in variables x x For any

1 n

i such that i n C x x will denote the set of constraints in C

1 i

involving only variables x x

1 i

The following denition is from Dec

Denition Let C b e a set of constraints in variables x x and

1 n

i n C is called iconsistent i for every i distinct variables x x

1 i1

0 0

g such that u satises the x x every valuation u fx x

i1 1

i1 1

constraints C x x and every variable x dierent from x x

1 i1 i 1 i1

0

there exists a rational numb er x such that u can b e extended to a valuation

i

0 0

g which satises the constraints C x x x C is u u fx x

1 i1 i i

i

called strong iconsistent if it is j consistent for every j j i C is called

global ly consistent i it is iconsistent for every i i n

Let us present some examples illustrating the ab ove denitions

Example The constraint set C fx x x x x x

2 1 1 3 5 4

x x g is and consistent but not consistent For example the

4 6

valuation v fx x g satises C x x but it cannot b e

2 3 2 3

extended to a valuation which satises C

We can enforce consistency by adding the constraints x x and

2 3

x x to C The resulting set is consistent and also globally consistent

5 6

Example The constraint set C fx x x x g is

2 1 1 4

and consistent but not consistent For example the valuation v fx

2

x g satises C x x but it cannot b e extended to a valuation

4 2 4

which satises C

We can enforce consistency by adding the constraint x x to C The

2 4

resulting set is consistent and also globally consistent

Example The constraint set C fx x x x x x

2 1 1 3 2 3

x x g is strong consistent but not consistent For example the

1 4

valuation v fx x x g satises C x x x fx x

2 3 4 2 3 4 2 3

g but it cannot b e extended to a valuation which satises C

Enforcing consistency amounts to adding the disjunction

x x x x

2 4 3 4

The resulting set is consistent and also globally consistent

Example The constraint set C fx x x x x x

2 1 1 3 2 3

x x x x x x x x g is strong consistent

5 4 4 6 5 6 1 4

but not consistent Adding the constraint x x x x as in

2 4 3 4

the previous example is not enough For example the valuation v fx

5

x x g satises C x x x fx x g but it cannot b e

6 1 5 6 1 5 6

extended to a valuation which satises C x x x x

5 6 1 4

We can enforce consistency by also adding the constraint x x

5 1

0 0

x x to C Let the resulting set b e C C is strong consistent but

6 1

not consistent For example the valuation v fx x x

2 3 5

x g satises C x x x x fx x x x g but

6 2 3 5 6 2 3 5 6

it cannot b e extended to a valuation which satises C x x x x x or

2 3 5 6 1

C x x x x x

2 3 5 6 4

We can enforce consistency by adding the constraint

x x x x x x

2 3 5 6 2 5

0

to C The resulting constraint set is strong consistent and also globally

consistent

Figure presents algorithm TCNGConsistency which enforces global con

sistency on its input TCN TCNGConsistency takes as input a TCN and

returns an equivalent set of temp oral constraints which is globally consis

tent TCNGConsistencys output is not a TCN b ecause as the ab ove

examples indicate enforcing global consistency might result in the intro duc

tion of disjunctions of inequations which cannot b e represented by a TCN

TCNGConsistency takes advantage of an observation of KouImb

inequations can b e treated independently of one another for p erforming vari

able elimination

The algorithm TCNGConsistency essentially enforces strong consistency

on its input network N As we will show shortly this level of lo cal consistency

is enough for achieving global consistency In step TCNGConsistency

Algorithm TCNGConsistency

Input A consistent TCN N

Output A globally consistent set of constraints equivalent to N

Metho d

Step Enforce path consistency on convN

For k i j to n do

N N conv N conv N

ij ij ik k j

EndFor

Step Enforce global consistency

C

For i k to n do

For g to h do

ik

Step

For m l to n do

If N N are closed from the right then

im li

g g

C C fx x d r x x d r g

m k im l k li

ik ik

EndIf

EndFor

Step

For m l s t to n do

If N N N N are closed from the right then

im li k s tk

C C fx x d d x x d d

m l im li s t k s tk

g

d d g x x r

im k s m s

ik

Endif

EndFor

EndFor

EndFor

Return C onstr aintsN C

Fig Enforcing global consistency

enforces strong consistency on conv N This is achieved by running the

0

mo died FloydWarshall algorithm of DMP on conv N Let N denote

0 0 0

the resulting TCN and A C onstr aintsN Then conv N is minimal and

globally consistent DMP

g

In step TCNGConsistency completes its job For each r hol esN

k i

ik

g

of A C onstr aintsN or equivalently for each inequation x x r

i k

ik

TCNGConsistency explores the inequalities of A involving x and x in the

i k

following systematic way Figure illustrates the structure of the subnetworks

x

i

x x x

l m i

x x x

t s k

x

k

Step Step

x

m

x x

l i

x x

t s

x

k

Step

Fig The subnetworks examined by step of TCNGConsistency

of N explored in this step Edges lab eled with denote nonconvex intervals

i If there are inequalities x x d and x x d then step

m i im i l li

0 0 0

g which x x x x ensures that any valuation v fx x

k m l

k m l

0 0

g satises Ax x x can b e extended to a valuation v v fx x

l m k i

i

which satises Ax x x x This is achieved with the intro duction of

l m k i

the inequation constraint

g g

x x d r x x d r

m k im l k li

ik ik

If there are inequalities x x d and x x d then step

s k k s k t tk

0 0 0

g which x x x x also ensures that any valuation v fx x

i t s

i t s

0 0

g satises Ax x x can b e extended to a valuation v v fx x

s t i k

k

which satises Ax x x x This is achieved with the intro duction of

s t i k

the inequation constraint

g g

x x d r x x d r

s i k s t i tk

ik ik

ii If there are inequalities x x d x x d x x d

m i im i l li s k k s

and x x d then step ensures that any valuation v fx

k t tk l

0 0 0 0

g which satises Ax x x x can x x x x x x x

l m s t t s m

t s m l

0 0 0

b e extended to a valuation v v fx x x x g which satis

i k

i k

es Ax x x x x x This is achieved with the intro duction of the

l m s t i k

inequation constraint

g

x x d d x x d d x x r d d

m l im li s t k s tk m s im k s

ik

Discussion It is p ossible that step of algorithm TCNGConsistency

intro duces constraints that are not strictly necessary for enforcing global con

sistency This happ ens when a generated constraint is equivalent to true or

when it is implied by another constraint TCNGConsistency can also in

tro duce disjunctions of inequations that are equivalent to inequations eg

x x x x We tolerate this ineciency b ecause it allow us

1 5 1 5

to present our ideas clearly and minimizes the case analysis in the forthcom

ing pro ofs The reader can consult Kouc for an improved but complicated

version of TCNGConsistency

The following theorem demonstrates the correctness of algorithm TCNGConsistency

Its pro of presented in App endix A is rather long but easy to follow

Theorem The algorithm TCNGConsistency is correct ie it returns

a global ly consistent set of constraints equivalent to the input network

Corollary Strong consistency is necessary and sucient for achieving

global consistency of a TCN

Pro of Example shows the necessity of achieving strong consistency The

suciency follows from the previous theorem the algorithm TCNGConsistency

essentially achieves strong consistency 2

The following theorem gives the complexity of TCNGConsistency

4

Theorem The running time of TCNGConsistency is O H n where

H is the number of inequations and n is the number of variables in the input

TCN

3 2

Pro of Step takes O n time step takes O H n time and step

4

takes O H n time 2

Computing Minimal TCN

In this section we present an algorithm for computing the minimal network

equivalent to a given TCN Minimal networks are imp ortant representations

b ecause they make explicit all binary constraints implied by a given network

In the words of Montanari a minimal network M is p erfectly explicit

as far as the pair of variables x and x is concerned the rest of the network

i j

do es not add any further constraint to the direct constraint M Mon

ij

Minimal networks have b een studied extensively in temp oral reasoning as

imp ortant to ols for answering queries concerning given temp oral information

see vBbvBDMP and esp ecially vB for examples For example

let C b e a set of temp oral constraints of the form x x r where x x

i j i j

are variables ranging over the rational or real numb ers and r is a rational

or real constant The minimal network corresp onding to C can b e computed

3 2

in O n time and O n space DMP Then the minimal network can b e

used to answer in constant time all interesting queries of the form Do es

x x r follow from the constraints in C where r is a rational constant

i j

and is or

We will also consider a network to b e minimal if it makes explicit all inter

esting binary constraints In our case interesting binary constraints are all

constraints of the form x x r where x x are variables ranging over the

i j i j

rational numb ers r is a rational constant and is or The following

denition will suce for our purp ose DMPMeib

Denition A TCN M is tighter than a TCN N if for every i j M N

ij ij

A TCN N is called minimal if there is no tighter network equivalent to it

For our class of constraints the ab ove denition of minimality slightly deviates

from the standard intuitions b ehind minimal networks as stated by Montanari

Mon To see this consider the constraint set

C fx x x x x g

1 2 2 2 3

If we adopt our denition the minimal TCN N for C has N

13

But C also implies the disjunctive binary constraint x x x

3 1 3

which cannot b e represented by N Thus if one is interested in answering

queries involving disjunctive binary constraints then one has to discard the

ab ove denition and adopt the one in Dec In this case a set of constraints

will b e called minimal if and only if any instantiation of two variables which

satises the constraints involving these variables can b e extended to a solution

of the full network Dec

The minimal network algorithm TCNMinimal shown in Figure is es

sentially a bypro duct of algorithm TCNGConsistency As we discussed

ab ove the constraints in the minimal TCN will b e only inequalities and in

equations Therefore an algorithm for computing the minimal TCN can b e

constructed if we start with TCNGConsistency and omit any part that

generates a disjunction of inequations This can b e achieved by a detailed

analysis of Step of TCNGConsistency If we want to adopt the second

denition of the minimal network and take into account disjunctive binary

constraints then we have to mo dify TCNMinimal accordingly

TCNMinimal computes the minimal TCN in four steps In the rst step

we enforce pathconsistency on the convex part conv N of the input network

N Steps and are illustrated in Figure In Step TCNMinimal p er

forms constraint propagation involving equalities from conv N and inequa

tions from L More precisely for every inequation x x r L and every

i j

equality x x d conv N Step adds inequation x x r d

k i k i k j k i

to N Similarly for every inequation x x r L and every equality

i j

Algorithm TCNMinimal

Input A consistent TCN N

Output A minimal TCN equivalent to N

Metho d

Step Enforce path consistency on conv N as in Step of

TCNGConsistency

Step

Let L b e the list of inequations in N

For every i j r in L do

Step

For k to n do

If d d then

ik k i

N N r d r d

k j k j k i k i

EndIf

EndFor

Step

For k to n do

If d d then

k j j k

N N r d r d

ik ik j k j k

EndIf

EndFor

EndFor

Step

For every i k r in L do

For m l to n do

If N N N N are closed from the right and m l and

im li k m lk

r d d and d d d d then

im k m li im lk k m

N N d d d d

lm lm li im li im

EndIf

EndFor

EndFor

Step

For every i k r in L do

For m t to n do

If d d and d d then

mi im k t tk

N N d d r d d r

tm tm im tk im tk

EndIf

EndFor

EndFor

Return N

Fig A minimal TCN algorithm

x

x x x

k

j k i

x

i

x

j

Step Step

x

i

x x

m i

HY

H

H

H

H

H

H

x

x

l

H

m

H

H

H

H

H

Hj

x

x

k

t

x

k

Step Step

Fig The networks examined by algorithm TCNMinimal

x x d conv N Step adds inequation x x r d to N

j k j k i k j k

In Step TCNMinimal considers subnetworks of N like the ones considered

3

by Step of TCNGConsistency see Figure when l t and m s

In this case the constraint generated by TCNGConsistency is equivalent to

a binary inequation thus it should b e reected in the minimal TCN This can

b e shown as follows If l t and m s then Step of TCNGConsistency

examines the constraint set

fx x d x x d x x d x x d x x r g

m i im i l li m k k m k l lk i k

and generates the constraint

x x d d x x d d r d d

m l im li m l k m lk im k m

If r d d and d d d d then the ab ove constraint

im k m im li k m lk

b ecomes x x d d otherwise it evaluates to true

m l im li

Finally in Step TCNMinimal considers subnetworks of N like the ones

3

The case where l s and m t do es not need to b e considered b ecause it leads

to disjunctions of inequations that are equivalent to true

considered by Step of TCNGConsistency when l m and t s In

this case the constraint generated by TCNGConsistency is also equivalent

to a binary inequation This can b e shown as follows If l m and t s then

Step of TCNGConsistency considers the constraint set

fx x d x x d x x d x x d x x r g

m i im i m mi t k k t k t k t i k

and generates the constraint

d d d d x x d d r

im mi k t tk m t im tk

If d d and d d then this constraint b ecomes x x d

im mi k t tk m t im

d r otherwise it evaluates to true

tk

The following lemma summarizes the ab ove discussion

Lemma If TCNGConsistency computes a binary inequation c and

N is the output of TCNMinimal then c C onstr aintsN

The following theorem shows that the algorithm TCNMinimal is correct

and gives its complexity

Theorem The algorithm TCNMinimal computes the minimal TCN

2 3

equivalent to its input in O maxH n n time where H is the number of

inequations and n is the number of variables

Pro of The correctness part follows from the previous lemma The complexity

b ound is achieved by either maintaining L explicitly or by having an adjacency

list recording the inequations for every no de of N 2

An algorithm with the same complexity has also b een discovered indep en

dently by Gerevini and Cristani without prior analysis of the global consis

tency problem GC A careful comparison of the two algorithms shows that

Step of TCNMinimal computes path implicit inequations Step deals

with forbidden subgraphs and Step deals with path implicit inequations

this new terminology comes from GC and the reader is referred there for

more details

Indep endently Isli has studied a sub class of the class of temp oral constraints

that we consider in this section Isl Isli do es not consider inequations of

the form x y r where r and achieves the same complexity b ound for

computing the minimal network

Global Consistency of Point Algebra Networks

We will now turn our attention to an imp ortant subset of TCN the p oint

algebra networks intro duced in VKvB A point algebra network PAN is

a lab eled directed graph where no des represent variables and edges represent

PA constraints The lab els of the edges are chosen from the set of relations

f g The symb ol is used to lab el an edge i j whenever

there is no constraint b etween variables x and x

i j

Van Beek and Cohen have studied PAN in detail vBCvB Theorem

and the following results of vB show that the complexity of computing the

minimal network do es not change when we go from PAN to TCN

Theorem The minimal network equivalent to a PAN can be computed in

2 3

O maxH n n time where H is the number of edges labeled with and n

is the number of nodes

In vBC the minimal network is computed by algorithm AAC However

in the pro of of correctness of AAC Theorem of vBC Van Beek and

Cohen suggest that the algorithm for computing the minimal network of a

given PAN also achieves global consistency This is not true and has b een

corrected in vBa As the following example demonstrates the intro duction

of disjunctions of inequations is necessary for achieving global consistency in

this case But algorithm AAC of vBC do es not intro duce such disjunctions

so it cannot achieve global consistency

Example For the PAN with constraints

x x x x x x x x x x

1 2 2 3 4 5 5 6 2 5

AAC will also intro duce constraints x x x x The resulting PAN

1 3 4 6

is strong consistent but not globally consistent This can b e demonstrated

via an argument similar to the one for Example If we enforce strong

consistency with the addition of constraints x x x x x

1 5 3 5 4

x x x and x x x x x x then the resulting set is

2 6 2 1 3 1 4 1 6

globally consistent

Global consistency of PAN can b e enforced by TCNGConsistency if PAN

are represented by their equivalent TCN The following theorem summarizes

the result of Section as it applies to PAN

Theorem Strong consistency is necessary and sucient for achieving

4

global consistency in PAN Strong consistency can be enforced in O H n

time where H is the number of edges labeled with and n is the number of

nodes

Global consistency of PAN has also b een discussed under the name decomp os

ability in Section of Kou and algorithm Decompose has b een prop osed

for achieving this task The algorithm is correct but it adopts a representation

which is rather inappropriate for the task at hand and leads to a complexity

b ound which is not the tightest The results of this section subsume the results

of Section only of Kou

Let us now comment on some observations of Dechter Dec on the problem

of enforcing global consistency in PAN Dec discusses global consistency in

general constraint networks with nite variable domains The most imp ortant

result of Dec is the following If N is a constraint network with constraints

of arity r or less and domains of size k or less which is strongly k r

consistent then N is globally consistent

The ab ove result can b e applied to PAN if PAN are redened as traditional

constraint networks where variables represent relations b etween two p oints

and constraints are dened by the transitivity table of VKvB This repre

sentation yields a constraint network with k and r Dechters result

now gives us the following If strong consistency in PAN can b e enforced

with ternary constraints then strong consistency implies global consistency

Dechter uses the aforementioned incorrect assertion of vBC to conclude

that strong consistency in the traditional formulation of PAN can b e en

forced with ternary constraints Thus she also concludes that in the traditional

formulation strong consistency implies global consistency Dec page

In the light of Theorem Dechters conclusion remains unjustied

The General Case

Let us now consider enforcing global consistency when disjunctions of inequa

tions are allowed in the given constraint set

Example The constraint set

C fx x x x x x x x x x x x x x

5 1 1 6 5 6 7 3 3 8 7 8 9 2

x x x x x y x z x w g

2 10 9 10 1 2 3

is strong consistent but not consistent For example the valuation

v fy z w x x x x g

2 3 5 6

satises C y z w x x x x fx x g but it cannot b e extended to a

2 3 5 6 5 6

valuation which satises C y z w x x x x x We can enforce consistency

2 3 5 6 1

by adding the constraints

x y x y x z x w

5 6 2 3

x y x z x z x w

1 9 10 3

x y x z x w x w

1 2 7 8

The resulting set is strong consistent but not consistent We can enforce

consistency by adding the constraints

x y x y x z x z x w

5 6 9 10 3

x y x z x z x w x w

1 9 10 7 8

x y x y x z x w x w

5 6 2 7 8

The resulting set is strong consistent but not consistent We can enforce

consistency by adding the constraint

x y x y x z x z x w x w

5 6 9 10 7 8

The resulting set is strong consistent and also globally consistent

Figure presents algorithm GConsistency which enforces global consistency

on its input constraint set The reader should have no problem understanding

the details of GConsistency since it is a straightforward generalization of

algorithm TCNGConsistency

The following theorem demonstrates the correctness of GConsistency The

pro of is given in App endix A

Theorem The algorithm GConsistency is correct ie it returns a

global ly consistent set of constraints equivalent to the input one

In essence algorithm GConsistency achieves strong V consistency

where V is the maximum numb er of variables in any disjunction of inequa

tions Thus we have the following corollary

Corollary Let C be a set of temporal constraints If C is V consistent

where V is the maximum number of variables in any disjunction of inequa

tions then C is global ly consistent

The time complexity of GConsistency is exp onential in V However if V

is xed then the time complexity of GConsistency is p olynomial in the

numb er of variables and the numb er of constraints in C This has an interesting

consequence for variable elimination due to its relation to global consistency

Corollary Let C be a set of temporal constraints such that the number of

variables in every disjunction of inequations is xed Eliminating any number

Algorithm GConsistency

Input A set of temp oral constraints C C C where C is a set of inequalities

i d i

and C is a set of disjunctions of inequations

d

Output A globally consistent set of constraints equivalent to C

Metho d

Step Enforce strong consistency on C

i

Let N b e the TCN corresp onding to C

i

For k i j to n do

N N N N

ij ij ik k j

EndFor

Step Enforce global consistency

0

C

d

For each c C do

d

For all subsets fk k g of the set of variables of c do

1 i

For m m l l to n do

1 i 1 i

If N N N N are closed from the right then

k m k m l k l k

1 1 i i 1 1 i i

from x Eliminate variables x

k k

i 1

d x x d x x d x c x

im k m l k l k k m k m

i i i 1 1 1 1 1 1 1 1

d x x

l k l k

i i i i

0

to obtain c

0 0

0

f C C c g

d d

Endif

EndFor

EndFor

EndFor

0

Return C onstr aintsN C C

d

d

Fig Enforcing global consistency

of variables from C can be done in time polynomial in the number of variables

and the number of constraints In addition the resulting constraint set has

size polynomial in the same parameters

Pro of Let x x b e all the variables of C When V is xed the size of the

1 n

constraint set generated by algorithm GConsistency is p olynomial in the

numb er of variables and the numb er of constraints If C is globally consistent

then for any i such that i n C x x is the pro jection of S ol C

1 i

on fx x g Thus we can eliminate variables x x from C by running

1 i 1 i

GConsistency on C and returning C x x This algorithm takes

i+1 n

time p olynomial in the numb er of variables and the numb er of constraints

The ab ove corollary complements Theorem of Kou which states that

variable elimination can result in constraint sets with an exp onential numb er

of disjunctions of inequations

Conclusions

We discussed the problem of enforcing global consistency in sets of quantitative

temp oral constraints which include inequalities inequations and disjunctions

of inequations In future research it would b e interesting to consider directional

consistency algorithms for this class of temp oral constraints DP It would

also b e interesting to combine our results with the results of Meib in order

to identify classes of qualitative and quantitative p ointinterval constraints

where global consistency is tractable

Acknowledgements

I would like to thank Peter van Beek Rina Dechter Amar Isli the reviewers

of CP and the reviewers of this pap er for interesting comments I would also

like to thank Alfonso Gerevini for p ointing out to me that an earlier version

of Lemma had b een stated inaccurately

References

Co o MC Co op er An optimal kconsistency algorithm Articial

Intel ligence

Dec R Dechter From lo cal to global consistency Articial Intel ligence

DMP R Dechter I Meiri and J Pearl Temp oral Constraint Networks

Articial Intel ligence Sp ecial Volume on Knowledge

Representation

DP R Dechter and J Pearl NetworkBased Heuristics for Constraint

Satisfaction Problems Articial Intel ligence

Fre E Freuder Synthesizing Constraint Expressions Communications of

ACM Novemb er

Fre E Freuder A Sucient Condition For BacktrackFree Search Journal

of ACM

GC A Gerevini and M Cristani Reasoning with Inequations in Temp oral

Constraint Networks Technical rep ort IRST Instituto p er la Ricerca

Scientica e Tecnologica Povo TN Italy A shorter version app ears

in the Pro ceedings of the Workshop on Spatial and Temp oral Reasoning

IJCAI

GS A Gerevini and L Schub ert Ecient Temp oral Reasoning Through

Timegraphs In Proceedings of IJCAI pages

GSS A Gerevini L Schub ert and S Schaeer Temp oral Reasoning in

Timegraph II I SIGART Bul letin

Imb JL Imb ert Variable Elimination for Generalized Linear Constraints In

Proceedings of the th International Conference on Logic Programming

Imb JL Imb ert Redundancy Variable Elimination and Linear

Disequations In Proceedings of the International Symposium on Logic

Programming pages

Isl A Isli ConstraintBased Temp oral Reasoning a Tractable Point Algebra

Combining Qualitative Metric and Holed Constraints Technical Rep ort

LIPNCNRS URA Inst Galilee Universite ParisNord

IvH JL Imb ert and P van Hentenryck On the Handling of Disequations

in CLP over Linear Rational Arithmetic In F Benhamou

and A Colmerauer editors Constraint Logic Programming Selected

Research Logic Programming Series pages MIT Press

Kou M Koubarakis Dense Time and Temp oral Constraints with 6 In

Principles of Know ledge Representation and Reasoning Proceedings

of the Third International Conference KR pages Morgan

Kaufmann San Mateo CA Octob er

Koua M Koubarakis Complexity Results for FirstOrder Theories of Temp oral

Constraints In Principles of Know ledge Representation and Reasoning

Proceedings of the Fourth International Conference KR pages

Morgan Kaufmann San Francisco CA May

Koub M Koubarakis Foundations of Indenite Constraint Databases In

A Borning editor Proceedings of the nd International Workshop on the

Principles and Practice of PPCP volume

of Lecture Notes in Computer Science pages Springer

Verlag

Kouc M Koubarakis Foundations of Temporal Constraint Databases PhD

thesis Computer

Science Division Dept of Electrical and Computer Engineering National

Technical University of Athens February Available electronically

from httpwwwcoumistacukmanolisMKMKoubarakishtml

LM JeanLouis Lassez and Ken McAlo on A Canonical Form for Generalized

Linear Constraints Technical Rep ort RC IBM Research

Division TJ Watson Research Center

Meia I Meiri Combining Qualitative and Quantitative Constraints in

Temp oral Reasoning Technical Rep ort R Cognitive Systems

Lab oratory University of California Los Angeles

Meib I Meiri Combining Qualitative and Quantitative Constraints in

Temp oral Reasoning In Proceedings of AAAI pages

Mon U Montanari Networks of Constraints Fundamental Prop erties and

Applications to Picture Pro cessing Information Sciences

Sch A Schrijver editor Theory of Integer and Linear Programming Wiley

vBa Peter van Beek Exact and Approximate Reasoning Ab out Qualitative

Temp oral Relations Technical Rep ort TR Department of

Computing Science University of Alb erta August

vBb Peter van Beek Reasoning Ab out Qualitative Temp oral Information In

Proceedings of AAAI pages

vB Peter van Beek Temp oral Query Pro cessing with Indenite Information

Articial Intel ligence in Medicine

vB Peter van Beek Reasoning Ab out Qualitative Temp oral Information

Articial Intel ligence

vBC Peter van Beek and Robin Cohen Exact and Approximate Reasoning

ab out Temp oral Relations Computational Intel ligence

VK Marc Vilain and Henry Kautz Constraint Propagation Algorithms for

Temp oral Reasoning In Proceedings of AAAI pages

VKvB Marc Vilain Henry Kautz and Peter van Beek Constraint Propagation

Algorithms for Temp oral Reasoning A Revised Rep ort In DS Weld

and J de Kleer editors Readings in Qualitative Reasoning about Physical

Systems pages Morgan Kaufmann

A Pro ofs

0 0

Pro of of Theorem Let C denote C onstr aintsN C The set C

0

is consistent therefore consistency holds trivially We will show that C is

consistent for every n

0 0

Let us take an arbitrary valuation v fx x x x g such that

1 1

1 1

0 0 0

is satisable We will show that for every variable x v can x C x

1 1

0 0 0 0 0

b e extended to a valuation v v fx x g such that C x x is

1

satisable

If all constraints involving x and any of x x are inequalities our result

1 1

is immediate since C onstr aintsN is globally consistent Let us then assume

0 0 0 0

that C x x contains inequations and consider C x x x

1

1 1

0

Let D denote the numb er of inequation constraints involving x x in C Let

j i j i

I b e the set of natural numb ers j such that x x r or x x r

i j i i j

0 0 0 0

is an inequation constraint in C Then C x x x can b e written as

1 1

[

D

0 0 0 1 0

fx d x x x d g fx x r x x r gA

1 2

2I

where f g and f g Since the rational numb ers

1 2

0

are dense there is only one case which would not allow us to nd a value x

0 0 0 0

is satisable This is the case when is x x such that C x

1 2

1 1

is and there exists I and f D g such that

0 0 0

A r d x d x x

We will show that this case cannot arise

Dep ending on the form of the inequation constraint c from which inequation

0

was generated the following cases must b e considered Figure r x x

A illustrates the analysis by depicting the subnetworks involved in each case

i c is x x r C onstr aintsN or equivalently r hol esN

In this case the constraint x x d r x x r d

is added to C in Step of algorithm TCNGConsistency with g

m l and k Then

0 0 0 0 0 0 0

x x d r x x r d C x x

1 1

thus we have a contradiction

x x x x x x x

x x x

Case Case a

x x x x x x x

x

x x x x

Case b Case c

x x

x x x x x x

I

x

x x x x x x x

Case a Case b

x x x x x x x

x

I

x x x x x x x x

Case c Case d

Fig A The cases examined in Theorem

ii c is added to C in Step of TCNGConsistency Dep ending on the

values of g l i m and k we can consider the following sub cases

a c is added to C in Step of TCNGConsistency with g l

i m and k Thus c is x x r d x x

d r The constraints A A and c imply

0 0

x d r x x d r d r d A x

Now we have the following sub cases

d d d Then A contradicts the constraint

x x d r x x d r

0

of C x x which is intro duced in Step of TCNGConsistency

1 1

with g l i m and k

0 0

d d d Then x x d d d d d d

0 0

This contradicts x x d d d which is implied by A

b c is added to C in Step of TCNGConsistency with g l

d x x i m and k Thus c is x x r

d r This case is symmetric to a

c c is added to C in Step TCNGConsistency with g l

i m and k Thus c is x x r d x x

d r or equivalently x x r d x x d r The

0 0 0

constraints A and c imply x r d x d r x r

These equalities together with A imply

0 0 0 0 0 0

x x d d x x d d x r d x d

But for g l m i k t and s the

constraint

d d x x d d x x d d x x r

is added to C in Step of TCNGConsistency This constraint

0

also b elongs to C x x thus we have a contradiction

1 1

iii c is added to C in Step of TCNGConsistency Dep ending on the

values of g l i m t k and s we can consider the following sub cases

a c is added to C in Step of TCNGConsistency with g l

i m t k and s Thus c is

d d x x d d x x d d x x r

The constraints A and c imply

0 0 0 0 0

d d x x r d d x r d d x x

These equations together with A imply

0 0 0 0

x x d d d x x d d

0 0

d d A d r x x

Now we have to consider the following sub cases

d d d Then A contradicts the constraint

d d x x d d x x d d x x r

0

of C x x which is added to C in Step of TCNGConsistency

1 1

with g l i m t k and s

d d d Then

0 0

x x d d d d d d

This contradicts the rst equation of A

b c is intro duced in Step of TCNGConsistency with g l

i m t k and s Thus c is

d d x x d d x x d d x x r

This case is symmetric to case a

c c is intro duced in Step of TCNGConsistency with g l

i m t k and s Thus c is

d d x x d d x x d d x x r

d d or x x d d x x d d x x r

The constraints A and c imply

0 0 0 0

d d d d r r x d d x x x

The ab ove equations together with A imply

0 0 0 0

d d r x d d x x x

0 0

x x d d d A

Now we have to consider the following cases

d d d Then A contradicts the constraint

x x d d x x d d x x r d d

0

of C x x which is intro duced in Step of of TCN

1 1

GConsistency with g l i m t k

and s

d d d Then

0 0

x x d d d d d d

which contradicts the last equation of A

d c is intro duced in Step of TCNGConsistency with g l

i m t k and s Thus c is

d d x x d d x x d d x x r

This case is symmetric to case c 2

Pro of of Theorem The pro of will have the same structure as the pro of of

0

theorem Let C b e the set returned by GConsistency Let us take an ar

0 0 0 0 0

bitrary valuation v fx x x x g such that C x x

1 1

1 1 1 1

is satisable We will show that for every variable x v can b e extended to a

0 0 0 0 0

valuation v v fx x g such that C x x is satisable

1

If all constraints involving x and any of x x are inequalities our result

1 1

is immediate since C onstr aintsN is globally consistent Let us then assume

0 0 0 0

that C x x contains inequations and consider C x x x

1

1 1

0

Let D denote the numb er of inequation constraints involving x x in C Let

j i j i

I b e the set of natural numb ers j such that x x r or x x r

i j i i j

0 0 0 0

is an inequation constraint in C Then C x x x can b e written as

1 1

[

D

0 1 0 0 0

fx x r x x r gA fx d x x x d g

1 2

2I

where f g and f g Since the rational numb ers

1 2

0

are dense there is only one case which would not allow us to nd a value x

0 0 0 0

such that C x x x is satisable This is the case when is

1 2

1 1

is and there exists I and f D g such that

0 0 0

A r d x d x x

We will show that this case cannot arise

Dep ending on the form of the inequation constraint c from which inequation

1

0

was generated the following cases must b e considered r x x

i c C Then c can b e written as

1 d 1

x x r

where do es not contain x When the set f g is considered by Step of

GConsistency and m l the variable x is eliminated from

1 1

c x x d x x d

1

to obtain the following constraint c

2

x x d r x x d r

0 0 0

We have arrived at a contradiction since c C x x and the

2

1 1

equalities A hold

0

ii c is added to C in Step of GConsistency Dep ending on the values

1

of c i m m l l we consider the following sub cases

1 i 1 i

a c c i m m m l l

3 1 1 j 1 1 j

l

Thus c is obtained after variables x x are eliminated from

1 k k

1

c x x d x x d x x d

3 k k k k k k

1 1 1 1 1 1 1 1 j j

x x d x x d x x d

k k k k k k

j j

Therefore c is

1

c x x d x x d x x d

3 k k k k k k

1 1 1 1 j j

x x d d x x d d

k k k k

1 1 1 1 1 1 j j

x x d d

k k

0

Let us recall that x x r has b een generated by c This implies

1

0 0

that x r x d d We can now conclude using A that

k k

j j

0 0

x x d r d d d A

k k

j j

Now we have to consider the following cases

d d d If

k k

j j

c c i m m m l l l

3 1 1 j 1 1 j

then Step of GConsistency adds the following constraint c to

4

C

d

x x d x d x c x x d

k k k k 3 k k

j j 1 1 1 1

d x x d d d x x

k k k k

j j 1 1 1 1 1 1

x x d d

k k

The equalities A and the form of c and c imply that we have

1 4

arrived at a contradiction

d d d In this case

k k

j j

0 0

d d d d d d x x

k k k k

j j j j

Thus we have a contradiction with A

The symmetric cases where is one of m m m m

1 j 1 j +1

can b e treated similarly

b i m m m l l l

1 1 j 1 1 j

This case and the symmetric ones where is one of l l l l

1 j 1 j +1

are analogous to a 2