Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chao Chen Wednesday, February 26, 2003 1 Temporal Constraint Networks Chapter 12 Chao Chen CSCE 990-06 Advanced Constraint Processing.

Similar presentations


Presentation on theme: "Chao Chen Wednesday, February 26, 2003 1 Temporal Constraint Networks Chapter 12 Chao Chen CSCE 990-06 Advanced Constraint Processing."— Presentation transcript:

1 Chao Chen Wednesday, February 26, 2003 1 Temporal Constraint Networks Chapter 12 Chao Chen CSCE 990-06 Advanced Constraint Processing

2 Chao Chen Wednesday, February 26, 2003 2 Outline 1.Gentle reminder… 2.Introduction 3.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

3 Chao Chen Wednesday, February 26, 2003 3 Main CSP Properties Node consistency Arc consistency Path consistency Minimality Decomposability (i.e., global consistency) Consistency

4 Chao Chen Wednesday, 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

5 Chao Chen Wednesday, 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

6 Chao Chen Wednesday, 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 (k  n) variables is extendable to a solution. PC  Minimal  Decomposable

7 Chao Chen Wednesday, 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

8 Chao Chen Wednesday, 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

9 Chao Chen Wednesday, February 26, 2003 9 Interval Algebra: Relations (a.k.a. Allen Interval Algebra, after James Allen [1983]) RelationSymbolInverse Examples X before Y bbi X equal Y== X meets Ymmi X overlaps Yooi X during Y ddi X starts Yssi X finishes Yffi xy x y xy x y x y y x x y

10 Chao Chen Wednesday, 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 { r 1, r 2, …, r k } J  (I r 1 J)  (I r 2 J)  …  (I r k J) disjunctive clauses Not interested in explicit relations over domains of variables Enumerated atomic relations between variables

11 Chao Chen Wednesday, 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

12 Chao Chen Wednesday, February 26, 2003 12 Interval Algebra: Example Story: 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

13 Chao Chen Wednesday, 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} Constraint Tightening A unique network equivalent to original network All constraints are subsets of original constraints Provides a more explicit representation Useful in answering many types of queries

14 Chao Chen Wednesday, 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

15 Chao Chen Wednesday, 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

16 Chao Chen Wednesday, 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

17 Chao Chen Wednesday, 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 Constraints are PA elements {, =} Cheaper than IA: –reasoning tasks are polynomial O(n 3 )

18 Chao Chen Wednesday, 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 =z, y z Coffee paper

19 Chao Chen Wednesday, 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 

20 Chao Chen Wednesday, February 26, 2003 20 PA: Consistency Inference Theorem 12.1.10 –Path-consistency decides the consistency in O(n 3 ) –Consistency and solution generation of PA networks can be accomplished in O(n 2 ) –Minimal network of a PA consistent network can be obtained using 4-consistency in O(n 4 ) –Minimal network of CPA networks can be obtained by path-consistency in O(n 3 )

21 Chao Chen Wednesday, February 26, 2003 21 Limitations of Point Algebra In some cases, PA can NOT fully express the constraints IA: Paper {b, a} Coffee paper coffeepaper coffee xyztxyzt ztxyztxy Time increasing y<z and t<x cannot exist simultaneously

22 Chao Chen Wednesday, 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(n 3 ) and space: O(n 2 )

23 Chao Chen Wednesday, 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(n 2 )

24 Chao Chen Wednesday, February 26, 2003 24 Quantitative Temporal Networks section 2 Explicitly deal with number instead of relation Express the duration of time starting point x 1 end point x 2 duration=x 2 -x 1 –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  x 2 -x 1  40 or 60  x 2 -x 1

25 Chao Chen Wednesday, 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 x4 x3 x2x1 [10,20] [30,40] [10,20] [20,30] [60,70]

26 Chao Chen Wednesday, February 26, 2003 26 Simple Temporal Problem (STP) A special class of temporal problems can be processed in polynomial time Each edge e ij : i  j is labeled by a single interval [a ij, b ij ] Constraint (a ij  x j -x i  b ij ) expressed by (x j -x i  b i )  ( x i -x j  -a ij ) (x j -x i  20)  ( x i -x j  -10) i j [10, 20]

27 Chao Chen Wednesday, 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 x1 20 -10

28 Chao Chen Wednesday, February 26, 2003 28 Distance Graph of the STP x4 x3 x2 x0 x1 20 -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(n 3 ) + Assembling O(n 2 ) = O(n 3 ).

29 Chao Chen Wednesday, February 26, 2003 29 Temporal Constraint Graph x0 x4 x3 x2x1 [10,20] [30,40] [60,oo] [10,20] [20,30] [40,50] [60,70]

30 Chao Chen Wednesday, 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: a 1  x i  b 1 … –Binary constraint: a 1  x j -x i  b 1 … –A tuple x=  a 1, …, a n  is a solution if x 1 =a 1, x 2 =a 2,…, x n =a n do not violate any constraints

31 Chao Chen Wednesday, February 26, 2003 31 Temporal Constraint Graph x0 x4 x3 x2x1 [10,20] [30,40] [60,oo] [10,20] [20,30] [40,50] [60,70] We are interested in 1)is it consistent? (consistency problem) 2)what are the possible time at which X i could occur? (minimal domain problem) 3) what are all possible relationship between X i and X j ? (minimal constraint problem)

32 Chao Chen Wednesday, February 26, 2003 32 Inference on TCSP T={ I 1,…, I l }, S={J 1,…, J m } Union: (this is set union) –T  S = { I 1,…, I l, J 1,…, J m } Intersection: (this is set intersection) –T  S = { z  T and z  S} Composition: (this is the cross product  )

33 Chao Chen Wednesday, 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

34 Chao Chen Wednesday, 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]

35 Chao Chen Wednesday, February 26, 2003 35 Solving General TCSP Minimal network of a TCSP = U all possible STPs {minimal network of each possible labeling} Complexity of solving general TCSP by generating all labelings and solving them independently is O(n 3 k e ), –k is maximum number of labels and –e is the number of edges

36 Chao Chen Wednesday, February 26, 2003 36 Better Alternative: Meta-CSP Meta-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

37 Chao Chen Wednesday, February 26, 2003 37 An Example of Meta-CSP x0 x4 x3 x2 x1 i 11 =[10,20] i 12 =[35, 60] i 21 =[30,40] i 22 =[ 60,70] i 23 =[25, 75] i 31 =[10,23] i 32 =[24, 29] i 41 =[20,30] i 42 =[40,50] i 51 =[60,70] Meta-CSPOriginal CSP C1={ i 11, i 12 } C3={ i 31, i 32 } C2= { i 21, i 22, i 23 } C4={i 41, i 42 } C5={i 51 } x1 x2 x3 x4 STP

38 Chao Chen Wednesday, 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 e 1 (variable) Each node at this level corresponds to e 1 labeled with each of its intervals i 1, The next level corresponds to (an STP with) two edges e 1 and e 2 At a given level i, we have an STP with i edges..

39 Chao Chen Wednesday, February 26, 2003 39 Search on Meta-CSP Dummy node C1 C2 C3 i 11 i 21 i 41 i 21 i 31 C 21 C 22 C 32 C 22 i 32 i 31 i 32 i 42 i 51 C4 C5 Ci

40 Chao Chen Wednesday, 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…

41 Chao Chen Wednesday, 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

42 Chao Chen Wednesday, February 26, 2003 42 Examples on STP STP: Each edge has only one label i 1 =[1,3] i 2 = [6, 17] i 3 =[5, 30] i 3 ’=[7, 20] Tighten Constraint Operation in NPC i 1,, i 2, i 3 are the original constraints, we are tightening i 3, let i 3 ’ be the tightened constraint. i 3 ’ = i 3  (i 1  i 2 ) I = i 1  i 2 = [1+6, 3+17]=[7,20] i 3 ’= i 3  I ={max(5, 7), min (30, 20)} = [7, 20] i 3 ’ is the newly tightened the constraint

43 Chao Chen Wednesday, February 26, 2003 43 Examples on TCSP TCSP: Each edge has multiple labels i 11 =[1,2] i 12 =[11,12] i 13 =[21,22] i 21 = [0, 1] i 22 =[16,17] i 23 =[23,24] i 3 ={ [1, 3], [12, 15], [23, 27] } i 3 ’={ [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] }

44 Chao Chen Wednesday, February 26, 2003 44 PC on Quantitative Network A temporal constraint T ij is path consistent iff T ij  T ij  (T ik  T ik ) for all k  i and j. A temporal network is path-consistent iff all its constraints 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 number, will terminate.

45 Chao Chen Wednesday, February 26, 2003 45 Propagation on STP vs TCSP STP: –i 3 = [5, 30] –i 3 ’= [7, 20] –domain is tightened TCSP: –i 3 = { [1, 3], [12, 15], [23, 27] } –i 3 ’ = { [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

46 Chao Chen Wednesday, 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(n 3 R 3 ) NPC-3 (mirror PC-3): O(n 3 R) PC not guarantee minimal network or decomposable. Directional Path Consistency (a weaker version) is more effective (alg. on pp. 357, Fig. 12.15)

47 Chao Chen Wednesday, 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.

48 Chao Chen Wednesday, February 26, 2003 48 ULT verse NPC ULT O(n 3 ek+e 2 k 2 ) NPC O(n 3 R) Compare with NPC, ULT is guaranteed to converge in O(ek) iterations, even if interval boundary are not rational ULT is better than NPC

49 Chao Chen Wednesday, 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 utilize 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

50 Chao Chen Wednesday, 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

51 Chao Chen Wednesday, 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 path of length two for TCSP, (draft) 2003 Schwalb & Dechter, Processing Temporal Constraint Networks 1997 Itay Meiri, Combining Qualitative and Quantitative constraints in Temporal Reasoning, 1995 Shapiro, Feldman, & Dechter, On the Complexity of Interval-based Constraint Networks 1999


Download ppt "Chao Chen Wednesday, February 26, 2003 1 Temporal Constraint Networks Chapter 12 Chao Chen CSCE 990-06 Advanced Constraint Processing."

Similar presentations


Ads by Google