Title: IJCAI Introduction
1Temporal Plan Execution Dynamic Scheduling and
Simple Temporal Networks
Brian C. Williams 16.412J/6.834J December 2nd,
2002
1
2Goals and Environment Constraints
Projective Task Expansion
Temporal NetworkSolver
Temporal Planner
Temporal Plan
Task Dispatch
Dynamic Scheduling and Task Dispatch
Goals
Modes
Reactive Task Expansion
Commands
Observations
3Goals and Environment Constraints
Projective Task Expansion
Temporal NetworkSolver
Temporal Planner
Temporal Plan
Task Dispatch
Dynamic Scheduling and Task Dispatch
Goals
Modes
Reactive Task Expansion
Commands
Observations
4Outline
- Temporal Representation
- Qualitative temporal relations
- Metric constraints
- Temporal Constraint Networks
- Temporal Plans
- Temporal Reasoning forPlanning and Scheduling
- Flexible Execution throughDynamic Scheduling
5Qualitative Temporal Constraints(Allen 83)
- x before y
- x meets y
- x overlaps y
- x during y
- x starts y
- x finishes y
- x equals y
- y after x
- y met-by x
- y overlapped-by x
- y contains x
- y started-by x
- y finished-by x
- y equals x
X
Y
X
Y
X
Y
Y
X
Y
X
Y
X
Y
X
6Example Deep Space One Remote Agent Experiment
Timer
Max_Thrust
Idle
Idle
SEP_Segment
Accum
SEP Action
Attitude
Poke
7Qualitative Temporal ConstraintsMaybe Expressed
as Inequalities (Vilain, Kautz 86)
- x before y X lt Y-
- x meets y X Y-
- x overlaps y (Y- lt X) (X- lt Y)
- x during y (Y- lt X-) (X lt Y)
- x starts y (X- Y-) (X lt Y)
- x finishes y (X- lt Y-) (X Y)
- x equals y (X- Y-) (X Y)
Inequalities may be expressed as binary interval
relations X - Y- lt -inf, 0
8Metric Constraints
- Going to the store takes at least 10 minutes and
at most 30 minutes. - 10 lt T(store) T-(store) lt 30
- Bread should be eaten within a day of baking.
- 0 lt T(baking) T-(eating) lt 1 day
- Inequalities, X lt Y- , may be expressed as
binary interval relations - - inf lt X - Y- lt 0
9Metric Time Quantitative Temporal Constraint
Networks(Dechter, Meiri, Pearl 91)
- A set of time points Xi at which events occur.
- Unary constraints (a0 lt Xi lt b0 ) or (a1 lt Xi lt
b1 ) or . . . - Binary constraints (a0 lt Xj - Xi lt b0 ) or (a1
lt Xj - Xi lt b1 ) or . . .
10Temporal Constraint Satisfaction Problem (TCSP)
- lt Xi, Ti , Tij gt
- Xi continuous variables
- I1, . . . ,In interval constraints
- where Ii ai,bi interval
- Ti (ai Xi bi) or . . . or (ai Xi bi)
- Tij (a1 Xi - Xj b1) or ... or (an Xi - Xj
bn)
Dechter, Meiri, Pearl, aij89
11TCSP Are Visualized UsingDirected Constraint
Graphs
12Simple Temporal Networks(Dechter, Meiri, Pearl
91)
- Simple Temporal Networks
- A set of time points Xi at which events occur.
- Unary constraints (a0 lt Xi lt b0 ) or (a1 lt Xi lt
b1 ) or . . . - Binary constraints (a0 lt Xj - Xi lt b0 ) or (a1
lt Xj - Xi lt b1 ) or . . .
- Sufficient to represent
- most Allen relations
- simple metric constraints
- Cant represent
- Disjoint tokens
13Simple Temporal Network
14A Completed Plan Forms an STN
Thrust Goals
Power
Attitude
Thrust (b, 200)
Engine
Off
Warm Up
15A Completed Plan Forms an STN
????????????
????????
????????
?????????
??????
??????
?????????
16Outline
- Temporal Representation
- Temporal Reasoning forPlanning and Scheduling
- TCSP Queries
- Induced Constraints
- Plan Consistency
- Static Scheduling
- Flexible Execution throughDynamic Scheduling
17TCSP Queries(Dechter, Meiri, Pearl, AIJ91)
- Is the TCSP consistent?
- What are the feasible times for each Xi?
- What are the feasible durations between each Xi
and Xj? - What is a consistent set of times?
- What are the earliest possible times?
- What are the latest possible times?
18Goals
Histories(?)
Projective Task Expansion
Scheduler
Flexible Sequence (Plans)
Task Dispatch
Plan Runner
Goals
Modes
Reactive Task Expansion
Commands
Observations
19TCSP Queries(Dechter, Meiri, Pearl, AIJ91)
- Is the TCSP consistent? Planning
- What are the feasible times for each Xi?
- What are the feasible durations between each Xi
and Xj? - What is a consistent set of times? Scheduling
- What are the earliest possible times? Scheduling
- What are the latest possible times?
20To Query an STN Map to aDistance Graph Gd lt
V,Ed gt
Edge encodes an upper bound on distance to target
from source.
Xj - Xi bij Xi - Xj - aij
Tij (aij Xj - Xi bij)
21Gd Induces Constraints
- Path constraint i0 i, i1 . . ., ik j
- Conjoined path constraints result in the
shortest path as bound - where dij is the shortest path from i to j
22Shortest Paths of Gd
23STN Minimum Network
d-graph
STN minimum network
24Conjoined Paths are Computed using All Pairs
Shortest Path(e.g., Floyd-Warshalls algorithm )
- 1. for i 1 to n do dii 0
- 2. for i, j 1 to n do dij aij
- 3. for k 1 to n do
- 4. for i, j 1 to n do
- 5. dij mindij, dik dkj
k
i
j
25Testing Plan Consistency
No negative cycles -5 gt TA TA 0
d-graph
26Latest Solution
Node 0 is the reference.
20
40
0
1
2
-10
-30
-10
20
50
4
3
-40
-60
70
d-graph
27Solution Latest Times
S1 (d01, . . . , d0n)
20
40
0
3
1
-10
-30
-10
20
50
4
2
-40
-60
70
28Earliest Solution
Node 0 is the reference.
20
40
0
1
2
-10
-30
-10
20
50
4
3
-40
-60
70
d-graph
29Solution Earliest Times
S1 (-d10, . . . , -dn0)
20
40
0
1
3
-10
-30
-10
20
50
4
2
-40
-60
70
30SchedulingFeasible Values
Latest Times
- X1 in 10, 20
- X2 in 40, 50
- X3 in 20, 30
- X4 in 60, 70
d-graph
Earliest Times
31Scheduling without Search Solution by
Decomposition
- Select value for 1
- 15 10,20
d-graph
32Scheduling without Search Solution by
Decomposition
- Select value for 1
- 15 10,20
d-graph
33Solution by Decomposition
- Select value for 2, consistent with 1
- 45 40,50, 1530,40
d-graph
34Solution by Decomposition
- Select value for 2, consistent with 1
- 45 45,50
d-graph
35Solution by Decomposition
- Select value for 2, consistent with 1
- 45 45,50
d-graph
36Solution by Decomposition
- Select value for 2, consistent with 1
- 45
- Select value for 3, consistent with 1 2
- 30 20,30, 1510,20,45-20,-10
d-graph
37Solution by Decomposition
- Select value for 2, consistent with 1
- 45
- Select value for 3, consistent with 1 2
- 30 25,30
d-graph
38Solution by Decomposition
- Select value for 2, consistent with 1
- 45
- Select value for 3, consistent with 1 2
- 30 25,30
d-graph
39Solution by Decomposition
- Select value for 2, consistent with 1
- 45
- Select value for 3, consistent with 1 2
- 30
d-graph
- Select value for 4, consistent with 1,2 3
40In General Solving TCSPs is NP Hard
- Forward(I1, . . ., Ii)
- 1. if i m then
- 2. M M union Solve-STP(I1, . . ., Im), and
- 3. Go-Back(I1, . . ., Im)
- 4. Ci1 empty
- 5. for every Ij in Di1 do
- 6. if Consistent-STP (I1, . . . , Ii , Ij), then
- 7. for i, j 1 to n do
- 8. dij mindij, dik dkj
41Outline
- Temporal Representation
- Temporal Reasoning forPlanning and Scheduling
- Flexible Execution throughDynamic Scheduling
42Goals and Environment Constraints
Projective Task Expansion
Temporal NetworkSolver
Temporal Planner
Temporal Plan
Task Dispatch
Dynamic Scheduling and Task Dispatch
Goals
Modes
Reactive Task Expansion
Commands
Observations
43Executing Flexible Temporal Plans Muscettola,
Morris, Pell et al.
- Handling delays and fluctuations in task
duration - Least commitment temporal plans leave room to
adapt
- flexible execution adapts through dynamic
scheduling - Assigns time to event when executed.
44Issues in Flexible Execution
- How do we minimize execution latency?
- How do we schedule at execution time?
45Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
46Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
47Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
48Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
49Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
50Time Propagation Can Be Costly
EXECUTIVE
CONTROLLED SYSTEM
51Issues in Flexible Execution
- How do we minimize execution latency?
- Propagate through a small set of neighboring
constraints. - How do we schedule at execution time?
52Compile to Efficient Network
EXECUTIVE
CONTROLLED SYSTEM
53Compile to Efficient Network
EXECUTIVE
CONTROLLED SYSTEM
54Compile to Efficient Network
EXECUTIVE
CONTROLLED SYSTEM
55Issues in Flexible Execution
- How do we minimize execution latency?
- Propagate through a small set of neighboring
constraints. - How do we schedule at execution time?
56Issues in Flexible Execution
- How do we minimize execution latency?
- Propagate through a small set of neighboring
constraints. - How do we schedule at execution time?
- Through decomposition?
57Dynamic Scheduling by Decomposition
Simple Example
58Dynamic Scheduling by Decomposition
- Compute APSP graph
- Decomposition enables assignment without search
Equivalent Distance Graph Representation
59Assignment by Decomposition
11
lt0,10gt
10
-1
0
1
lt2,11gt
t 0
1
-1
0
-2
2
lt0,10gt
10
-2
60Assignment by Decomposition
11
t 3
10
-1
0
1
lt0,0gt
lt2,11gt
1
-1
0
-2
2
lt0,10gt
10
-2
61Assignment by Decomposition
But C now has to be executed at t 2, which is
already in the past!
- Solution
- Assignments must monotonically increase in
value. - Execute first, all APSP neighbors with negative
delays.
11
t 3
10
-1
0
1
lt0,0gt
lt4,4gt
1
-1
0
-2
2
lt2,2gt
10
-2
62Dispatching Execution Controller
- Execute an event when enabled and active
- Enabled - APSP Predecessors are completed
- Predecessor a destination of a negative edge
that starts at event. - Active - Current time within bound of task.
63Dispatching Execution Controller
- Initially
- E Time points w/o predecessors
- S
- Repeat
- Wait until current_time has advanced st
- Some TP in E is active
- All time points in E are still enabled.
- Set TPs execution time to current_time.
- Add TP to S.
- Propagate time of execution to TPs APSP
immediate neighbors. - Add to A, all immediate neighbors that became
enabled. - TPx enabled if all negative edges starting at TPx
have their destination in S.
64Propagation is Focused
- Propagate forward along positive edges to tighten
upper bounds. - forward prop along negative edges is useless.
- Propagate backward along negative edges to
tighten lower bounds. - Backward prop along positive edges useless.
65Propagation Example
S A
11
10
-1
lt0,0gt
-1
1
-1
1
0
-2
9
2
-2
66Propagation Example
S A
11
lt1,10gt
10
-1
lt0,0gt
-1
1
-1
1
0
-2
9
2
-2
67Propagation Example
S A
11
lt1,10gt
10
-1
lt0,0gt
-1
1
-1
1
0
-2
9
2
lt0,9gt
-2
68Propagation Example
S A
11
lt1,10gt
10
-1
lt2,11gt
lt0,0gt
-1
1
-1
1
0
-2
9
2
lt0,9gt
-2
69Propagation Example
S A
E
C
11
lt1,10gt
10
-1
lt2,11gt
lt0,0gt
-1
1
-1
1
0
-2
9
2
lt0,9gt
-2
70Reducing Execution Latency
- Execution time is O(n)
- worst case
- best case
- Filtering
- some edges are redundant
- remove redundant edges
11
t 3
10
-1
0
1
lt0,0gt
lt2,11gt
1
-1
0
-2
2
lt0,10gt
10
-2
71- Edge Dominance
- Eliminate edge that is redundant due to the
triangle inequality AB BC AC
72- Edge Dominance
- Eliminate edge that is redundant due to the
triangle inequality AB BC AC
150
-100
100
80
-50
-20
73- Edge Dominance
- Eliminate edge that is redundant due to the
triangle inequality AB BC AC
150
-100
80
-50
-20
74- Edge Dominance
- Eliminate edge that is redundant due to the
triangle inequality AB BC AC
150
-100
80
-50
75An Example of Edge Filtering
- Start off with the APSP network
76An Example of Edge Filtering
11
10
-1
-1
1
-1
1
0
-2
9
2
-2
77An Example of Edge Filtering
11
-1
-1
1
-1
1
0
-2
9
2
-2
78An Example of Edge Filtering
11
-1
-1
1
-1
1
0
-2
9
2
79An Example of Edge Filtering
11
-1
-1
1
-1
1
0
9
2
80An Example of Edge Filtering
11
-1
1
-1
1
0
9
2
81An Example of Edge Filtering
-1
1
-1
1
0
9
2
82An Example of Edge Filtering
-1
1
-1
1
0
9
83An Example of Edge Filtering
- Resulting network has less edges than the original
9
1
1
-1
-1
0
84Avoiding Intermediate Graph Explosion
- Problem
- APSP consumes O(n2) space.
- Solution
- Interleave process of APSP construction with edge
elimination - Never have to build whole APSP graph
85Additional Filtering
- Node Contraction
- Collapse two events with fixed time between them
86Additional Filtering
- Node Contraction
- Collapse two events with fixed time between them
87Additional Filtering
- Node Contraction
- Collapse two events with fixed time between them
88Goals and Environment Constraints
Projective Task Expansion
Temporal NetworkSolver
Temporal Planner
Temporal Plan
Task Dispatch
Dynamic Scheduling and Task Dispatch
Goals
Modes
Reactive Task Expansion
Commands
Observations