A Bounded Path Propagator on Directed Graphs CP 16 Diego de U na, - - PowerPoint PPT Presentation
A Bounded Path Propagator on Directed Graphs CP 16 Diego de U na, - - PowerPoint PPT Presentation
A Bounded Path Propagator on Directed Graphs CP 16 Diego de U na, Graeme Gange, Peter Schachte and Peter J. Stuckey September 9, 2016 University of Melbourne CIS Department Table of Contents 1. Motivation 2. Previous work 3. Path
Table of Contents
- 1. Motivation
- 2. Previous work
- 3. Path propagator
- 4. Bounded Path propagator
- 5. No-good Learning
- 6. Experimental results
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 2
Motivation
Example Problem: Task Constrained Shortest-Path
Given
- A weighted graph G = (V, E, w), a source s ∈ V and a
destination d ∈ V
- A set of tasks T = {t1, t2, ...}
- For each vertex v, av[ti] ⇔ can task ti be performed at v
- An integer K
Select a path p such that
- p goes from s to d
- The cost of p is less than K
- For all the tasks in ti ∈ T, p contains at least one node v
where av[ti]
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 4
Example Problem: Task Constrained Shortest-Path
Given
- A weighted graph G = (V, E, w), a source s ∈ V and a
destination d ∈ V
- A set of tasks T = {t1, t2, ...}
- For each vertex v, av[ti] ⇔ can task ti be performed at v
- An integer K
Select a path p such that
- p goes from s to d
- The cost of p is less than K
- For all the tasks in ti ∈ T, p contains at least one node v
where av[ti]
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 5
Motivation
There is reasoning to be done in terms of
- topology of the graph:
- nodes/edges that you absolutely must visit/use
- nodes/edges that you cannot visit/use
- proving unfeasability
- distances:
- nodes that are too far
- edges that are too slow
- proving unfeasability
We capture all this reasoning in a global: BoundedPath( G, s, d, w
- Data
, G, K
- Variables
)
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 6
Previous work
Previous work
Other path or bounded path or related propagators:
- Without learning:
- Decomposition approach in CP(Graph) (Dooms et al., 2005)
- First reachability propagator by (Quesada et al., 2006)
- Tree/forest in (Beldiceanu et al., 2005)
- Path constraint using directed trees (Fages, 2014)
- With learning:
- Circuit propagator (Francis et al., 2014)
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 8
Path propagator
Path Propagator via trees
path(G, s, d, G) ⇔ dtree(G, s, G) ∧ dtree(G−1, d, G) Global dtree(G, r, G) ensures that:
- G is connected
- G is rooted at r
- ⇒ Directed Reachability from r
- G is acyclic
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 10
Quick glance at Directed Reachability
Find and explain dominators nodes: r a c t d b g
e1 e4 e6 e7 e3 e2 e5 e8 e11 e10 e9
r a c t d b g
e1 e4 e6 e7 e3 e2 e5
e8 e11 e10 e9 P
- Fig. 1: Example of explanation for dominator d of t. (‘
’ is the second DFS)
Similar reasoning can be used to remove unreachable nodes or explain unfeasability. Also, we can find bridges.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 11
Bounded Path propagator
Prunning G’s domain: Simple and Combined distances
Simple distances:
- Compute shortest path from s to all nodes
- Any node further than K from s can be removed
- Same reasoning on inverted graph from d
Combined distances:
- Compute shortest path from s, ∀u ∈ V ⇒ δu
- Compute shortest path on G−1 from d, ∀u ∈ V ⇒ δ−1
u
- Any node u s.t. δu + δ−1
u
> K can be removed
- Any arc e = (u, v) s.t. δu + we + δ−1
v
> K can be removed
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 13
Prunning G’s domain: Stronger propagation using DP
We use a Dynamic Programming algorithm to compute the path from s to d visiting all the mandatory nodes M at this point. Modified Dijkstra’s algorithm:
- Each u node has a table t[m] → w: cost of some path
reaching u having visited m ∈ M.
- Q contains tuples (u, m, w)
procedure DPBound(G, s, d, G, w, M) Q ← newPriorityQueue(); Q.push((s, {s}, 0)); tables[s][{s}] ← 0 ⊲One table per node while ¬Q.empty() do (u, mp, γ) ← Q.top(); Q.pop() if tables[u].contains(mp) ∧ tables[u][mp] < γ then continue; for all e = (u, v) ∈ {e|e ∈ E ∧ ce = false} do if ¬tables[v].contains(mp) ∨ (tables[v][mp] > γ + w[e]) then tables[v][mp] ← γ + w[e] Q.push(v, mp ⊕ v, γ + w[e]) ⊲S ⊕ v adds v to set S iff v ∈ M return tables[d][M]
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 14
Dealing with state explosion
Dynamic Programming algorithm is exponential in |M|! In practice behaves very well: the higher |M| the less choices of edges there are in the tree ⇒ we rarely see any state explosion. Ways of preventing state explosion:
- Node clustering: only enforce the visit of x centroids
- SCCs: topological sort of SCCs, do not leave SCCs unless
finished. S A B C E D
1 3 5 2 4 6
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 15
No-good Learning
Naive explanations
Quickly computed, trivial explanation can be obtained as follows:
- 1. Compute shortest path from s, ∀u ∈ V ⇒ δu
- 2. Compute shortest path on G−1 from d, ∀u ∈ V ⇒ δ−1
u
- 3. Add all arcs e = (u, v) s.t. δu + we + δ−1
v
≤ K to Fn
Explanation when removing a “too-distant” node n:
δd ≤ K ∧
- ef ∈Fn
¬cef ⇒ ¬cn
- Same explanation for combined distances propagation
- Easily adapted to DP: add conjunction of mandatory nodes
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 17
Minimal explanations for Simple and Combined Distances
Explaining why some node n is “too far” from s:
- 1. Compute shortest path from s to all nodes
- 2. Starting at n, compute shortest path in reversed graph
allowing the use of forbidden edges.
- 3. Add forbidden edges that yield a path shorter than K to set X.
Minimal explanation when removing a “too-distant” node n:
δd ≤ K ∧
- ef ∈X
¬cef ⇒ ¬cn We can adapt this to Combined distances by combining partial explanations.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 18
Example
We want a path no longer than 10 (K = 10) But the shortest path is 18! s a b n c e
2 2 2 10 2 2 2 e1 e2
2 14 18 12 16
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 19
Example
We want a path no longer than 10 (K = 10) But the shortest path is 18! s a b n c e
2 2 2 10 2 2 2 e1 e2
2 14 18 12 16
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 20
Example
We want a path no longer than 10 (K = 10) But the shortest path is 18! s a b n c e
2 2 2 10 2 2 2 e1 e2
2 14 18 12 16 2
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 21
Example
We want a path no longer than 10 (K = 10) But the shortest path is 18! s a b n c e
2 2 2 10 2 2 2 e1 e2
2 14 18 12 16 2 2
e2: 14 + 2 + 0 = 16 > K ⇒ cross it.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 22
Example
We want a path no longer than 10 (K = 10) But the shortest path is 18! s a b n c e
2 2 2 10 2 2 2 e1 e2
2 14 18 12 16 2 2 14
e1: 2 + 2 + 2 = 6 ≤ K ⇒ explanation.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 23
Better explanations for the DP algorithm
Explaining that there is no path containing M of cost less than K
- 1. Run the DPBound algorithm
- 2. Starting at d, run DPBound in the reversed graph allowing
the use of forbidden edges.
- 3. Forbidden edges that yield a path shorter than K containing
all the nodes in M explain the inference. ⇒ lookup tables to see if all nodes are visited.
State explosion
Because we allow the use of forbidden edges, state explosion can happen more frequently. Avoid it by switching to naive explanations if the algorithm is too slow
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 24
Experimental results
Experimental results: Task Constrained Shortest Path
Expl* (all use smallest) Expl NoExpl Version Conflicts Nodes Time(s) Opt(s) Conflicts Nodes Time(s) Opt(s) Conflicts Nodes Time(s) Opt(s) Circuit 48790 54254 3.18 2.14 48790 54254 3.18 2.14 308888 619304 7.95 6.48 Circuit+BPath 18303 19883 2.90 1.49 27050 29995 3.70 2.84 174329 350327 15.99 13.67 Circuit+DPBPath 636 1133 2.09 1.86 4933 6228 1.68 1.36 31256 188278 4.47 3.75 Path 26488 28801 7.05 2.27 26488 28801 7.05 2.27 200773 402943 32.63 9.81 Path+BPath 13175 14787 3.63 1.30 15238 16868 4.07 1.37 76701 156208 16.20 5.51 Path+DPBPath 54 456 0.53 0.36 221 648 1.31 0.44 381 1253 2.96 1.14
Table 1: Benefit from BPath & DPBPath with both Path and Circuit. Average
- ver 500 instances of 20 nodes.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 26
Experimental results: Profitable Tourist Path
New York City (14 POI) London (12 POI) Version Fails Nodes Time(s) Fails Nodes Time(s) Path ≥5030898 >5034046 >3600.00 236010 237263 60.14 Path+BPath (Expl) 390985 391746 379.19 24061 25190 13.86 Path+DPBPath (Expl) 44015 44606 48.82 10645 11866 2.89 Path+BPath (Expl*) 360945 361971 350.26 18546 19881 8.78 Path+DPBPath (Expl*) 2062 2690 37.45 224 670 0.16
Table 2: Profitable tourist path. Search: smallest on succ variables.
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 27
Conclusions
Weaknesses:
- If finding paths is hard (because of the topology of the graph),
a circuit-based propagator is more suitable (Francis et al., 2014).
- If solving the problem is too easy (fast with a simple path
propagator), the bounded path propagator is a burden. Strengths:
- If the problem is hard in terms of distance!
- Learning is beneficial!
- The DP algorithm rarely explodes and accelerated the search
drastically
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 28
Thank you for your attention. Questions?
Diego de U˜ na A Bounded Path Propagator on Directed Graphs CP16 29