Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
8. Temporal Reasoning 8. Temporal Reasoning • Motivations • Applications • Time Representation • Hybrid representation : the model TemPro Malek Mouhoub, CS 820 Fall 2005 1 Motivations Motivations • Most real-world problems have spatial and|or temporal setting. • Traditional mathematical formulations often not useful for automated reasoning – continous rather than discrete – require complete, precise information • Qualitative and logical representations offer computational advantages Malek Mouhoub, CS 820 Fall 2005 2 Applications Applications • Natural Language Processing – Joe will have finished before dinner • Temporal Databases – When was Alfredo last seen by Dr Schweitzer ? – How often has Jane been hospitalized ? • Robotics, GIS, computer games – How long until I reach X. – I must reach X while R2D2 is active. • Concurrent Programming – when can process P1 add an element to the buffer ? – Can P1 and P2 write to File F at the same time ? Malek Mouhoub, CS 820 Fall 2005 3 Applications (cont) Applications (cont) • Reactive Systems – Is it possible for the system to reach Deadlock ? – Could one process exclude another process from ever performing its next operation ? • Real-time Systems – Will the velocity calculation always meet its deadline ? – What is the maximum data rate that can be handled ? – It is possible to schedule a list of tasks within a given deadline ? • Scheduling and Planning – Can task 6 and 9 be done in any order ? – What needs to be done before doing task 12 ? • Archaelogy – Create a chronology for objects found in egyptian graves. • Molecular Biology Malek Mouhoub, CS 820 Fall 2005 4 Applications (cont) Temporal Reasoning Time Representation Symbolic Hybrid Reified Logic Point Interval Algebra Algebra Malek Mouhoub, CS 820 Fall 2005 Numeric Resolution Techniques Operations Research Domains Arithmetic Equations of Variables and Inequations Values C.S.P Decomposition Local + Consistency Backtrack + Search Backtrack Search 5 Time representation Time representation • Symbolic representation • Numeric representation • Hybrid representation Malek Mouhoub, CS 820 Fall 2005 6 Time representation Symbolic representation of time Predicate Calculus : – Meet(John,Laurie,April12) – Problem : time is represented as any other argument. Modal Logic : – An extension of predicate calculus which includes notation for arguing about “when” statements are true. – A logic with a notion of time included. The formulas can express facts about past, present, and future states. – Three operators : ∗ °F : F is true at the next time instant. ∗ 2F : F is true from now. ∗ 3F : F is eventually true. – Two connectives : ∗ x ∪ y :x is true until y is true. ∗ x P y : x precedes y. – Linear time (considers only one possible future) and branching time (several alternative futures). In branching temporal logic we have 2 extra operators : ∗ A (for ”all futures”), ∗ and E (for ”some future”). ∗ Examples : · A(work U go home) means : I will work until I go home. · E (work U go home) means : I may work until I go home. Malek Mouhoub, CS 820 Fall 2005 7 Time representation Symbolic representation of time Reified Logic : – TRUE(preposition,temporal qualification) or < φ, t > – Allen Algebra (Interval Algebra) – Point Algebra Malek Mouhoub, CS 820 Fall 2005 8 Time representation Symbolic representation of time Allen Algebra : – Event : Couple (p.I) where p is a proposition and I the interval where p is true. – Given two events ev1 = (p1 , I1 ), ev2 = (p2 , I2 ), the qualitative relation between ev1 and ev2 can be represented as follows : R(ev1 , ev2 ) = I1 r1 ∨ · · · ∨ rn I2 The ri ’s are basic Allen relations. Point Algebra : – Think in terms of time points instead of intervals. – Basic relations : Malek Mouhoub, CS 820 Fall 2005 <, >, = 9 Time representation Relation Symbol Inverse X precedes Y P P- X equals Y E E X meets Y M M- X overlaps Y O O- X during Y D D- X starts Y S S- X finishes Y F F- Meaning X Y X Y X Y X Y X X Y Y Y X Figure 1: Allen Primitives. Malek Mouhoub, CS 820 Fall 2005 10 Time representation Symbolic representation of time Nonlinear Time : – Most temporal models (points or interval) represent Linear Time : ∗ For all t1 , t2 : t1 < t2 or t1 > t2 or t1 = t2 – For some applications Partially Ordered Time Models is more appropriate : ∗ Two time points can be Unrelated : t1 ||t2 ∗ For interval models, number of relations increases from 13 (in linear time) to 29. Malek Mouhoub, CS 820 Fall 2005 11 Time representation Nonlinear Time Applications : • Events in a distributed system • Military intelligence information gathered by unsynchronized agents • Relative time : astronomical events Malek Mouhoub, CS 820 Fall 2005 12 Time representation Nonlinear Time Partially Followed Partially Starts Partially Precedes Unrelated Figure 2: Partially Ordered Temporal Interval Relations Malek Mouhoub, CS 820 Fall 2005 13 Time representation Numeric representation of time Arithmetic Inequations : A−B ≥d Temporal Windows : [begintime, endtime, step, duration] Begintime SOPO Endtime Tr Ui Interval Malek Mouhoub, CS 820 Fall 2005 Step 14 Time representation Temporal Constraint Networks • Nodes can represent points. Arcs represent relation between points (before,after,equal). • Nodes can be intervals. Arcs are temporal interval relations. • Nodes can represent either poins or intervals. Arcs are point, interval, point-interval or interval-point relations. • Relations can be from any appropriate model (linear/non-linear, discrete/dense, . . . etc). Malek Mouhoub, CS 820 Fall 2005 15 Time representation Qualitative Network Fred was reading the paper while eating his breakfast. He put the paper down and drank the last of his coffee. After breakfast he went for a walk. Breakfast P EDD-OO-SS-FFD Paper DOS Coffee Walk Paper Coffee Breakfast Walk Solution Initial problem Figure 3: Interval Algebra Constraint Network Malek Mouhoub, CS 820 Fall 2005 16 Time representation Quantitative Network : the TCSP model John goes to work either by car (30-40 minutes), or by bus (at least 60 minutes). Fred goes to work either by car (20-30 minutes), or in a carpool (40-50 minutes) Today John left home between 7:10 and 7:20, and Fred arrived at work between 8:00 and 8:10. We also know that John arrived at work about 10-20 minutes after Fred left home. We wish to answer queries such as: “Is the information in the story consistent?”, “Is it possible that John took the bus, and Fred used the carpool?”, “What are the possible times at which Fred left home?”, and so on. [30,40] [60, ∝ ] 1 [10,20] 2 [10,20] 0 3 [20,30] [40,50] 4 Nodes: 0 = start time of the story 1 = John left home 2 = John arrived at work 3 = Fred left home 4 = Fred arrived at work [60,70] Malek Mouhoub, CS 820 Fall 2005 17 Time representation Quantitative Network : the Disjunctive Temporal Problem (DTP) A DTP is defined by a pair (X, C), where : • each xi ∈ X is a time point, • each ci (∈ C) = ci1 ∨ ci2 . . . cin , • and each cij = x − y ≤ b where x, y ∈ X and b ∈ R. Example C1 : c11 : a − b ≤ 10 C2 : c21 : b − a ≤ −15 ∨ c22 : c − a ≤ −25 C3 : c31 : b − c ≤ 10 C4 : c41 : a − c ≤ 20 Malek Mouhoub, CS 820 Fall 2005 18 Time representation Hybrid Network : Meiri’s TCSP network John and Fred work for a company that has local and main offices in Los Angeles, They usually work at the local office, in which case it takes John less than 20 minutes and Fred 15-20 minutes to get to work. Twice a week John works at the main office, in which case his commute to work takes at least 60 minutes. Today John left home between 7:05-7:10 a.m., and Fred arrived at work between 7:50-7:55 a.m. We also know that Fred and John met at a traffic light on their way to work. P 2 P 3 F S J {(0,20),(60,+00)} S Si D Di F Fi O Oi E S P 1 Malek Mouhoub, CS 820 Fall 2005 {(15,20)} F F {(0,5)} P 0 {(50,55)} P 4 Nodes: Time Intervals J = John is going to work F = Fred is going to work Time Points P0 = Begining story P1 = John leaves home P2 = John arrives at work P3 = Fred leaves home P4 = Fred arrivesat work 19 Hybrid representation of time Hybrid representation of time 1. John, Mary and Wendy separately rode to the soccer game. 2. It takes John 30 minutes, Mary 20 minutes and Wendy 50 minutes to get to the soccer game. 3. John either started or arrived just as Mary started. 4. John left home between 7:00 and 7:10. 5. Mary arrived at work between 7:55 and 8:00. 6. Wendy left home between 7:00 and 7:10. 7. John’s trip overlapped the soccer game. 8. Mary’s trip took place during the game or else the game took place during her trip. 9. The soccer game starts at 7:30 and lasts 105 minutes. 10. John either started or arrived just as Wendy started. 11. Mary and Wendy arrived together but started at different times. Malek Mouhoub, CS 820 Fall 2005 20 Hybrid representation of time Hybrid representation : the model TemPro Problem involving numeric and symbolic −→ CSP time information using : • the interval algebra of Allen • and a discrete representation of time Malek Mouhoub, CS 820 Fall 2005 21 Hybrid representation of time Hybrid representation : the model TemPro A Temporal Constraint Satisfaction Problem involves : • N = {EV1 , . . . , EVn }. • D = {D1 , . . . , Dn }. • R. Solving a temporal constraint satisfaction problem consists in finding all sets of values {occ1j1 , . . . , occnjn } for {EV1 , . . . , EVn } satisfying all relations belonging to R. Malek Mouhoub, CS 820 Fall 2005 22 Hybrid representation : the model TemPro Hybrid representation : the model TemPro Basic Notions : Time line, Interval. Event : couple (p, I) where p is a proposition and I the interval under which p holds. Quantitative Constraints : SOPO, defined by the fourfold : [begintime, endtime, duration, step] SOPO Time line Interval Step Qualitative Constraints : disjunctions of Allen primitives. Malek Mouhoub, CS 820 Fall 2005 23 Hybrid representation : the model TemPro John Mary Wendy Soccer Figure 4: John, Mary and Wendy separately rode to the soccer game. Malek Mouhoub, CS 820 Fall 2005 24 Hybrid representation : the model TemPro [? , ?, 30 , 1] John [? , ? , 50 , 1] [? , ? , 20 , 1] Mary Wendy Soccer Figure 5: It takes John 30 minutes, Mary 20 minutes and Wendy 50 minutes to get to the soccer game. Malek Mouhoub, CS 820 Fall 2005 25 Hybrid representation : the model TemPro [? , ?, 30 , 1] E S S- M John [? , ? , 50 , 1] [? , ? , 20 , 1] Mary Wendy Soccer Figure 6: John either started or arrived just as Mary started. Malek Mouhoub, CS 820 Fall 2005 26 Hybrid representation : the model TemPro {(0 30) .. (10 40)} E S S- M John {(0 50) .. (10 60)} {(35 55) .. (40 60)} Mary Wendy Soccer Figure 7: John left home between 7:00 and 7:10. Mary arrived at work between 7:55 and 8:00. Wendy left home between 7:00 and 7:10. Malek Mouhoub, CS 820 Fall 2005 27 Hybrid representation : the model TemPro {(0 30) .. (10 40)} E S S- M John {(0 50) .. (10 60)} {(35 55) .. (40 60)} Mary Wendy O Soccer Figure 8: John’s trip overlapped the soccer game. Malek Mouhoub, CS 820 Fall 2005 28 Hybrid representation : the model TemPro {(0 30) .. (10 40)} E S S- M John {(0 50) .. (10 60)} {(35 55) .. (40 60)} Mary Wendy O D DSoccer Figure 9: Mary’s trip took place during the game or else the game took place during her trip. Malek Mouhoub, CS 820 Fall 2005 29 Hybrid representation : the model TemPro {(0 30) .. (10 40)} E S S- M John {(0 50) .. (10 60)} {(35 55) .. (40 60)} Mary Wendy O D DSoccer {(30 135)} Figure 10: The soccer game starts at 7:30 and lasts 105 minutes. Malek Mouhoub, CS 820 Fall 2005 30 Hybrid representation : the model TemPro {(0 30) .. (10 40)} E S S- M John ESS-M {(0 50) .. (10 60)} {(35 55) .. (40 60)} Mary Wendy O D DSoccer {(30 135)} Figure 11: John either started or arrived just as Wendy started. Malek Mouhoub, CS 820 Fall 2005 31 Hybrid representation : the model TemPro {(0 30) .. (10 40)} John E S S- M {(35 55) .. (40 60)} Mary ESS-M {(0 50) .. (10 60)} FF- Wendy O D DSoccer {(30 135)} Figure 12: Mary and Wendy arrived together but started at different times. Malek Mouhoub, CS 820 Fall 2005 32 Hybrid representation : the model TemPro Hybrid representation : the model TemPro Example : 3 tasks T1 , T2 and T3 are processed by a mono processor machine M. A task T4 must be processed before T1 and T2 . T1 : 3h,10:00,15:00. T2 : 3h,20:00,24:00. T3 : 4h,7:00,12:00. T4 : 1h,9:00,11:00. Malek Mouhoub, CS 820 Fall 2005 33 Hybrid representation : the model TemPro [20,24,1,3]={(20 23),(21 24)} [7,12,1,4]={(7 11),(8 12)} P v PT T 2 P v P- 3 P v P- I P- PT1 T4 [10,15,1,3]={(10 13),(11 14),(12 15)} [9,11,1,1]={(9 10),(10 11)} I : The universal relation(disjunction of the 13 basic Allen relations). P : Precedes, P- : precedes inverse. Figure 13: A qualitative and quantitative constraint graph. Malek Mouhoub, CS 820 Fall 2005 34 Hybrid representation : the model TemPro Hybrid representation : the model TemPro Resolution method based on constraint propagation : • Numeric → Symbolic Conversion. • Perform Local Consistency Algorithms. – Arc and Path Consistencies. • Backtrack Search. Malek Mouhoub, CS 820 Fall 2005 35 Hybrid representation : the model TemPro {(0 30) .. (10 40)} John E S S- M {(35 55) .. (40 60)} Mary E S S-M {(0 50) .. (10 60)} F F- Wendy O D DSoccer {(30 135)} Figure 14: Numeric → Symbolic Conversion. Malek Mouhoub, CS 820 Fall 2005 36 Hybrid representation : the model TemPro {(0 30)..(4 34),(5 35) .. (10 40)} John M {(35 55) .. (40 60)} Mary S F {(0 50) .. (4 54),(5 55) .. (10 60)} Wendy O D Soccer {(30 135)} Figure 15: Arc Consistency. Malek Mouhoub, CS 820 Fall 2005 37 Hybrid representation : the model TemPro {(5 35) .. (10 40)} John M {(35 55) .. (40 60)} Mary S {(5 55) .. (10 60)} F Wendy O D O Soccer {(30 135)} Figure 16: Path Consistency. Malek Mouhoub, CS 820 Fall 2005 38 Hybrid representation : the model TemPro GAs for TemPro Basic notions : • Individual and random Individual. • Population. • Fitness (evaluation) function. • Mutation. • Crossover. Malek Mouhoub, CS 820 Fall 2005 39 Hybrid representation : the model TemPro {(5 35), (6 36) .. (10 40)} John M S {(35 55) .. (39 59) ,(40 60)} Mary {(5 55) .. (10 60) } F Wendy O D O Soccer { (30 135) } random individual Population Figure 17: GA representation of TCSPs. Malek Mouhoub, CS 820 Fall 2005 40 Hybrid representation : the model TemPro {(5 35), (6 36) .. (10 40)} conflict conflict John M S {(35 55) .. (39 59) ,(40 60)} Mary {(5 55) .. (10 60) } F Wendy O D O conflict Soccer { (30 135) } random individual (fitness=3) Population Figure 18: GA representation of TCSPs. Malek Mouhoub, CS 820 Fall 2005 41 Hybrid representation : the model TemPro Fitness = 3 (6 36) (39 59) (30 135) (10 60) Fitness = 4 (6 36) (40 60) (30 135) (10 60) Figure 19: Mutation Operator. Malek Mouhoub, CS 820 Fall 2005 42 Hybrid representation : the model TemPro Fitness = 3 Fitness = 3 (6 36) (39 59) (30 135) (10 60) (5 35) (40 60) (30 135) (9 59) (6 36) (40 60) (30 135) (10 60) Fitness = 4 Figure 20: Crossover Operator. Malek Mouhoub, CS 820 Fall 2005 43 Hybrid representation : the model TemPro 1. 2. 3. 4. begin t←1 // P (t) denotes the population containing the current solution eval ← evaluate P (t) 5. 6. 7. 8. 9. while termination condition is not satisfied do t←t+1 select P (t) from P (t − 1) alter P (t) evaluate P (t) 10. endwhile 11. if solution found then 12. return P(t) 13. end Malek Mouhoub, CS 820 Fall 2005 44