Flexible Time in Temporal Planning
Flexible Time in Temporal Planning
When?
Contributions:
Brian Williams
Patrick Conrad
Simon Fang
Paul Morris
Nicola Muscettola
Pedro Santana
Julie Shah
John Stedl
Steve Levine
Andrew Wang Tuesday, Feb 16th
courtesy of JPL
Assignments
Problems Sets:
• Pset 1 due tomorrow (Wednesday) at 11:59pm
Interesting references:
• Dechter, R., I. Meiri, J. Pearl, “Temporal Constraint Networks,” Artificial
Intelligence, 49, pp. 61-95,1991.
Uhura
!$ !!#%'(#$!'$!&#$
)A3@ !$
Kirk
Burton
$%! $
Pike
! %#! !!# %$ ! %!#$%$$
! $
Sulu
$"%$
Bones
!$$(&#$
© source unknown. All rights reserved. This content is excluded
from our Creative Commons license. For moreinformation,
see [Link]
Flexible Time
=44:7<3
=<:7<3
4. Execute Plan 4. Dynamically Schedule Plan
To Execute a Temporal Plan
'1632C:3$44:7<3 '1632C:3$<:7<3
2. Test Consistency
3. Schedule Plan
=44:7<3
=<:7<3
4. Execute Plan
Describe Temporal Plan
• Activities to perform
• Relationships among activities
This image is in the public domain.
5@3AA '3BC>
BB;/F
Metric Temporal Relations
[10min, 30min]
Activity: Going to the store
K @3/2A6=C:2033/B3<E7B67<=<32/G=40/97<5
[0d, 1d]
Activity: Bake Bread Activity: Eat Bread
Simplify by reducing interval relations to
relations on timepoints.
Activity A
A- A+
Start Activity A End Activity A
Metric Temporal Relations
[10m,30m]
G- G+ 10 < [G+ - G-] < 30
K @3/2A6=C:2033/B3<E7B67<=<32/G=40/97<5
[0d,1d]
B+ E- 0 < [E- - B+] < 1
+034=@3, X Y ,/4B3@+
+;33BA, X Y ,;3B0G+
+=D3@:/>A, X Y ,=D3@:/>>320G +
+2C@7<5, XY ,1=<B/7<A+
+AB/@BA, X Y ,AB/@B320G+
+47<7A63A, Y X ,47<7A6320G+
+3?C/:A, Y
X ,3?C/:A+
+27A8=7<B,
Qualitative Temporal Relations
Expressed as timepoint inequalities:
[0,inf]
+034=@3, X Y + , X+ Y-
[0,0]
+;33BA, X Y + , X+ Y-
+=D3@:/>A, X Y , + and X- < Y+
+2C@7<5, XY , + and X+ < Y+
– called links.
Modeling Visualization
• [Link]
To Execute a Temporal Plan
'1632C:3$44:7<3
[1,10] B [1,1]
1. Describe Temporal Plan A D
[0,9] C [2,2]
2. Test Consistency
3. Schedule Plan
=44:7<3
=<:7<3
4. Execute Plan
Consistency of an STN
Input: STN <X, C> where Cj = < <Xk, Xi>, <aj, bj> >
[1,10] B [1,1]
A D
[0,9] C [2,2]
Schedule of an STN
Input: STN <X, C> where Cj = < <Xk, Xi>, <aj, bj> >
[1,10] B [1,1]
A D
[0,9] C [2,2]
How to find schedule?
• (Board)
"/>'(#B=7AB/<13@/>6
-l
l B –A u B –A u
l B –A A– B -l
K )>>3@0=C<2;/>>32B==CB5=7<5<=<<35/B7D3/@1
K !=E3@0=C<2;/>>32B=7<1=;7<5<35/B7D3/@1
• (Board)
Propagating to neighbors
Tighten neighbor’s execution windows:
wu
wl
xi = ti
Exposing Implicit Constraints
• (Board)
[10,20] [30,40] 20 40
+ !A !3
+ -10
!A -30
!3
[10,20] -10
20
[40,50] 50
'A '3
'A '3
-40
[60,70]
70
-60
APSP Graph: Windows of
Feasible Values
20 40
+ -10
!A -30
!3
-10
20
50
!/B3AB(7;3A
'A -40
'3
70
-60
K!A 7<- .
K!37<- .
Dispatchable form
Checking Consistency
• (Board)
6319@/>6=<A7AB3<1G
K =<A7AB3<B744 5@/>66/A<=<35/B7D3 1G1:3A
K 3B31B0G1=;>CB7<5A6=@B3AB>/B64@=;=<33D3<BB=/::=B63@A
K '7<5:3'=C@13'6=@B3AB%/B6'''%
K D3<B;CAB@3/16/::=B63@A
F/;>:3=47<1=<A7AB3<B1=<AB@/7<B
1
[2, 1]
A B A B
-2
=44:7<3
=<:7<3
4. Execute Plan 4. Dynamically Schedule Plan
Algorithm: offline scheduling
The original STN
[0,10] [1, 1]
[0,10] [2, 2]
Distance graph transformation
10 1
0 -1
10
2
-2
0
All pairs shortest path
10 1
A B C D
-1 -1
A 0 10 9 11 -1
9 1
B -1 0 -1 1 2
C 0 1 0 2 -2
0
D -2 -1 -2 0 11
-2
Computing a schedule
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Computing a schedule
[-∞, ∞]
10 1
-1 -1
[-∞, ∞] 9 1 -1 [-∞, ∞]
2
-2
0
[-∞, ∞]
11
-2
Initialize execution windows for each event in the plan
Computing a schedule
[-∞, ∞]
10 1
-1 -1
t=0 9 1 -1 [-∞, ∞]
2
-2
0
[-∞, ∞]
11
-2
Assign the first event
Computing a schedule
outgoing edges to neighbor: u’ = min(u, ti + wu)
incoming edges from neighbor: l’ = max(l, ti - wl)
[-∞, 10]
10 1
-1 -1
t=0 9 1 -1 [-∞, ∞]
2
-2
0
[-∞, ∞]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
outgoing edges to neighbor: u’ = min(u, ti + wu )
incoming edges from neighbor: l’ = max(l, ti - wl)
[1, 10]
10 1
-1 -1
t=0 9 1 -1 [-∞, ∞]
2
-2
0
[-∞, ∞]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
[1, 10]
10 1
-1 -1
t=0 9 1 -1 [-∞, ∞]
2
-2
0
[0, 9]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
[1, 10]
10 1
-1 -1
t=0 9 1 -1 [2, 11]
2
-2
0
[0, 9]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 [2, 11]
2
-2
0
[0, 9]
11
-2
Arbitrarily pick another time point and assign it...
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 [2, 11]
2
-2
0
[2, 2]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 [4, 4]
2
-2
0
[2, 2]
11
-2
Propagate updated time bounds to neighbors
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 [4, 4]
2
-2
0
t=2
11
-2
Pick another event and assign it
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 [4, 4]
2
-2
0
t=2
11
-2
Propagate to neighbors
Computing a schedule
t=3
10 1
-1 -1
t=0 9 1 -1 t=4
2
-2
0
t=2
11
-2
Assign the final event
Pre-computed schedules not robust
against fluctuations
• We’ve just computed a schedule:
tA = 0, tB = 3, tC = 2, tD = 4
• But what if there’s a disturbance?
– i.e., what if tB = 3.1?
– i.e., what if tB = 4?
– i.e., what if tB = 100?
• Pre-computed schedules not robust against
fluctuations!
• Solution: Dispatch dynamically online.
– Schedule events “on the fly,” after observing past event times.
– Increases robustness to many unanticipated fluctuations.
– Flexible temporal constraints allow this!
To Execute a Temporal Plan
'1632C:3$44:7<3 '1632C:3$<:7<3
=44:7<3
=<:7<3
4. Execute Plan 4. Dynamically Schedule Plan
How do we schedule online?
Naïve (wrong!) online dispatcher
Naïve (wrong!) online scheduling
[-∞, ∞]
10 1
-1 -1
t=0 9 1 -1 [-∞, ∞]
2
-2
0
[-∞, ∞]
11
-2
Arbitrarily picking next event…
Naïve (wrong!) online scheduling
t=3
10 1
-1 -1
t=0 9 1 -1 [2, 11]
2
-2
0
[0, 9]
11
-2
Arbitrarily picking next event…
Naïve (wrong!) online scheduling
t=3
10 1
-1 -1
t=0 9 1 -1 [4, 4]
2
-2
0
t=2
11
-2
...but wait! We just assigned a past time!
Enablement conditions dictate the
ordering of dispatched events
• Online: must assign monotonically increasing times
– whereas offline algorithms may assign in any order.
Enablement conditions dictate the
ordering of dispatched events
• Negative edges from APSP dictate ordering constraints
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Enablement conditions dictate the
ordering of dispatched events
• Negative edges from APSP dictate ordering constraints
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Corrected online dispatcher
Running online dispatcher
3
Running online dispatcher
-2
4
Running online dispatcher
-2
5
Running online dispatcher
-2
6
Running online dispatcher
-2
7
Running online dispatcher
-2
68
Running online dispatcher
-2
69
Running online dispatcher
-2
0
Running online dispatcher
-2
73
1
Online dispatching algorithm remarks
2
Online dispatcher efficiency
• Consider an STN with n edges.
• How many edges in APSP distance graph?
3
Online dispatcher efficiency
• Consider an STN with n edges.
• How many edges in APSP distance graph? n2.
4
Online dispatcher efficiency
• Consider an STN with n edges.
• How many edges in APSP distance graph? n2.
• How many neighbors to propagate to each step?
5
Online dispatcher efficiency
• Consider an STN with n edges.
• How many edges in APSP distance graph? n2.
• How many neighbors to propagate to each step? n.
6
Online dispatcher efficiency
• Consider an STN with n edges.
• How many edges in APSP distance graph? n2.
• How many neighbors to propagate to each step? n.
• Large STNs: propagation slow. Want to reduce this.
7
To Execute a Temporal Plan
'1632C:3$44:7<3 '1632C:3$<:7<3
=44:7<3
=<:7<3
4. Execute Plan 4. Dynamically Schedule Plan
7
79
You don’t need all those edges!
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
0
You don’t need all those edges!
10 1 1
-1 -1 -1
9 1 -1 1 -1
9
2
-2
0 0
11
1
You don’t need all those edges!
Let’s consider a specific triangle
of edges.
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
2
You don’t need all those edges!
Let’s consider a specific triangle
of edges.
Do we really need the bottom
10 1 edge?
-1 -1
9 1 -1
2
-2
0
11
-2
3
You don’t need all those edges!
Let’s consider a different triangle
of edges.
Do we really need the bottom
10 1 edge?
-1 -1
9 1 -1
2
-2
0
11
-2
4
A ropes analogy
10
10
Imagine a “unidirectional rope” of
length 10 constraining sliders on a track.
5
Rope analogy
10
10
11
10
1
11
11
10
1
11
88
Rope analogy
10 1
11
10
1
11
11
10
1
11
No. AD still constrained, but B could slide freely! Not the
same behavior. Collectively, AB and BD entail AD (but AD
does not entail both AB and AD).
0
Upper dominating edges - detection
from APSP
dAC
dAB
If dAB, dAC < 0 and
dAB + dBC = dAC
then AB dominates AC
dAC
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
3
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Upper dominated!
4
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Upper dominated!
5
Dominance example
Upper dominated!
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
6
Dominance example
Upper dominated!
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
7
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Upper dominated!
98
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Upper dominated!
99
Dominance example
Lower dominated!
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
0
Dominance example
Lower dominated!
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
1
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Lower dominated!
2
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2
Lower dominated!
3
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2 Lower dominated!
4
Dominance example
10 1
-1 -1
9 1 -1
2
-2
0
11
-2 Lower dominated!
5
Dominance example
1
-1
9 1 -1
6
Dominance example
10 1
-1 -1
9 1 -1 Original APSP distance graph
2
-2
0
11
-2 1
-1
... now in minimal 9 1 -1
dispatchable form!
0
7
Dominance example
[0,10] [1, 1]
Original STN
[0,10] [2, 2]
1
-1
... now in minimal 9 1 -1
dispatchable form!
0
8
FilteringAlgorithm(G)
Input: A dispatchable APSP-graph G
Output: A minimal dispatchable graph
1 for each pair of intersecting edges in G
2 if both dominate each other
3 if neither is marked
4 arbitrarily mark one for elimination
5 end if
6 else if one dominates the other
7 mark dominated edge for elimination
8 end if
9 end for
10 remove all marked edges from graph
11 return G
09
Avoiding Intermediate Graph
Explosion
K Problem:
L All pairs shortest path table computation consumed O(n2) space
L Only used as an intermediate - not needed after minimal dispatchable graph
obtained.
K Solution:
L Interleave process of APSP construction with edge elimination.
K Never have to build whole APSP graph.
[Tsarmardinos 1998]
0
Recap
• Recap
– To schedule online, times must monotonically increase - use enablement
conditions
– Running online allows greater flexibility to fluctuations
– However, propagation costs can be large for large graphs
– Can reduce edges by using domination to make graph smaller
1
To Execute a Temporal Plan
'1632C:3$44:7<3 STN D Graph
[1,10] B [1,1] 10 B 1
-1
1. Describe Temporal Plan A D A -1
2 D
9
[0,9] C [2,2] 0 C -2
=44:7<3
=<:7<3
4. Execute Plan
(=;7<7;7H3:/B3<1G
@3;=D3@32C<2/<B
2. Test Consistency
3253A
B [1,1]
=44:7<3 t=3
=<:7<3 t=0 B [1,1] t=4
A [1,1] D
4. Dynamically Execute Plan
[0,9] C
t=2
-"CA13BB=:/"=@@7A(A/;/@27<=A &.
5
MIT OpenCourseWare
[Link]
For information about citing these materials or our Terms of Use, visit: [Link]