Temporal Constraint Networks Chapter 12

51
Chao Chen Wednesday, February 26, 2 003 1 Temporal Constraint Networks Chapter 12 Chao Chen CSCE 990-06 Advanced Constraint Processi ng

description

Temporal Constraint Networks Chapter 12. Chao Chen CSCE 990-06 Advanced Constraint Processing. Outline. Gentle reminder… Introduction Qualitative Temporal Networks Interval Algebra Point Algebra Quantitative Temporal Networks Simple Temporal Problem General TCSP - PowerPoint PPT Presentation

Transcript of Temporal Constraint Networks Chapter 12

Page 1: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

1

Temporal Constraint Networks Chapter 12

Chao ChenCSCE 990-06 Advanced Constraint Processing

Page 2: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

2

Outline1. Gentle reminder…2. Introduction3. Qualitative Temporal Networks

– Interval Algebra– Point Algebra

4. Quantitative Temporal Networks– Simple Temporal Problem– General TCSP– Path consistency in quantitative networks– Network-based algorithms

5. Translations between representations

Page 3: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

3

Main CSP Properties

• Node consistency

• Arc consistency

• Path consistency

• Minimality

• Decomposability (i.e., global consistency)

• Consistency

Page 4: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

4

Minimality

• Domain is minimal iff every value in the domain can be extended to a solution

• Constraint is minimal iff every tuple in the constraint can be extended to a solution

• A network is minimal iff – its domains are minimal and– constraints are minimal

• Given two values for two variables, if they are consistent, then they appear in at least one solution

• Tightest possible binary constraints yield the minimal network

Page 5: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

5

Decomposability

• A network is decomposable if every consistent assignment of values to a set of variables S can be extended to a solution

Page 6: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

6

Minimality vs Decomposability

• Minimality: any consistent combination of 2 variables is extendable to a solution

• Decomposability: any consistent combination of k (kn) variables is extendable to a solution.

PC Minimal Decomposable

Page 7: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

7

Temporal Reasoning: Introduction

• Many areas in AI: – planning, scheduling, qualitative reasoning, plan

recognition, …• Reasoning about time

– Represent time, mathematical and numerical – Reason time, inference– Model a problem about time and constraints on time– View as a CSP– Apply constraint processing framework & techniques

Page 8: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

8

Vocabulary• Temporal Objects:

– Points, beginning and ending of some events: BC/AD– Intervals, time period during which events occur or propositions

hold: during class, am, pm

• Constraints: Qualitative & Quantitative– Qualitative: Relation between time point and interval

• Extensional, atomic relations • Interval algebra: before, during, starts, etc.• Point algebra: <, =, >

– Quantitative: duration of an event in a numerical fashion• Intensional relations• Constraints of bounded differences

• Domain: continuous intervals in R represent time

Page 9: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

9

Interval Algebra: Relations (a.k.a. Allen Interval Algebra, after James Allen [1983])

Relation Symbol Inverse Examples

X before Y b bi

X equal Y = =

X meets Y m mi

X overlaps Y o oi

X during Y d di

X starts Y s si

X finishes Y f fi

x y

xy

x y

xy

xy

y

x

x

y

Page 10: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

10

Qualitative TN: Interval Algebra

• Two intervals I, J represent two events• 13 basic relations

r = { b, m, o, s, d, f, bi, mi, oi, si, di, fi, = }• I { r1, r2, …, rk } J (I r1 J) (I r2 J) … (I rk J) disjunctive clauses

• Not interested in explicit relations over domains of variables

• Enumerated atomic relations between variables

Page 11: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

11

Interval Algebra Constraint Network

• Definition 12.1.2, page 338• Variables: temporal intervals I and J• Domain: set of ordered pairs of real numbers

• Constraints are 13 relations

• A solution is an assignment of a pair of numbers to each variable such that no constraint is violated

},,|),{( baRbabaDi

},,,,,,,,,,,,{ fidisioimibifdsombC ij

Page 12: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

12

Interval Algebra: ExampleStory:

John was not in the room when I touched the switch to turn on the light but John was in the room later when the light was on.

CSP modeling:

Variables:Switch – the time of touching the switch

Light – the light was on

Room – the time that John was in the room

Constraints:Switch overlaps or meets Light: S {o, m} L

Switch is before, meets, is met by or after Room: S {b, m, mi, bi} R

Light overlaps, starts or is during Room: L {o, s, d} R

Page 13: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

13

Minimal Network

Light

RoomSwitch

{o, m}

{b, m, mi, a}

{o, s, d}

Light

RoomSwitch

{o, m}

{b, m}

{o, s}ConstraintTightening

A unique network equivalent to original networkAll constraints are subsets of original constraintsProvides a more explicit representationUseful in answering many types of queries

Page 14: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

14

IA: Path Consistency• Intersection

• Composition (a table like 12.5 page 342)

• QPC-1 (page 342)– Tighten every pair of constraints using

– Until minimal network or inconsistency detected

}'''''|''{'''' RrRrrRRRRR

}'''''|''{''' RrRrrRRR

kjikijij CCCC

Page 15: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

15

IA: Path Consistency• Composition table (page 12.5)• QPC-1, in some cases, guaranteed to

generate minimal network (exact)• But, minimal network is not guaranteed

– Global consistent – Backtrack free

• Solution: combine, at each node,– backtracking scheme with – path-consistency look-ahead engine

Page 16: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

16

Backtracking scheme with path-consistency look-ahead engine

• Dual graph representation• Use constraints as variables• Use common variables as edges

Light

RoomSwitch

{o, m}

{b, m}

{o, s, d}

{o, m}

{o, s, d} {b, m, mi, a}

Light

Room

Switch

A minimal network Backtracking Path-consistency look-ahead

Page 17: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

17

Point Algebra [Vilain & Kautz 1986]

• Each variable represents a time point

• Domain are real numbers

• Constraint express relative positions of 2 points

• Three basic relations: P<Q, P=Q, P>Q

• Constraints are PA elements {<, >, =}

• Cheaper than IA:– reasoning tasks are polynomial O(n3)

Page 18: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

18

Point Algebra: Example

• Story: Fred put the paper down and drank the last of his coffee

• IA: Paper { s, d, f, = } Coffee

• PA: Paper=[x, y],

Coffee=[z, t]

Constraints: x<y, z<t, x<t, x>=z, y<=t, y>z

Coffee Coffee Coffee Coffeepaper paper paper paper

Page 19: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

19

PA: Path Consistency

• Algorithm is basically the same as IA

• Composition table (Table 12.2 page 343)

• ? means universal constraint

• Path-consistent minimal decomposable (globally consistent)

• Convex PA (CPA) network – Only have {<, <=, =, >=, >} – Exclude

Page 20: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

20

PA: Consistency Inference

• Theorem 12.1.10 – Path-consistency decides the consistency

in O(n3)– Consistency and solution generation of PA

networks can be accomplished in O(n2)– Minimal network of a PA consistent network

can be obtained using 4-consistency in O(n4) – Minimal network of CPA networks can be

obtained by path-consistency in O(n3)

Page 21: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

21

Limitations of Point Algebra

• In some cases, PA can NOT fully express the constraints

IA: Paper {b, a} Coffee

paper

coffee paper

coffee

x y z t

z t x y

Time increasing

y<z and t<x cannot exist simultaneously

Page 22: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

22

PA versus IA

• Determining consistency of statement in IA is NP-hard.– Polynomial-time algorithm (Allen’s) sound but

not complete

• PA constraint propagation is sound and complete. – Time: O(n3) and space: O(n2)

Page 23: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

23

PA versus IA

• PA trades off expressiveness with tractability

• PA is a restricted form of IA

• PA can be used to identify classes of easy case of IA

• Solution: Transform IA to PA– solve it as PA and – translate back to IA, cost= O(n2)

Page 24: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

24

Quantitative Temporal Networkssection 2

• Explicitly deal with number instead of relation

• Express the duration of time• starting point x1 • end point x2

• duration=x2-x1

– John travel by car from home to work takes him 30 to 40 minutes or he travel by bus takes him at least 60 minutes

30 x2-x1 40 or 60 x2-x1

Page 25: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

25

Example of a Quantitative Net• Simple Temporal Problem: Example 12.2.1 (page 346)

x0 =7:00am , x1 John left home between 7:10 to 7:20,

x2 John arrive work in 30 to 40 minutes

x3 Fred left home 10 to 20 minutes before x2,

x4 Fred arrive work between 8:00 to 8:10

Fred travel from home to work in 20 to 30 minutes

x0

x4x3

x2x1[10,20]

[30,40]

[10,20]

[20,30]

[60,70]

Page 26: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

26

Simple Temporal Problem (STP)

• A special class of temporal problems • can be processed in polynomial time• Each edge eij: ij is labeled by a single

interval [aij, bij]

• Constraint (aij xj-xi bij ) expressed by

(xj-xi bi ) ( xi-xj -aij )

(xj-xi 20) ( xi-xj -10)

i j[10, 20]

Page 27: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

27

Simple Temporal Problem

• We transform the problem to compute all pairs shortest paths of the distance graph.– Each constraint is represented by two edges,

one + and one -

• Constraint graph directed cyclic graph

x0

x120

-10

Page 28: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

28

Distance Graph of the STP

x4x3

x2

x0

x120

-10

40

-30

20-10

50

-40-60

70

• Run F-W all pair shortest path, is a special case of PC• If any pair of nodes has a negative cycle inconsistency• If consistent after F-W minimal & decomposable• Once d-graph formed, assembling a solution by checking against the previous assignment. • Total time: F-W O(n3) + Assembling O(n2) = O(n3).

Page 29: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

29

Temporal Constraint Graph

x0

x4x3

x2x1[10,20]

[30,40][60,oo]

[10,20]

[20,30][40,50]

[60,70]

Page 30: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

30

Temporal CSP Definition 12.2.2

– A set of variables with continuous domain– Each variable represents a time point– Each constraint is represented by a set of

intervals { [1, 12], [23, 45], …, [100, 104] }

– Unary constraint: a1 xi b1…

– Binary constraint: a1 xj-xi b1 …

– A tuple x=a1, …, an is a solution if x1=a1, x2=a2,…, xn=an do not violate any constraints

Page 31: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

31

Temporal Constraint Graph

x0

x4x3

x2x1[10,20]

[30,40][60,oo]

[10,20]

[20,30][40,50]

[60,70]

We are interested in1) is it consistent? (consistency problem)2) what are the possible time at which Xi could occur?

(minimal domain problem)3) what are all possible relationship between Xi and Xj?

(minimal constraint problem)

Page 32: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

32

Inference on TCSP

• T={ I1,…, Il }, S={J1,…, Jm}

• Union: (this is set union) – T S = { I1,…, Il , J1,…, Jm }

• Intersection: (this is set intersection)– T S = { zT and z S}

• Composition: (this is the cross product )

)},(),,(),,(),,{(

)},(),,{(

)},(),,{(

kdjcfdeckbjafbeaST

kjfeS

dcbaT

Page 33: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

33

The General TCS Problem

• Multiple intervals in the label of an edge

• A solution is – one interval per edge – for every edge – such that the network is consistent

• NP-complete, solved with search

Page 34: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

34

(Bad solution) to the TCSP

• Select one interval per edge• Decompose general TCSP into a set of separate

STPs (TCSP all STPs)

• Solve each STP separately– takes advantage of STP’s polynomial time complexity,

• Every solution in STP will be a solution for general TCSP

• Minimal TCSP all Minimal STPs [Theorem 12.2.11]

Page 35: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

35

Solving General TCSP

• Minimal network of a TCSP = Uall possible STPs {minimal network of each pos

sible labeling}

• Complexity of solving general TCSP by generating all labelings and solving them independently is O(n3ke), – k is maximum number of labels and – e is the number of edges

Page 36: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

36

Better Alternative: Meta-CSPMeta-CSP = CSP of a CSP

Model the TCSP as a CSP and solve it with BT

• Variables: edges of the constraint network• Domain: the intervals in the label of a given edge• Constraint: one global constraint, consistent STP• A solution:

– one interval per edge – such that the current network is a consistent STP

Page 37: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

37

An Example of Meta-CSP

x0

x4x3

x2x1i11=[10,20]i12=[35, 60]

i21=[30,40]i22=[60,70]i23=[25, 75]

i31=[10,23]i32=[24, 29]

i41=[20,30]i42=[40,50]

i51=[60,70]

Meta-CSPOriginal CSP

C1={ i11, i12}

C3={ i31, i32}

C2= { i21, i22, i23 }

C4={i41, i42}

C5={i51}

x1

x2

x3

x4

STP

Page 38: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

38

Search on Meta-CSP

• Root node is the start node (dummy node)• First level corresponds to (a STP with) an edge

e1 (variable)

• Each node at this level corresponds to e1 labeled with each of its intervals i1,

• The next level corresponds to (an STP with) two edges e1 and e2

• At a given level i, we have an STP with i edges..

Page 39: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

39

Search on Meta-CSPDummy node

C1

C2

C3

i11i21

i41

i21

i31

C21C22 C32C32 C22

i32 i31 i32

i42

i51 i51

C4

C5

Ci

Page 40: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

40

Summary: TCSP with search

• Running a BT search on a meta-CSP in which the variables are edges of the temporal network and domains are possible intervals

• Assign intervals to edges as long as no negative cycle of current STP (F-W)

• If partial assignment cannot be extended, backtrack

• Otherwise, add one more edge…

Page 41: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

41

Warning: Temporal Inference

• On STP: we tighten the unique interval– Composition: interval addition

[a,b]+[c,d]=[a+c, b+d]– Intersection: Interval intersection

[a,b][c,d]=[max(a,c), min(b,d)]

• On TCSP: we eliminate one or more intervals from the label, which is a set of intervals– Composition: cross product (the main factor for

exponential growth of inference process)– Intersection: set definition

Page 42: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

42

Examples on STP• STP: Each edge has only one label

i1=[1,3] i2= [6, 17]

i3=[5, 30]i3’=[7, 20]

Tighten Constraint Operation in NPC i1,, i2, i3 are the original constraints, we are tightening i3, let i3’ be the tightened constraint.

i3’ = i3 (i1 i2)

I = i1 i2 = [1+6, 3+17]=[7,20]

i3’= i3 I ={max(5, 7), min (30, 20)} = [7, 20]

i3’ is the newly tightened the constraint

Page 43: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

43

Examples on TCSP• TCSP: Each edge has multiple labels

i11=[1,2]i12=[11,12]i13=[21,22]

i21= [0, 1]i22=[16,17]i23=[23,24]

i3={ [1, 3], [12, 15], [23, 27] }

i3’={ [1,3], [17,19], [24, 26], [11, 13], [27, 29], [34, 36] [21, 23], [37, 39], [44, 46] } { [1, 3], [12, 15], [23, 27] } = { [1, 3], [12, 13], [24, 26], [23, 23], [27, 27] }

Page 44: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

44

PC on Quantitative Network

• A temporal constraint Tij is path consistent iff

Tij Tij (Tik Tik) for all k i and j.• A temporal network is path-consistent iff all its c

onstraints are path-consistent.• Problem:

– Continuous domain termination??? • Box-consistency! Work on endpoints only

– Integral TCSP: values are discrete, will terminate– Non integral TCSP, if extreme points are rational nu

mber, will terminate.

Page 45: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

45

Propagation on STP vs TCSP

• STP: – i3 = [5, 30]– i3’= [7, 20]– domain is tightened

• TCSP: – i3 = { [1, 3], [12, 15], [23, 27] } – i3’ = { [1, 3], [12, 13], [24, 26], [23, 23], [27, 27] }– domain is fractioned, source of combinatorial growth

• PC (a la Dechter) is source of combinatorial explosion approximation algoriths

• PC (a la Xu Lin, PL2) is poly-time & avoids this drawback

Page 46: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

46

PC on Quantitative Network

• Range of {[1, 5], [7, 9], [10, 18]} is {[1, 18]}

• Range of the network is the maximum range over all constraints.

• NPC-1(mirror PC-1): O(n3R3)• NPC-3 (mirror PC-3): O(n3R)• PC not guarantee minimal network or

decomposable.• Directional Path Consistency (a weaker version)

is more effective (alg. on pp. 357, Fig. 12.15)

Page 47: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

47

Fragmentation and Remedies

• Composition operation cause exponential growth. (Figure 12.16, page 358)

• Upper Lower Tightening (ULT)– Form STP by impose upper and lower bound on all

subintervals– Tighten this STP’constaints using F-W – The resulting consistent STP intersects with original

TCSP.– Iterate the above steps until no change or

inconsistency detected.

Page 48: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

48

ULT verse NPC

• ULT O(n3ek+e2k2)

• NPC O(n3R)

• Compare with NPC, ULT is guaranteed to converge in O(ek) iterations, even if interval boundary are not rational

• ULT is better than NPC

Page 49: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

49

Network-Based Algorithm

• Can TCSP exploit topology of its graph and use network-base algorithm?

• For Temporal CSP – Due to structure of TCSP (binary network), we can util

ize induced-width = 1 or 2 or tree-decomposition algorithms

– General tree-decomposition does not seem natural (enforce constraints of large scope)

– Cycle-set cannot be beneficial to TCSP

• Xu Lin exploits articulation points & triangulation in a new algorithm

Page 50: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

50

Translation between Representations PA and IA to TCSP

• PA to TCSP (example 12.19 page 361)

• PA network is a special case of TCSP lacking metric information

• IA cannot always be translated in to binary TCSP

Page 51: Temporal Constraint Networks Chapter 12

Chao ChenWednesday, February 26, 2003

51

Reference

• Lin Xu, Constraint propagation algorithm for temporal reasoning – presentation CSCE 821, Fall 2001

• M.C. Golumbic, Reasoning About time 1998• Xu & Choueiry, A new efficient algorithm for solving the

simple temporal problem, (draft) 2003• Xu & Choueiry, On the advantages of consistency of pat

h of length two for TCSP, (draft) 2003• Schwalb & Dechter, Processing Temporal Constraint Net

works 1997• Itay Meiri, Combining Qualitative and Quantitative constr

aints in Temporal Reasoning, 1995• Shapiro, Feldman, & Dechter, On the Complexity of Inter

val-based Constraint Networks 1999