37
Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Embed Size (px)

Citation preview

Page 1: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Knowledge Repn. & ReasoningLec #11: Partitioning & Treewidth

UIUC CS 498: Section EA

Professor: Eyal AmirFall Semester 2004

Page 2: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Last Time

• Resolution strategies– Deletion of clauses– Restricting resolution to some pairs– Ordering resolution between clauses

• Some strategies refutation complete, others only complete for Horn refutation

Page 3: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Today

1. We can partition reasoning while not hurting soundness and completeness

2. How to partition a KB with the best computational benefit

• Still maintaining soundness & completeness

3. Applications du jour: Planning

Page 4: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

High-Level Structure in First-Order Logic

Page 5: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

High-Level Structure in First-Order Logic

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

broom

Page 6: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Structured First-Order Reasoning

• Craig’s interpolation theorem (First-Order Logic):– If A B, then there is a formula C including only

symbols from L(A) L(B) such that A C and C B

clean

Page 7: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Structured First-Order Reasoning

• Craig’s interpolation theorem (First-Order Logic):– If A B, then there is a formula C including only

symbols from L(A) L(B) such that A C and C B

clean

Page 8: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

High-Level Structure in First-Order Logic

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

broom

Page 9: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Structured First-Order Reasoning

• Craig’s interpolation theorem (First-Order Logic):– If A B, then there is a formula C including only

symbols from L(A) L(B) such that A C and C B

clean

broom

Page 10: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

High-Level Structure in First-Order Logic

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

broom

Page 11: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

• Start with a tree-decomposition partition graph

Reasoning with partitions using MP

MP Algorithm

Pass messages in Li toward goal

• Identify goal partition

• Direct edges toward goal(fixing outbound link language Li for each partition)

• Concurrently, in each partition: Generate consequences in Li

Page 12: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Another Example

• Message Passing: Espresso machine

• SAT via partitioning

Page 13: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Benefits of Message-Passing

• Search space is restricted

• Allows parallel processing

• Sound and complete

• Can use different reasoners for each partition

• Small links imply short proofs

• Small partitions imply short proofs

Page 14: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

High-Level Structure in First-Order Logic

Has(key(x)) locked(x) can_open(x)can_open(x) open(x) opened(x)opened(x) fetch(y,x) in(y,x) has(y)Has(key(closet)) opened(closet)open(closet) opened(closet)In(broom,closet)fetch(broom,closet)

Has(broom) dry(broom) can_clean(x)can_clean(x) cleaned(x)Has(y) let_dry(y) dry(y)Has(time) let_dry(y)Has(drier) let_dry(y)Has(time) Has(drier)

Hasbroom

Page 15: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Structured First-Order Reasoning

• Craig’s interpolation theorem (First-Order Logic):– If A B, then there is a formula C including only

symbols from L(A) L(B) such that A C and C B

clean(room)

Has(broom)

Page 16: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Structured First-Order Reasoning

• Craig’s interpolation theorem (First-Order Logic):– If A B, then there is a formula C including only

symbols from L(A) L(B) such that A C and C B

clean(room)

Has(broom)x Has(x) Has(broom)

Page 17: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Contents

1. We can partition reasoning while not hurting soundness and completeness

2. How to partition a KB with the best computational benefit

• Still maintaining soundness & completeness

3. Applications: Planning

Page 18: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

Automatic Decomposition of a Theory

Page 19: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

Automatic Decomposition of a Theory

Page 20: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

Automatic Decomposition of a Theory

Page 21: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Decomposition of a Theory

key locked

can_open open

opened fetch

broom

dry

cleaned

let_dry

time

drier

can_clean

Page 22: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Decomposition of a Theory

key locked

can_open open

opened fetch

broom

dry

cleaned

let_dry

time

drier

can_clean

Page 23: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Decomposition of a Theory

key locked

can_open open

opened fetch

broom

dry

cleaned

let_dry

time

drier

can_clean

broom

Page 24: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Decomposition of a Theory

broom

key locked

can_open open

opened fetch

broom

dry

cleaned

let_dry

time

drier

can_clean

broom

Page 25: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Decomposition of a Theory

key locked can_opencan_open open openedopened fetch broomkey openedopen opened broom fetch

broom dry can_cleancan_clean cleanedbroom let_dry drytime let_drydrier let_drytime drier

broom

Page 26: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Partitioning• Begin with a KB in PL or FOL• Construct symbol graph

– Edges join symbols which appear together in an axiom

• Find a tree decomposition of low width– Roughly, generalizes balanced vertex cut

• Partition axioms correspondingly– Each partition has its own vocabulary– Edge labels defined by shared vocabulary

Page 27: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Partitioning

• Find a tree decomposition of minimum width:– A tree in which each node corresponds to a

set of vertices from the original graph– The tree satisfies the running intersection

property: if v appears in two nodes in the tree, then v appears in all the nodes on the path connecting them

– The width of the tree is the size of its largest node

Page 28: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Why Tree Decomposition?

• Example: BREAK-CYCLES

Page 29: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Partitioning

• Treewidth: [Robertson & Seymour ’86], …• Approximation Algorithms:

– General theories: [A. & McIlraith ’00]– O(Log(OPT))-approximation for general

graphs: [A. ’01]– Constant factor approximation for planar

graphs: [Seymour & Thomas ’94], [A., Krauthgamer &

Rao ’03]

Page 30: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Partitioning: Heuristics

• Heuristic: min-degree1. Given a graph G; List L - empty2. Add to L a node v with minimum number

of neighbors3. Make a clique from v’s neighbors4. Remove v from G5. If G is empty, return L6. Go to 2

Page 31: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Automatic Partitioning: Heuristics

• Heuristic: min-fill1. Given a graph G; List L - empty2. Add to L a node v with minimum number

of edges missing between neighbors3. Make a clique from v’s neighbors4. Remove v from G5. If G is empty, return L6. Go to 2

Page 32: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

• Reasoning is performed locally in each partition

• Specialized reasoning procedures in every partition

• Globally sound & complete… provided each local reasoner is sound & complete for Li-consequence finding

• Performance is worst-caseexponential within partitions, but linear in tree structure

Summary: Characteristics of MP

Minimizesbetween-partition

deduction

Supports parallel processing

Different reasonersin different partitions

Focuseswithin-partition

deduction

Page 33: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Contents

1. We can partition reasoning while not hurting soundness and completeness

2. How to partition a KB with the best computational benefit

• Still maintaining soundness & completeness

3. Applications: Planning

Page 34: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Application: Planning

• General-purpose planning problem:– Given:

• Domain features (fluents)• Action descriptions: effects, preconditions• Initial state• Goal condition

– Find:• Sequence of actions that is guaranteed to achieve

the goal starting from the initial state

Page 35: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Application: Planning with partitions

PartPlan Algorithm• Start with a tree-structured

partition graph• Identify goal partition• Direct edges toward goal• In each partition

– Generate all plans possible with depth d and width k

– Pass messages toward goal

Page 36: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Factored Planning: Analysis

• Planner is sound and complete

• Running time for finding plans of width w with m partitions of treewidth k is O(mw22w+2k)

• Factoring can be done in polynomial time

• Goal can be distributed over partitions by adding at most 2 features per partition

Page 37: Knowledge Repn. & Reasoning Lec #11: Partitioning & Treewidth UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004

Next Time

• Probabilistic Graphical Models:– Directed models: Bayesian Networks– Undirected models: Markov Fields

• Requires prior knowledge of:– Treewidth and graph algorithms– Probability theory