Title: Solving The Simple Temporal Problem
1Solving The Simple Temporal Problem
- Mingyan Gao, Alexander Behm
- Instructor Prof. Rina Dechter
- University of California, Irvine
2Outline
- Introduction to TCSPs
- PC FW Algorithm
- DPC Algorithm
- PPC Algorithm
- ?STP Algorithm
- P3C Algorithm
- Overview
- Experimental Results
3An Example
- 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 710 and 720, and Fred arrived at work
between 800 and 810. We also know that John
arrived at work about 10-20 minutes after Fred
left home. - Queries
- 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?
4Model the Example
- 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 710 and 720, and Fred arrived at work
between 800 and 810. We also know that John
arrived at work about 10-20 minutes after Fred
left home. - Propositions
- P1 John was going to work
5Model the Example (cont.)
- 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 710 and 720, and Fred arrived at work
between 800 and 810. We also know that John
arrived at work about 10-20 minutes after Fred
left home. - Propositions
- P1 John was going to work
- P2 John arrived at work
6Model the Example (cont.)
- 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 710 and 720, and Fred arrived at work
between 800 and 810. We also know that John
arrived at work about 10-20 minutes after Fred
left home. - Propositions
- P1 John was going to work
- P2 John arrived at work
- P3 Fred was going to work
- P4 Fred arrived at work
7How to represent temporal information?
- Allens 13 possible relationship between
intervals - takes place before, meets, overlaps, starts,
during, finishes, is equal to, etc. - Intractable
- In this paper, consider the time points as the
variables we wish to constrain - beginning or ending point of event
8Back to the example
- For each proposition, Pi, associate it with an
interval - P1 John was going to work
- associated interval X1, X2
- X1 the time when John left home
- X2 the time when John arrived at work
- 30 X2 X1 40 or X2 X1 60
9Temporal CSP
- Model for solving problems involving temporal
constraints - Followed closely those developed for the general
CSP - Model propositions time intervals during which
proposition holds - Variables X1, X2, , Xn, each represents a time
point - Domain continuous
- Constraints a set of intervals, I I1,,In
a1, b1, , an, bn. - unary Ti, restricts the domain of variable Xn
- (a1 X1 b1) or (a2 X2 b2) or or (an Xn
bn) - binary Tij, constrains the permissible values
for the distance Xj-Xi - (a1 Xj-Xi b1) or (a2 Xj-Xi b2) or or
(an Xj-Xi bn)
10Directed Constraint Graph
- Nodes variables, X0 is introduced as the
beginning of the world - Edges i -gt j, a constraint Tij
- Graph
Figure modified from Temporal constraint
networks, Dechter, R., Meiri, I., and Pearl,
J.Artificial Intelligence, Vol. 49, 1991, pp.
61-95.
11TCSP (cont.)
- Solution the assignment (X1 x1, , Xn xn)
satisfies all the constraints - Value v is a feasible solution for variable Xi,
if there exists a solution in which Xi v - The network is consistent if at least one
solution exists - Central Problems
- Checking the consistency of the network
- Computing the minimal domains and networks
12Simple Temporal Problem
- A TCSP where each constraint specifies a single
interval is called a simple temporal problem. - In the network, each edge, i -gt j, is labeled by
an interval aij, bij - aij Xj Xi bij
- Xj Xi bij
- Xi Xj -aij
- Thus, solving an STP equals to solving a set of
linear inequalities on the Xis - Convert the inequalities to a graph
representation, where shortest paths algorithm
can be applied
13Directed edge-weighted graph
- Nodes variables in the constraint
- Edges i -gt j, labeled by a weight aij, the
linear inequality, Xj Xi aij - Assume John used a car, Fred used a carpool
- The distance graph
Figure modified from Temporal constraint
networks, Dechter, R., Meiri, I., and Pearl,
J.Artificial Intelligence, Vol. 49, 1991, pp.
61-95.
14Solution --- Shortest Path
- Theorem 3.1
- A given STP, T, is consistent if and only if its
distance graph, Gd, has no negative cycles. - With negative loops, Xi1 Xi1 lt 0
- Shortest path is well-defined
- d0j d0i aij
- thus it satisfies the constraints
- The tuple (d01, , d0n) is a solution (assume X0
0) - Corollary 3.2
- Gd be the distance graph of a consistent STP. Two
consistent scenarios are given by - S1 (d01, , d0n),
- S2 (-d10, , dn0)
- Proof
- di0 aij dj0
- (-dj0) (-di0) aij
15Solution --- Shortest Path (cont.)
- Theorem 3.3
- Any consistent STP is decomposable relative to
the constraints in its d-graph. - d-graph is the complete directed graph, where
each edge i-gtj is labeled by the shortest path
length - Backtrack free
- Corollary 3.4
- Let Gd be the distance graph of a consistent STP.
The set of feasible values for variable Xi is
-dt0, d0t - Corollary 3.5
- Given a consistent STP, T, the equivalent STP, M,
defined by is the minimal network representation
of T.
16How to compute All-pairs-shortest-paths?
- By applying the Floyd-Warshalls algorithm
- The algorithm runs in O(n3) time
- Can check consistency of STP
- Can compute both the minimal domains and the
minimal network
Figure modified from Temporal constraint
networks, Dechter, R., Meiri, I., and Pearl,
J.Artificial Intelligence, Vol. 49, 1991, pp.
61-95.
17Directional Path Consistency (DPC)
- Path Consistency
- Floyd-Warshalls algorithm is essentially the
same as path consistency check on the complete
graph - DPC
- Given an order d on variables
- Do path consistency check
- Not decomposable
- O (n (w(d))2)
- Detail later
18Outline
- Introduction to TCSPs
- PC FW Algorithm
- DPC Algorithm
- PPC Algorithm
- ?STP Algorithm
- P3C Algorithm
- Overview
- Experimental Results
19Path Consistency (PC)
- Form of local consistency used in solving CSPs
- A constraint graphs is PC if for any valuation of
a pair of variables that satisfy the constraint
between them, there exist consistent values for
variables along any path between them
There exist consistent values
Some value
Satisfied
Some value
Figure modified from Path Consistency on
Triangulated Constraint Graphs, Christian Bliek,
Djamila Sam-Haroud.Proceedings of the Sixteenth
International Joint Conference on Artificial
Intelligence, 1999
20Path Consistency (PC)
- Complete graphs are PC iff every path of length 2
is PC - Complete graphs can be made PC in O(n3d3) time
- n being number of variables, d the maximum domain
size - Sparse graphs can be completed by adding
universal constraints - Binary, convex CSPs made PC can be solved
backtrack free
21Partial Path Consistency (PPC)
- Triangulated constraint graph is PC iff every
path of length 2 is PC - Triangulated (chordal) example graph
Definition chordal graph An undirected graph is
chordal if every cycle of length strictly greater
than 3 has a chord.
-8, 8
-8, 8
-8, 8
- CSP is said to be PPC if its chordal constraint
graph is PC - Enforcing PC on chordal graphs is much cheaper
than on complete graphs
Figure modified from Path Consistency on
Triangulated Constraint Graphs, Christian Bliek,
Djamila Sam-Haroud.Proceedings of the Sixteenth
International Joint Conference on Artificial
Intelligence, 1999
22PPC Algorithm
- Basic Idea constraint propagation over all
triangles an edge participates in - Recall that iff any path of length 2 is PC the
entire (chordal) graph is PC - For a chordal graph if we consider all triangles
that an edge participates in, then we have
covered all paths of length 2 that the edge
participates in - Example of constraint propagation for all edges
of one triangle
Reason 6 2 8
Reason 12 - 6 6
Figure Modified from A New Efficient Algorithm
for Solving the Simple Temporal Problem, Lin Xu,
Berthe Y. Choueiry.Proceedings of TIME-ICTL 2003
23PPC Algorithm
- Initialization Put all edges into a set S
- 1. Remove some edge e from S
- 2. Get all triangles T(e) that e participates in
- 3. Tighten the label on e based on T(e)
- 4. If we had to modify e put all edges in T(e)
into S - 5. Continue until S is empty
- Flaw of above algorithm Whenever e is updated we
update all triangles that any of the edges in
T(e) participate in - Clearly we only need to update the triangles in
T(e) - This is the basis for the ?STP algorithm
24?STP Algorithm
- Look at the problem as a graph of triangles
- Initialization Put all triangles into a set T
- 1. Remove some triangle t from T
- 2. Tighten the labels of edges in the triangle
- 3. For every modified edge we add to T those
triangles that it participates in - (those triangles can be found efficiently from
the triangle graph) - 4. Continue until S is empty
Figure Modified from A New Efficient Algorithm
for Solving the Simple Temporal Problem, Lin Xu,
Berthe Y. Choueiry.Proceedings of TIME-ICTL 2003
25Contributions of P3C Paper
- (This is the paper we originally started from)
- Worst case complexity of ?STP is O(t2), with t
being the number of triangles - Identification of pathological cases for ?STP
that run in O(t2) time - Main observation/problem ?STP processes
triangles in random order - Seems intuitive that ?STP may need O(t2)
- It may be that after processing all t triangles
only one triangle is minimal - The same happens after we process the remaining
t-1, t-2, t-3... triangles - t (t-1) (t-2) 1 t(t1)/2 ? O(t2)
26P3C Algorithm
- Viewed as a shortest-path problem (we use the
d-graph representation) - Main idea fix an ordering, and do a forward and
backward sweep - Forward sweep is DPC, backward sweep takes care
of rest - Best explained by an example (which unfortunately
the authors did not give)
27P3C Algorithm (FW Sweep)
A
3
Ordering D C B A Forward sweep (DPC) For
every vertex v in order Update shortest path of
x, y If there is an edge x, v and y, v And
x, y precede v in ordering
7
5
8
3
4
B
D
4
7
6
2
4
2
C
28P3C Algorithm (FW Sweep)
PROCESSING D, xA, yC
A
Ordering D C B A Forward sweep (DPC) For
every vertex v in order Update shortest path of
x, y If there is an edge x, v and y, v And
x, y precede v in ordering
3
7
5
8
3
4
B
D
4
7
6 5
2
4
2
C
29P3C Algorithm (FW Sweep)
PROCESSING D, xA, yB
A
Ordering D C B A Forward sweep (DPC) For
every vertex v in order Update shortest path of
x, y If there is an edge x, v and y, v And
x, y precede v in ordering
3
7
5
8 7
3
4
B
D
4
7
5
2
4
2
C
30P3C Algorithm (FW Sweep)
PROCESSING D, xB, yC
A
Ordering D C B A Forward sweep (DPC) For
every vertex v in order Update shortest path of
x, y If there is an edge x, v and y, v And
x, y precede v in ordering
3
7
5
7
3
4
B
D
4
7 6
5
2
4
2
C
31P3C Algorithm (FW Sweep)
CONTINUE PROCESSING WITH C, xA, yB DO NOT
PROCESS, C, xD or yD BECAUSE D DOES NOT PRECEDE
C
A
Ordering D C B A Forward sweep (DPC) For
every vertex v in order Update shortest path of
x, y If there is an edge x, v and y, v And
x, y precede v in ordering
3
7
5
7
3
4
B
D
4
6
5
2
4
2
C
32P3C Algorithm (BW Sweep)
- In forward sweep we update the shortest path
between two nodes - In backward sweep we
- Process vertices in reverse order (i.e. A B C D)
- Update the shortest paths of the two other
node-pairs (that we did not catch during forward
sweep) - We visit every triangle exactly twice, therefore
P3C is O(t) - Must use perfect elimination ordering (PEO)
- PEO is a by-product of triangulation (making the
graph chordal)
33Overview of Algorithms
Claim by ?STP Authors in their presentation,
actually NOT true Worst case complexity can be
O(n6)!
Table Modified from (paper presentation) A New
Efficient Algorithm for Solving the Simple
Temporal Problem, Lin Xu, Berthe Y.
Choueiry.Proceedings of TIME-ICTL 2003
34Experiments
Experiment from P3C A New Algorithm for the
Simple Temporal Problem, Léon Planken, Mathijs de
Weerdt, Roman van der Krogt.ICAPS 2008.
35Experiments
Experiment from P3C A New Algorithm for the
Simple Temporal Problem, Léon Planken, Mathijs de
Weerdt, Roman van der Krogt.ICAPS 2008.
36Experiments
Experiment from P3C A New Algorithm for the
Simple Temporal Problem, Léon Planken, Mathijs de
Weerdt, Roman van der Krogt.ICAPS 2008.
37References
- Temporal constraint networks, Dechter, R., Meiri,
I., and Pearl, J.Artificial Intelligence, Vol.
49, 1991, pp. 61-95.A - Path Consistency on Triangulated Constraint
Graphs, Christian Bliek, Djamila
Sam-Haroud.Proceedings of the Sixteenth
International Joint Conference on Artificial
Intelligence, 1999 - New Efficient Algorithm for Solving the Simple
Temporal Problem, Lin Xu, Berthe Y.
Choueiry.Proceedings of TIME-ICTL 2003 - P3C A New Algorithm for the Simple Temporal
Problem, Léon Planken, Mathijs de Weerdt, Roman
van der Krogt. ICAPS 2008.