anagh lal monday, april 14, 2003 1 chapter 9 – tree decomposition methods anagh lal csce 990-06...

28
Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Post on 19-Dec-2015

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 1

Chapter 9 – Tree Decomposition Methods

Anagh Lal

CSCE 990-06 Advanced Constraint Processing

Page 2: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 2

Outline

• Acyclic constraint networks– Hypergraph, dual graph, primal graph, join-tree,

hypertree, acyclic constraint network.

• Solving acyclic constraint networks (DB )– Algorithm Acyclic-Solving

• Identifying acyclic constraint networks– Dual-based approach– Primal-based approach

• Join-tree clustering: general CSP acyclic CSP

Page 3: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 3

Introduction

• Chapter 4: tree-shaped binary CSPs can be processed efficiently

• Here, the notion of a constraint tree is extended to non-binary constraints A new class: acyclic constraint networks

• Review: – hypergraph– dual of a graph – primal graph

Page 4: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 4

Examples on the board

• Hypergraph

• Dual graph

• Reduced dual graph (when tree join-tree)

• Primal graph

Page 5: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 5

Connectedness property

• An arc subgraph of a graph contains – all the nodes and – a subset of the edges

• Two nodes that share variables are connected a path along which each arc contains the shared variables

• An arc subgraph of the dual satisfies the connectedness property

all nodes that share a variable are connected

The arc subgraph is a join-graph• Connectedness the running intersection property

Page 6: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 6

Has A

Has A

Has A

Constraint Network: R

Hypergraph: H

Dual of H: Hdual

Arc subgraph of Hdual: G

Does G Satisfy

Connectedness?

YesG is a Join-graph

Is G aTree?

G is a Join-tree

H is a Hyper-tree

R is an Acyclic network

Yes

Page 7: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 7

Solving acyclic problems

• An acyclic constraint network can be solved efficiently since its dual graph is a tree of binary constraints.

• Algorithm Acyclic-Solving– is tree-based (using directional arc-consistency)– solves acyclic problems

• Domains of variables in the dual problem constraint tuples of the original problem• Acyclic-Solving assumes that any tuples are

consistent with domains (Relational arc-consistent)

Page 8: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 8

Algorithm Acyclic-Solving

• Input: – Acyclic constraint network R = (X, D, C)– A join-tree T of R.– Assumes the network is relational arc-consistent

• Output: – (Global) consistency of network [Yes/No] – A consistent solution to R

Page 9: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 9

Acyclic-Solving: 3 steps

• Step 1: Generate an ordering d = (R1…Rt) of the constraints C such that the every constraint/relation appears before its descendants in the join-tree rooted at R1.

• Step 2 (tighten relations):– Pick a relation Rj from the join-tree in reverse order of d– For each edge such that the edge connects Rj and a relation

Rk that comes earlier in the ordering:• Perform a join of the two relations, project the result using the

scope of the relation Rk

• Assign the result of above computation to Rk (i.e., update Rk)• If Rk becomes empty: Return with no solution

Page 10: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 10

Acyclic-Solving (cont.)

• Step 3: If we reach this step, then problem is consistent. So, generate a solution.– Pick up the first relation using the ordering d.– Select a tuple from it. – Using this instantiation instantiate values from

other relations such that they are consistent with previous assignments

– .. And you’re guaranteed to finish!

Page 11: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 11

Acyclic-Solving: Correctness

• Step 2 of the algorithm is essentially applying directional arc-consistency along the join-tree of the dual of a problem.

• As we saw in Chapter 4, this guarantees a solution for a tree network.

Page 12: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 12

Acyclic-Solving: Complexity

• Complexity of tree algorithms is O(nk2)• n: #variables

• k: domain size

• Expected complexity is O(rl2)• r: #constraints

• each with most l tuples

• Using lexicographical sorting

complexity down to O(r.l.log l)

Page 13: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 13

Recognizing acyclic networks

Two methods

1. Dual-Acyclicity: dual-based recognition– Generates ‘maximal’ spanning tree of dual graph

– Tests for connectedness of this spanning tree

2. Primal-Acyclicity: primal-based recognition– Uses the fact that the primal graph for a hypertree

must be chordal

Page 14: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 14

Dual-Acyclicity

• Input: Hypergraph H of constraint network R(X, D, C)• Output: A join-tree T(S, E) if R is acyclic• Algorithm:

– Generate a maximal spanning tree T of the dual of R(weight = number of shared variables)

– For every two nodes u and v in T, do• If the unique path connecting them does not satisfy the

connectedness property, then Exit (R is not acyclic)

– R is acyclic, and T is the join-tree

Page 15: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 15

Dual-Acyclicity: complexity

• O(e3), where e is the number of constraints

Page 16: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 16

Refresher of Chapter 4

• Maximal cardinality ordering

• Chordal graph

• A graph is chordal if, in a maximum cardinality ordering, each node’s parents are connected

• Finding max-cliques in chordal graphs can be done in linear time

Page 17: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 17

Primal-Acyclicity: principle

• Uses 2 tests – the primal graph G of the network is chordal and

– the max-cliques of the chordal primal graph G satisfies the conformatlity property

• Conformality– A chordal primal graph is conformal relative to a

constraint hypergraph there is a 1-to-1 mapping between maximal cliques and scopes of constraints

Page 18: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 18

Primal-Acyclicity

• Input: A network R = (X, D, C) and its primal graph G

• Output: A join-tree iff the problem is acyclic

• Algorithm: 3 steps– Test chordality of the primal graph G– Test conformality of the primal graph G– If acyclicity, then create the join-tree for R

Page 19: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 19

Primal-acyclicity: the steps

1. Test chordality: Using a max-cardinality ordering d of G and starting from the

last node check if the parents of all the nodes are connected. If for any node they are not then, exit: problem is not acyclic

2. Test conformality: Let C1,…,Ct be the cliques indexed by their highest variable in

the ordering. Check if the cliques correspond to scopes of constraints, if so R is acyclic

3. Create a join-tree: From t to 1, connect every clique to an earlier clique with which

it shares a maximal number of variables

Return the tree of cliques

Page 20: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 20

Join-tree clustering

• Since acyclic constraint networks can be solved efficiently, try to convert an arbitrary constraint network into an acyclic one

• This can be achieved by grouping subsets of constraints into clusters, or sub-problems, whose scopes constitute a hypertree, thus transforming a constraint hypergraph into a constraint hypertree

• By replacing each sub-problem with its solution we obtain an acyclic constraint problem, which can be solved using the acyclic solving algorithm.

• This compilation process is called join-tree clustering

Page 21: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 21

Join-tree clustering example

Page 22: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 22

Hypertree embedding

• A hypertree embedding of a hypergraph R = (X,H) is a hypertree T = (X,S) such that, for every h element of H there is a h1 element of S such that h is a subset of h1.

Page 23: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 23

Decomposing a hypergraph into a hypertree

• Consider the primal-acyclicity algorithm to detect acyclic networks. Instead of terminating when we find that the graph is acyclic we could repair the primal graph and proceed to convert the hypergraph to a hypertree.

• Enforce chordality by connecting the parents• Enforce conformality by generating unique

constraint for every maximal clique.• Algorithm Join Tree Clustering (JTC) does this.

Page 24: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 24

Joint Tree Clustering

• Input: Constraint problem R = (X, D, C) and its primal graph G = (X, E)

• Output: An equivalent acyclic problem and its join-tree: T=(X, D, C’)

Page 25: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 25

JTC algorithm (cont.)

• Select a variable ordering d (max-cardinality recommended)

• Triangulation: Connect the parents. Generate an induced graph along d.

• Create a join-tree for the induced graph– Identify all max cliques in the chordal graph. (C1,

…,Ct), from the last variable to the first.

– Connect each Ci to one single Cj (j < i) with whom it shares the largest subset of variables.

Page 26: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 26

JTC algorithm (cont.)

• Place each constraint from R in one clique containing its scope, and let Pi be the constraint subproblem associated with Ci

• Solve each Pi and let R’i be its set of solutions

• Return C’ = {R’1,…, R’t}, and their join-tree, T

Page 27: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 27

Complexity

• Time and space complexity:– O(r.k(w*(d)+1))

Page 28: Anagh Lal Monday, April 14, 2003 1 Chapter 9 – Tree Decomposition Methods Anagh Lal CSCE 990-06 Advanced Constraint Processing

Anagh Lal Monday, April 14, 2003 28

Discussion

• Questions?

• Comments?