195
Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina Dechter (UCI, Irvine) H. Geffner (UPF, Barcelona) H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 1 Problems Problem solving in AI is about representation and automated solution of a wide variety of problems diagnosis, planning, scheduling, logistics, control games: sokoban, mastermind, 15-puzzle, n-queens, chess robot navigation, traveling salesman, map coloring, . . . H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 2

Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Principles of AI Problem SolvingTutorial IJCAI-05

Adnan Darwiche (UCLA, Los Angeles)Rina Dechter (UCI, Irvine)

H. Geffner (UPF, Barcelona)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 1

Problems

Problem solving in AI is about representation and automated solutionof a wide variety of problems

diagnosis, planning, scheduling, logistics, controlgames: sokoban, mastermind, 15-puzzle, n-queens, chessrobot navigation, traveling salesman, map coloring, . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 2

Page 2: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Models

Common structure of certain classes of problems can be abstracted andexpressed in terms of mathematical model; e.g.,

• Constraint Satisfaction Problems (CSP) are models of the form〈X, D, C〉 where X, D, and C are sets of variables, domains, andconstraints

• A solution to a CSP assigns to each variable a value from its domainsuch that all constraints satisfied

Key point:

– Many problems can be formulated as CSPs– If we know how to solve CSPs, we know to solve those problems– Same for other models . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 3

Example: Linear Equations Model

• John's age is three times Peter's age

• In 10 years, John's age will be twice Peter's age

• How old are John and Peter now?

Formulate problem as 2-linear equations with 2 unknowns:

J = 3P

J + 10 = 2(P + 10)

Solve model using general method; e.g. variable elimination

3P + 10 = 2P + 20

Then

P = 20− 10 = 10

J = 3P = 30

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 4

Page 3: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Problem Solving in AI

• define models of interest

• develop effective methods for solving them

In this tutorial:

-- We'll cover a wide range of models, including State Models, SAT, CSPs,Bayesian Networks, Markov Decision Processes (MDPs), . . .

-- Focus on key principles underlying current solution methods:

– Search Space– Pruning– Learning– Decomposition– Compilation– Variable Elimination

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 5

Plan for the tutorial

• Introduction (Hector)

– Models based on States– Models based on Variables– Overview of Techniques

• Solving models with Search and Inference

– State-based Models (Hector)– Variable-based [Factored or Graphical] Models (Rina)

• Solving models with Pure Inference and No Search (Adnan)

• Hybrid Methods (Rina)

• Wrap up

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 6

Page 4: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

More about Tutorial

• assumes basic course in AI

• focuses on principles; not exhaustive (e.g., no approx. methods)

• conceptual but also technical

Please ask questions along the way . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 7

Part 1: Introduction

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 8

Page 5: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Principles of AI Problem Solving: Introduction

• Contents

– Models based on States– Models based on Variables– Overview of Techniques

• Format; Style

– general, high-level view of field– emphasize intuitions and coherence– raise questions that will be addressed in detail later on

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 9

Models

• Models define what is to be solved

• Algorithms define how to solve models

E.g, we understand what√

43 is without necessarily knowing how tocompute value

Same with models: they define the solutions we are looking for, withoutcommitment about their computation

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 10

Page 6: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

State Models

• Basic State Model characterized by

– finite and discrete state space S– an initial state s0 ∈ S– a set G ⊆ S of goal states– actions A(s) ⊆ A applicable in each state s ∈ S– a state transition function f(s, a) for s ∈ S and a ∈ A(s)– action costs c(a, s) > 0

• A solution is a sequence of applicable actions ai, i = 0, . . . , n, thatmaps the initial state s0 into a goal state s ∈ SG; i.e.,

si+1 = f(ai, si) and ai ∈ A(si) for i = 0, . . . , n and sn+1 ∈ SG

• Optimal solutions minimize total cost∑i=n

i=0 c(ai, si)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 11

Problems mapping naturally into State Models

• Grid Navigation

• 15-puzzle

• Rubik

• Route Finding in Map

• TSP (Traveling Salesman Problem)

• Jug Puzzles (e.g., 4 & 3 liter jars, have 2 liters in 4 lit. jar)

• ...

This is the model underlying Classical Planning . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 12

Page 7: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Languages

State-Models often represented implicitly in terms of (planning) lan-guages

E.g.: Strips is a simple language for representing the Basic State Models

• A problem in Strips is a tuple 〈A,O, I, G〉:

– A stands for set of all atoms (boolean vars)– O stands for set of all operators (actions)– I ⊆ A stands for initial situation– G ⊆ A stands for goal situation

• Operators o ∈ O represented by three lists

-- the Add list Add(o) ⊆ A-- the Delete list Del(o) ⊆ A-- the Precondition list Pre(o) ⊆ A

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 13

Strips: From Language to ModelStrips problem P = 〈A,O, I, G〉 determines state model S(P ) where

• the states s ∈ S are collections of atoms

• the initial state s0 is I

• the goal states s are such that G ⊆ s

• the actions a in A(s) are s.t. Prec(a) ⊆ s

• the next state is s′ = s−Del(a) + Add(a)

• action costs c(a, s) are all 1

The (optimal) solution of problem P is the (optimal) solution of StateModel S(P )

Later on we'll see how Strips descriptions can play a computational roleas well . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 14

Page 8: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Model with Incomplete Information and Non-Determinsm

• finite and discrete state space S

• a set of possible initial states S0 ⊆ S

• a set SG ⊆ S of goal states

• actions A(s) ⊆ A applicable in each s ∈ S

• a non-deterministic transition function F s.t. F (a, s) is a set of states,a ∈ A(s)

• action costs c(a, s) > 0

-- A solution is a sequence of actions that lead to SG for any possibleinitial state and transition

-- An optimal solution miminizes the sum of action costs

-- Planning over this class of models called Conformant Planning

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 15

Model with Non-determinism and Full Feedback

• finite and discrete state space S

• a set of possible initial states S0 ⊆ S

• a set SG ⊆ S of goal states

• actions A(s) ⊆ A applicable in each s ∈ S

• a non-deterministic transition function F . . .

• action costs c(a, s) > 0

• states fully observable

-- Solutions become functions mapping states into actions (closed-loopcontrol policies)

-- This is because dynamics is Markovian and past history of system isnot relevant

-- Optimal solutions minimize cost in worst case (min-max state policies)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 16

Page 9: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Stochastic Model with Full Feedback(Markov Decision Process - MDP)

• finite and discrete state space S

• a set SG ⊆ S of goal states

• actions A(s) ⊆ A applicable in each s ∈ S

• transition probabilities Pa(s′|s) for s and a ∈ A(s)

• action costs c(a, s) > 0

• states fully observable

-- Solutions like before are functions mapping states into actions (closed-loop control policies)

-- Optimal solutions minimize expected cost

-- This model underlies Probabilistic Planning; although variations possible(e..g, partial observability, achieving goal with certain probability,discounted formulations, . . . ).

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 17

Example: Navigation Problems

Consider robot that has to reach target G when

• initial state is known and actions are deterministic

• initial state is unknown and actions are deterministic

• states are fully observable and actions are stochastic

• states are partially observable and actions are stochastic . . .

G

-- How do these problems map into the models considered?

-- What is the form of the solutions?

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 18

Page 10: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Models based on Variables: Factored or Graphical Models

• Constraint Satisfaction Problems (CSP)

• Satisfiability (SAT)

• Bayesian Networks

• Influence Diagrams, . . .

Several tasks associated with these models . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 19

Constrain Satisfaction Problems (CSPs)

• CSPs are triplets 〈Variables,Domains,Constraints〉

• A solution assigns values to the variables from their correspondingdomains satisfying all constraints

• A CSP is consistent if it has one or more solutions

E.g., first CSP below is consistent; second is not

〈{X, Y }, {DX, DY = [1..10]}, {X + Y > 10, X − Y > 7}〉

〈{A,B, C}, {DA, DB, DC = [a, b]}, {A 6= B,B 6= C,A 6= C}〉

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 20

Page 11: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Problems that Map into CSPs

• Scheduling

• Planning

• Resource allocation

• Map coloring

• N-queens

• ...

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 21

Satisfiability (SAT)

• SAT is special type of CSP where variables x, y, . . . are boolean andconstraints are clauses

x ∨ ¬y ∨ z . . .

• A set of clauses denotes a formula in Conjunctive Normal Form (CNF):a conjunction of disjunctions of literals

• Current SAT solvers are very powerful, and used in Planning andVerification

• Any CSP can be mapped into SAT and vice versa, and solving techniqueshave a lot in common

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 22

Page 12: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

The Graph Underlying Graphical Models

• SAT and CSP are both NP-Complete, yet complexity bounded bytreewidth of interaction graph

• The interaction graph of a problem is an undirected graph where

– the vertices are the variables, and– two variables are connected iff if they appear in same con-

straint/clause

• The treewidth measures how 'tree-like' is the interaction graph

– treewidth = 1 implies linear complexity, while– bounded treewidth implies polynomial complexity

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 23

Bayesian Networks (BNs)BNs are graphical models that express a joint probability distributionover a set of variables X1, . . . , Xn by means of

• a directed acyclic graph over the variables

• conditional probability tables P (Xi|pa(Xi)) of each variable Xi givenits parents pa(Xi) in the graph

The joint distribution is the product of the tables:

P (X1, . . . , Xn) =∏

i=1,n

P (Xi|pa(Xi))

BNs and CSPs are similar; they specify joint probability and joint consis-tency through local factors that define the interaction graph

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 24

Page 13: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Models and Tasks: SAT and CSPs

• Consistency is basic task in SAT and CSPs: find a satisfying assignmento that no one exists

Yet other tasks common:

• Optimization: find best satisfying assigment according to some function(COP)

• Enumeration: find number of satisfying assignments (Model Counting);find all solutions, . . .

All tasks are NP-hard; Consistency and (Bounded) Optimization areNP-Complete while Enumeration is #P.

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 25

Models and Tasks: Bayesian Networks

• Enumeration: find probability given evidence: P (X = x|Y = y, Z = z, ...)(Bel)

• Optimization: find most probable instantiation given evidence (MPE)

• Other: find most probable instantiation of subset of variables givenevidence (MAP)

All tasks are NP-hard; (Bounded) MPE is NP-Complete, and Bel is #P

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 26

Page 14: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Map

• Introduction

– Models based on States– Models based on Variables� Overview of Techniques∗ Search Space∗ Pruning∗ Learning∗ Decomposition∗ Compilation∗ Variable Elimination

• Solving models with Search and Inference

– State-based Models– Variable-based [Factored or Graphical] Models

• Solving models with Pure Inference and No Search

• Hybrid Methods

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 27

Search

• Basic tasks can be formulated as search problem in suitable problemspace

• Problem or Search space is a Directed Graph given by

– root node n0 of the search– set of terminal nodes; either dead-ends or goals– branching rule generating children n′ of non-terminal nodes n– costs c(n, n′) ≥ 0

• A solution is a directed path that connects the root node with a goalnode. It is optimal if it minimizes the sum of the edge costs.

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 28

Page 15: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Direct Problem Space for Basic State Models

The nodes correspond to the states and

• root node is initial state s0

• goal nodes are the goal states

• dead ends are states s s.t no action applies in s

• branching rule: s → s′ if s′ = f(a, s) for some a applicable in s

• cost is then c(s, s′) = c(a, s)

In spite of direct mapping from Basic State Model to Search Graph, it'sgood to keep in mind that first is a description of the problem, whilesecond is the structure explored for finding a solution

When the State Model is described in Strips, this is the so-called pro-gression space, as alternative spaces are possible . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 29

Alternative Problem Spaces from Strips Encodings

• regression space: branch by applying actions backward from goal tilfinding conditions that hold in initial state

• plan space: branch by refining partial plan, removing its flaws

In certain cases, these alternative branching schemas/problem spacesmore suitable (e.g., plan space seems best for optimal temporal planning)

Strips problems with fixed planning horizon can also be mapped into SAT,which works very well when optimal parallel plans are sought

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 30

Page 16: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Problem Space for Non-Deterministic State models

Conformant Planning can be formulated as Search Problem over beliefspace, where nodes are belief states, i.e., sets of states deemed possible

• root node is set of possible initial states

• goal nodes are sets of goal states

• edge n → n′ if for some action, n′ is the set of states that may followthe states in n

• . . .

-- This is most common formulation for Conformant Planning currently

-- Belief states represented often by propositional formula in suitable'compiled' form (e.g., OBDDs, d-DNNF, . . . ; more about this later on)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 31

Problem Space for Graphical Models: OR Space

Consistency and Optimization Problems for SAT, CSP, and Bayesian Net-works are formulated as search problems over suitable Search Graph.

In the standard formulations, the nodes are partial assignments:

• root node is empty assignment

• dead-ends are partial assignments that violate a constraint

• 'goal' nodes are complete assignments

• children n′ of node n obtained by picking up unassigned variable inn, and assigning it a value

• costs c(n, n′) uniform in consistency problems, and dependent on localfunctions in COP and BNets.

-- Choice of branching variable affects size of Search Tree and criticalfor performance

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 32

Page 17: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Problem Space for Graphical Models: AND/OR Space

• Solution to enumeration problems, like model counting over CNFs andbelief updating over BNets, do not correspond to solution paths ingraph but can be computed from it

• We will also see an alternative formulation of all these tasks in termsof AND/OR Graphs rather than (OR) Graphs that exploit decomposition

• This AND/OR space is (almost) explicit in some algorithms (e.g., Re-cursive Conditioning) and implicit in others (e.g., non-chronologicalbacktracking).

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 33

Map

• Introduction

– Models based on States– Models based on Variables– Overview of Techniques∗ Search Space� Pruning∗ Learning∗ Decomposition∗ Compilation∗ Variable Elimination

• Solving models with Search and Inference

– State-based Models– Variable-based [Factored or Graphical] Models

• Solving models with Pure Inference and No Search

• Hybrid Methods

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 34

Page 18: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Pruning in Depth-First Search

• Search graph can be solved by Depth-First Search (DFS) and variations

• More effective DFS obtained by pruning nodes that cannot lead toacceptable solutions; e.g.,

Consistency: prune node n if it can only lead to dead-ends

State Models/Optimization: prune node n if it can only lead tosolutions with cost > than given Bound

• By playing with Bound one can get Bounded DFS, IDA*, DFS Branch &Bound

• Key issue: how to predict when paths up to node n

– can only lead to dead-ends? [consistency]– can only lead to solutions with cost > Bound? [optimization]

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 35

Pruning (2)

• Pruning criterion has to be sound and cost-effective

• Two ideas: lower bounds (LBs) and constraint propagation (CP)

– LBs: prune n if f(n) > Bound where f(n) is LB of cost of bestsolution that extends n

– CP: prune value x from variable X domain, if X = x provedinconsistent with constraints and commitments in n; prune node nitself if some domain becomes empty

• LBs and CP mechanisms can both be obtained as inference in relaxedmodel; e.g.

– in Strips: forget `deletes' and assume (relaxed) actions can be donein parallel (`simple reachability heuristic')

– in CSPs: e.g., solve each constraint in isolation ('arc consistency')

We will say more about LBs and CP mechanisms . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 36

Page 19: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Learning during Search (State Models)

• Results of (partial) search can be used to improve pruning in rest ofthe search

• E.g., if node shown not to lead to solution found again in the search,it can be pruned right away

• However one can do better; e.g., in IDA*, for example, right afterall sons n′ of node n return without a solution (for given Bound),heuristic value h(n) can be increased to:

h(n) := minn′:n→n′ c(n, n′) + h(n′)

• Resulting algorithm known as IDA* + Transposition Tables

• Exactly same update rule used in Learning Real Time A* (LRTA*)

• Actually updates can be done without search at all and they eventuallyyield h∗! This is what Value Iteration does, which also applies to MDPs

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 37

Learning during Search (Factored Models)

• For consistency tasks (SAT, CSP), one can actually do even better

• Rather than updating the value of a node, update the theory itself!

• Use structure for identifying and ruling out cause of the inconsistency

• This is the idea of no-good learning in SAT and CSPs

• Learned information

– applies to other nodes as well– results in non-chronological backtracking– enables further inferences and pruning

• It is a key idea in current SAT solvers

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 38

Page 20: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Decomposition

• Consider solving a SAT problem T made up of two independent sub-problems T ′ and T ′′ with n variables each, none in common

• By decomposing the problem in two as

SAT (T ) = SAT (T ′) & SAT (T ′′)

worst case complexity is reduced from 2n ∗ 2n to 2n + 2n

• Interestingly, if T ′ and T ′′ overlap over single variable X, T can stillbe decomposed by conditioning on X as

SAT (T ) =∨x

SAT (T ′X=x) & SAT (T ′′

X=x)

where TX=x means T with variable X replaced by value x.

• This idea can be applied recursively, even if T ′ and T ′′ overlap overset of variables

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 39

Decomposition and AND/OR Search Graph

• Decomposition by recursive conditioning maps search over OR-graphinto search over AND/OR graph

T´ T´x́=0x=0 T´ T´x́=1x=1

T

x=1x=0

• By suitable choice of decompositions and caching, worst-case complex-ity can be reduced from O(Exp(n)) to O(Exp(w∗)), where w∗ ≤ n istheory treewidth (e.g., linear for trees)

• Similar decomposition methods can be used (and are used!) for enu-meration tasks like Model Counting (MC) and Belief Update but withdifferent agregation operators; e.g.,

MC(T ) =∑

x

MC(T ′X=x) ∗ MC(T ′′

X=x)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 40

Page 21: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

From Decomposition to Knowledge Compilation (1)

• Suitable 'trace' of AND/OR Search can be used to perform a large classof intractable boolean operations in time linear in size of 'trace'

• Indeed, just map AND/OR Graph for P into logically equivalent AND/ORformula F (T ) by simple transformation:

=⇒

T´ T´x́=0x=0 T´ T´x́=1x=1

T

x=1x=0

x

F(T´ )x=0

F(T´ )x=1

−x

F(T´´ )x=0

F(T´´ )x=1

F(T)

• AND/OR formula F (T ) is in Deterministic Decomposable Negation Nor-mal Form (d-DNNF): disjuncts are exclusive, conjuncts share no vari-ables, and negations affect vars only; closely related to OBDDs

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 41

Map

• Introduction

– Models based on States– Models based on Variables– Overview of Techniques∗ Search Space∗ Pruning∗ Learning∗ Decomposition∗ Compilation� Variable Elimination

• Solving models with Search and Inference

– State-based Models– Variable-based [Factored or Graphical] Models

• Solving models with Pure Inference and No Search

• Hybrid Methods

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 42

Page 22: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Variable Elimination

• Gaussian Elimination used to solve n linear equations Tn with n un-knowns X1, . . . , Xn

– Eliminate Xn obtaining n− 1 equations Tn−1 with n− 1 unknowns– Iterate til obtaining 1 equation T1 with 1 unknown (X1)– Solve T1 for X1 and plug result into T2

– Solve T2 for X2 and plug result x2 for X2 into T3, etc

• Method can be be generalized to graphical models; only change is wayfor eliminating variables; e.g.,

– in CNF, Xi eliminated by resolving upon Xi

– in CSPs, Xi eliminated by join and project DB operations– in Belief Update (BNets), Xi eliminated by sum and products, . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 43

Variable Elimination, Inference, and AND/OR Search

• Variable Elimination solves problems by inference and no search

• Yet same complexity bounds (O(Exp(w∗))) as Decomposition Methodswith Caching that search over AND/OR graphs, and furthermore . . .

• Variable Elimination can be understood as bottom up search of sameAND/OR graph!

Few powerful ideas that span a large terrain and have a lot of connectionsand ramifications. This is what the tutorial is about . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 44

Page 23: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Map

• Introduction (Hector)

– Models based on States– Models based on Variables– Overview of Techniques∗ Search Space∗ Pruning∗ Learning∗ Decomposition∗ Compilation∗ Variable Elimination

• Solving models with Search and Inference

� State-based Models (Hector)– Variable-based [Factored or Graphical] Models (Rina)

• Solving models with Pure Inference and No Search (Adnan)

• Hybrid Methods (Rina)

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 45

Part 2: Search and Inference

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 46

Page 24: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Techniques for Solving State Models: Focus

• Models

– Basic State Models: Complete Knowledge, Deterministic Actions– Markov Decision Processes: Stochastic Actions and Full Feedback

• Techniques

– Problem Space: Branching Schemes– Pruning: Admissible heuristics or LBs h(s) ≤ h∗(s)– Learning: Improving h(s) while Searching

• Language

– We assume Models specified in a Strips-like language– This takes us into what is called Planning in AI

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 47

State Models Reminder

• Basic State Model characterized by

– finite and discrete state space S– an initial state s0 ∈ S– a set G ⊆ S of goal states– actions A(s) ⊆ A applicable in each state s ∈ S– a state transition function f(s, a) for s ∈ S and a ∈ A(s)– action costs c(a, s) > 0

• A solution is a sequence of applicable actions that map initial state s0

into goal state

• Optimal solutions minimize total cost . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 48

Page 25: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Strips Reminder

• A problem in Strips is a tuple 〈A,O, I, G〉:

– A stands for set of all atoms (boolean vars)– O stands for set of all operators (actions)– I ⊆ A stands for initial situation– G ⊆ A stands for goal situation

• Operators o ∈ O represented by three lists

-- the Add list Add(o) ⊆ A-- the Delete list Del(o) ⊆ A-- the Precondition list Pre(o) ⊆ A

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 49

Strips: From Language to Model

Strips problem P = 〈A,O, I, G〉 determines state model S(P ) where

• the states s ∈ S are collections of atoms

• the initial state s0 is I

• the goal states s are such that G ⊆ s

• the actions a in A(s) are s.t. Prec(a) ⊆ s

• the next state is s′ = s−Del(a) + Add(a)

• action costs c(a, s) are all 1

The (optimal) solution of problem P is the (optimal) solution of StateModel S(P )

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 50

Page 26: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Pruning: Getting Lower Bounds for Strips Problems

Admissible Heuristics (LBs) for Strips obtained by solving relaxed models

• ignore delete-lists

• ignore certain atoms

• decompose goals sets into smaller subsets

– e.g., assume cost of achieving set given by cost of achieving mostcostly pair in the set . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 51

Lower Bounds for Strips: Reachability GraphIgnore deletes and apply all actions in parallel:

P0 A0 P1 A1

...

...

...

P0 = {p ∈ s}Ai = {a ∈ O | Prec(a) ⊆ Pi}

Pi+1 = {p ∈ Add(a) | a ∈ Ai}

Define then admissible heuristic

h1G(s) def= min i such that G ⊆ Pi

Need No-op(p) action for each p: Prec = Add = {p}

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 52

Page 27: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Planning Graph = Reachability Graph + Mutexes

• Better relaxation: assume no deletes and that all actions can be donein parallel except certain incompatible action pairs

• This relaxation not tractable but good LB approximation exists, inparticular for parallel planning (where only diff is that deletes are notignored)

– action pair mutex at i if incompatible or preconditions mutex at i– atom pair mutex at i + 1 if all supporting action pairs mutex at i

• Mutex x, y at i implies that no valid plan can have both x and y at ibut not the converse

• Define then more informed admissible heuristic h2G(s) as:

h2G(s) def= min i such that G ⊆ Pi & not mutex at i

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 53

• Graph and resulting heuristic h2G(s) computed for one state s only, but

valid for any goal G . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 54

Page 28: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

How to use Strips Heuristics? Problem Spaces in Planning

• Option 1: Progression Space: search forward from s0

– recompute graph and h2G(s) for every s; this is costly

• Option 2: Regression Space: search backward from Goal (Graphplan)

– no need to recompute graph which encodes h2G′(s) for all goals G′!

but high branching factor when lots of parallel actions

• Option 3: Action Space: non-directional search

– Branch by picking an action a and time point i and trying the twopossibilities: a in the plan at i ; a not in the plan at i

– At each node n recompute planning graph from s0 respectingcommitments in n, and prune n if Goals pushed beyond horizon

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 55

Current State of the Art in Planning

No single best Problem Space or Pruning Criterion for all types ofplanning tasks:

• Sequential (Classical) Planning: Heuristic Search in Progression Spacecurrently best with both admissible and non-admissible h's

• Optimal Parallel Planning: SAT formulation fed to state-of-the-artsolvers (Siege) currenty best

• Optimal Temporal Planning: Search in Plan Space (POCL) best withpruning scheme based on Constraint Propagation

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 56

Page 29: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Learning while Searching in State Models

A number of algorithms combine search with state value updates:

• Learning Real time A* (LRTA*)

• IDA* + Memory (Tranposition Tables)

• Real Time Dynamic Programming (RTDP)

• MTD (algorithm for Game Trees better than Alpha-Beta)

• . . .

Other algorithms do updates with no search

• Value Iteration

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 57

Understanding Value Updates: Dynamic Programming

• Solutions to wide range of models can be expressed in terms of solutionof so-called Bellman equation:

V (s) = mina∈A(s) QV (a, s)

where cost-to-go term QV (a, s) depends on model (F (a, s): next states)

c(a, s) + V (s′), s′ ∈ F (a, s) for OR Graphsc(a, s) + maxs′∈F (a,s) V (s′) for Max AND/OR Graphsc(a, s) +

∑s′∈F (a,s) V (s′) for Additive AND/OR Graphs

c(a, s) +∑

s′∈F (a,s) Pa(s′|s)V (s′) for MDPsmaxs′∈F (a,s) V (s′) for Game Trees

• The greedy policy πV is optimal when V = V ∗ solves Bellman

πV (s) = argmina∈A(s) QV (a, s)

• Question: how to get V ∗?

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 58

Page 30: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Updates with No Search: Value Iteration

• Value Iteration finds V ∗ by successive approximations

• Starting with an arbitrary V , uses Bellman equation to update V ; e.g.for Basic State Models (OR Graphs)

V (s) := mina∈A(s) [c(a, s) + V (sa)]

• As long as all states updated sufficiently often (and certain generalconditions hold), left and right hand sides converge, and V = V ∗

• VI is simple and general but also exhaustive

• Can the updates be restricted to subset of states preserving optimality?

• Yes: like in Heuristic Search, use Lower Bounds and Initial State

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 59

Focusing Value Iteration using LBs and Initial State

• Say that a state s is

– inconsistent if V (s) < mina∈A(s) QV (a, s), and– greedy if reachable from s0 using greedy policy πV

• Then starting with an admissible, follow loop:

– Find an inconsistent greedy state s and Update it

• Loops delivers greedy policy that is optimal even if some states notupdated or visited at all!

• Unlike DP method, both LBs (V ≤ V ∗) and Initial State (s0) used

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 60

Page 31: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

Learning During Search in State Models

• Convergence of all Learning Algorithms in State Models (LRTA*, MTD,IDA*+TT, . . . ) can be understood in these terms: update an inconsis-tent greedy state in all iterations til no more such states

• Speed up obtained by updating multiple such states in every iteration

• This can be done by implementing Find as a DFS over greedy stateswith inconsistent states as terminals (Learning in Depth-First Search)

• This is what IDA* + Trans. Tables (Basic State Models) and MTD(Game Trees) actually do

• Same idea underlies current heuristic-search methods for solvingMDPs: LAO*, RTDP, HDP, . . .

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 61

Bibliography: Techniques for Solving State Models Part• Heuristics for Strips Planning: [23, 6, 16, 14, 30]; admissible heuristics [13, 9, 12]; heuristics and the planning graph

[6, 13, 24]; Graphplan [4].• Planners searching in Regression Space [4, 5, 13].• Planners searching in `Plan Space': [22, 18, 32].• Planners searching in (non-directional) `Action Space': SAT-formulation and CSP formulations like [19, 28] (and in particular

[10]), and [15].• Temporal Planning: [21, 25, 17], Optimal Temporal Planning [31], Planning and Scheduling [29].• Learning while Searching in State Models: IDA* with Transposition Tables [27], LRTA* [20], RTDP [1], MTD for Game Trees

[26]; general LDFS framework [8].• Value Iteration and Dynamic Programming [2, 3].• Focusing Value Iteration: General Find-and-Revise procedure [7, 8]• Learning in DFS [8], Heuristic Search Algorithms for MDPs [1, 11, 7]

References

[1] A. Barto, S. Bradtke, and S. Singh. Learning to act using real-time dynamic programming. Artificial Intelligence,72:81--138, 1995.

[2] R. Bellman. Dynamic Programming. Princeton University Press, 1957.

[3] D. Bertsekas. Dynamic Programming and Optimal Control, Vols 1 and 2. Athena Scientific, 1995.

[4] A. Blum and M. Furst. Fast planning through planning graph analysis. In Proceedings of IJCAI-95, pages 1636--1642.Morgan Kaufmann, 1995.

[5] B. Bonet and H. Geffner. Planning as heuristic search: New results. In Proceedings of ECP-99, pages 359--371. Springer,1999.

[6] B. Bonet and H. Geffner. Planning as heuristic search. Artificial Intelligence, 129(1--2):5--33, 2001.

[7] B. Bonet and H. Geffner. Faster heuristic search algorithms for planning with uncertainty and full feedback. In Proc.IJCAI-03, pages 1233--1238, 2003.

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 62

Page 32: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

[8] B. Bonet and H. Geffner. Learning in DFS: A unified approach to heuristic search in deterministic, non-deterministic,probabilistic, and game tree settings. 2005.

[9] S. Edelkamp. Planning with pattern databases. In Proc. ECP 2001, 2001.

[10] E. Giunchiglia, A. Massarotto, and R. Sebastiani. Act, and the rest will follow: Exploiting determinism in planning assatisfiability. In Proc. AAAI-98, pages 948--953, 1998.

[11] E. Hansen and S. Zilberstein. Lao*: A heuristic search algorithm that finds solutions with loops. Artificial Intelligence,129:35--62, 2001.

[12] P. Haslum, B. Bonet, and H. Geffner. New admissible heuristics for optimal planning. In Proc. AAAI-05, 2005. To appear.

[13] P. Haslum and H. Geffner. Admissible heuristics for optimal planning. In Proc. of the Fifth International Conference onAI Planning Systems (AIPS-2000), pages 70--82, 2000.

[14] M. Helmert. A planning heuristic based on causal graph analysis. In Proc. ICAPS-04, pages 161--170, 2004.

[15] J. Hoffmann and H. Geffner. Branching matters: Alternative branching in graphplan. In E. Giunchiglia, N. Muscettolla,and D. Nau, editors, Proc. 13th Int. Conf. on Automated Planning and Scheduling (ICAPS-2003), pages 22--31. AAAI Press,2003.

[16] J. Hoffmann and B. Nebel. The FF planning system: Fast plan generation through heuristic search. Journal of ArtificialIntelligence Research, 14:253--302, 2001.

[17] A. Jonsson, P. Morris, N. Muscettola, and K. Rajan. Planning in interplanetary space: Theory and practice. In Proc.AIPS-2000, pages 177--186, 2000.

[18] S. Kambhampati, C. Knoblock, and Q. Yang. Planning as refinement search: A unified framework for evaluating designtradeoffs in partial-order planning. Artificial Intelligence, 76(1-2):167--238, 1995.

[19] H. Kautz and B. Selman. Pushing the envelope: Planning, propositional logic, and stochastic search. In Proceedings ofAAAI-96, pages 1194--1201. AAAI Press / MIT Press, 1996.

[20] R. Korf. Real-time heuristic search. Artificial Intelligence, 42:189--211, 1990.

[21] P. Laborie and M. Ghallab. Planning with sharable resources constraints. In C. Mellish, editor, Proc. IJCAI-95, pages1643--1649. Morgan Kaufmann, 1995.

[22] D. McAllester and D. Rosenblitt. Systematic nonlinear planning. In Proceedings of AAAI-91, pages 634--639, Anaheim, CA,1991. AAAI Press.

[23] D. McDermott. Using regression-match graphs to control search in planning. Artificial Intelligence, 109(1-2):111--159,1999.

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 63

[24] X. Nguyen, S. Kambhampati, and R. Sanchez Nigenda. Planning graph as the basis for deriving heuristics for plan synthesisby state space and CSP search. Artificial Intelligence, 135(1-2):73--123, 2002.

[25] J. Penberthy and D. Weld. Temporal planning with continous change. In Proc. AAAI-94, pages 1010--1015, 1994.

[26] A. Plaat, J. Schaeffer, W. Pijls, and A.de Bruin. Best-first fixed-depth minimax algorithms. Artificial Intelligence,87(1-2):255--293, 1996.

[27] A. Reinefeld and T. Marsland. Enhanced iterative-deepening search. IEEE Trans. on Pattern Analysis and MachineIntelligence, 16(7):701--710, 1994.

[28] J. Rintanen. A planning algorithm not based on directional search. In Proceedings KR'98, pages 617--624. MorganKaufmann, 1998.

[29] D. Smith, J. Frank, and A. Jonsson. Bridging the gap between planning and scheduling. Knowledge Engineering Review,15(1), 2000.

[30] V. Vidal. A lookahead strategy for heuristic search planning. In Proc. ICAPS-04, pages 150--159, 2004.

[31] V. Vidal and H. Geffner. Branching and pruning: An optimal temporal POCL planner based on constraint programming.In D. McGuiness and G. Ferguson, editors, Proceedings of 19th Nat. Conf. on Artificial Intelligence (AAAI-04), pages570--577. AAAI Press/MIT Press, 2004.

[32] Daniel S. Weld. An introduction to least commitment planning. AI Magazine, 15(4):27--61, 1994.

H. Geffner, Principles of AI Problem Solving , IJCAI Tutorial 7/2005 64

Page 33: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

1

7/2005 Principles of AI Problem Solving 1 R. Dechter

Solving problems with search

and inference

August 2005 Ijcai-05 - Principles 2

Road Map:

Search in variable-based models

� Variable-based (Graphical) models� Basic search � Constraint propagation as bounded inference� Improving search by bounded inference in

branching ahead.� Improving search by looking-back� The alternative AND/OR search space

Page 34: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

2

August 2005 Ijcai-05 - Principles 3

Road Map:

Search in variable-based models

� Variable-based (Graphical) models• Constraints and cost networks• Probabilistic networks

� Basic search and basic Inference � Constraint propagation: bounded inference� Improving search by branching ahead� Improving search by looking-back� The alternative AND/OR search space

August 2005 Ijcai-05 - Principles 4

A Bred greenred yellowgreen redgreen yellowyellow greenyellow red

Example: map coloringVariables - countries (A,B,C,etc.)

Values - colors (e.g., red, green, yellow)

Constraints: etc. ,ED D, AB,A ≠≠≠

C

A

B

DE

F

G

Task: consistency?Find a solution, all solutions, counting

Constraint Satisfaction

Page 35: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

3

August 2005 Ijcai-05 - Principles 5

ϕϕϕϕ = {(¬C), (A v B v C), (¬A v B v E), (¬B v C v D)}.

Propositional Satisfiability

August 2005 Ijcai-05 - Principles 6

Constraint Optimization

� Variables ⇒ Nodes� Constrained

Variables ⇒ Edges� e.g.:

f1(x1,x2,x3)f2(x2,x3,x5)f3(x1,x4)f4(x4,x5)

x1

x3

x5x4

x2

})({'

1∑

=∈

m

ii

Solttfmin

Page 36: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

4

August 2005 Ijcai-05 - Principles 7

Probabilistic Networks

Smoking

BronchitisCancer

X-Ray

Dyspnoea

P(S)

P(B|S)

P(D|C,B)

P(C|S)

P(X|C,S)

P(S,C,B,X,D) = P(S)� P(C|S)� P(B|S)� P(X|C,S)� P(D|C,B)

0.10.911

0.20.801

0.30.710

0.90.100

D=1D=0BC

P(D|C,B)

August 2005 Ijcai-05 - Principles 8

� A graphical model (X,D,C):• X = {X1,…Xn} variables• D = {D1, … Dn} domains• C = {F1,…,Ft} functions

(constraints, CPTS, cnfs)• Primal graph

Graphical modelsGraphical modelsGraphical modelsGraphical models

CAFF

CAFPF

i

i

+===:

),|(:

A

D

B C

E

F

Page 37: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

5

August 2005 Ijcai-05 - Principles 9

� A graphical model (X,D,C):• X = {X1,…Xn} variables• D = {D1, … Dn} domains• C = {F1,…,Ft} functions

(constraints, CPTS, cnfs)• Primal graph

Graphical modelsGraphical modelsGraphical modelsGraphical models

CAFF

CAFPF

i

i

+===:

),|(:

A

D

B C

E

F

�MPE: maxX ∏∏∏∏j Pj

�CSP: ∏∏∏∏X ××××j Cj

�Max-CSP: minX Σj Fj�Belief updating: ΣΣΣΣX-y ∏∏∏∏j Pi

�Optimization: minX Σj Fj�MEU:

A reasoning problemdefined by operators combine and project:

August 2005 Ijcai-05 - Principles 10

� A graphical model (X,D,C):• X = {X1,…Xn} variables• D = {D1, … Dn} domains• C = {F1,…,Ft} functions

(constraints, CPTS, cnfs)• Primal graph

Graphical modelsGraphical modelsGraphical modelsGraphical models

CAFF

CAFPF

i

i

+===:

),|(:

A

D

B C

E

F

�MPE: maxX ∏∏∏∏j Pj

�CSP: ∏∏∏∏X ××××j Cj

�Max-CSP: minX Σj Fj�Belief updating: ΣΣΣΣX-y ∏∏∏∏j Pi

�Optimization: minX Σj Fj�MEU:

A reasoning problemdefined by operators combine and project:

All these tasks are NP-hard���� identify special cases���� approximate

Page 38: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

6

August 2005 Ijcai-05 - Principles 11

The Graphs of Graphical Models

Hyper-graph Primal graph

Dual graph Acyclic dual graph

R= {f(AEF),f(ABC),f(ACE),f(CDE)}

August 2005 Ijcai-05 - Principles 12

Induced-width and Tree-widthE

D

A

C

BEDCB

DCBA

DBE

ADB

CBE

Tree-width=3

Tree-width=2

Induced-widthOf ordering

Page 39: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

7

August 2005 Ijcai-05 - Principles 13

Induced-width and Tree-widthE

D

A

C

BEDCB

DCBA

DBE

ADB

CBE

Tree-width=3

Tree-width=2

Induced-widthOf ordering

Tree-width of a graph = smallest cluster in a cluster-treePath-width of a graph = smallest cluster in a cluster-path

August 2005 Ijcai-05 - Principles 14

Two Primary Reasoning Methods

� Inference• Variable elimination • Tree-clustering

� Search• Backtracking (conditioning)• Branch and Bound

� Hybrids of search and inference• Cycle-cutset scheme

Page 40: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

8

August 2005 Ijcai-05 - Principles 15

Road Map:

Search in Variable-based Models

� Variable-based (Graphical) models

� Basic search: DFS search, Backtracking� Constraint propagation: bounded inference� Improving search by bounded-inference in

branching ahead� Improving search by looking-back� The alternative AND/OR search space

August 2005 Ijcai-05 - Principles 16

Focus: Constraint Networks

� Relation: allowed tuples (semantics)

� Algebraic expression:

� Propositional formula:

YXYX ≠≤+ ,102

cba ¬→∨ )(

312

231

ΖYX

Page 41: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

9

August 2005 Ijcai-05 - Principles 17

The Full Search Space

X

..... ..... .....

Y

T

X Y

T Z

=∧∧∧∧

<<<<

<<<<

D={1,2,3}

Z

August 2005 Ijcai-05 - Principles 18

The Search Space

X

..... ..... .....

Y

T

X Y

T Z

<<<<

=

<<<<

∧∧∧∧

1 2 3

2 3 3

Z

X<Y

Page 42: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

10

August 2005 Ijcai-05 - Principles 19

The Search Space

X

..... ..... .....

Y

T

X Y

T Z

<<<<

=

<<<<

∧∧∧∧

1 2 3

2 3 3

2 3

Z

X<Y

X<T

August 2005 Ijcai-05 - Principles 20

The Search Space

X

..... ..... .....

Y

T

X Y

T Z

<<<<

=

<<<<

∧∧∧∧

1 2 3

2 3 3

2 3

Z

X<Y

X<T

Y=Z

Page 43: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

11

August 2005 Ijcai-05 - Principles 21

The Search Space

X

..... ..... .....

Y

T

X Y

T Z

<<<<

=

<<<<

∧∧∧∧

1 2 3

2 3 3

2 3

Z

•Search space contains only partial solutions

•Can be tight•Depends on variable orderings•Depends on tightness of constraints•Depends on….

August 2005 Ijcai-05 - Principles 22

Traversing the search space:Backtracking (DFS) Search for a Solution

Not-equal

Page 44: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

12

August 2005 Ijcai-05 - Principles 23

Search for a Single Solution

August 2005 Ijcai-05 - Principles 24

Search for All Solutions

Page 45: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

13

August 2005 Ijcai-05 - Principles 25

Search for All Solutions

For all tasksTime: O(exp(n))Space: linear

August 2005 Ijcai-05 - Principles 26

Traversing Breadth-First (BFS)?

Not-equal

BFS space is exp(n) while noTime gain ���� use DFS

Page 46: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

14

August 2005 Ijcai-05 - Principles 27

Road Map:

Search in Variable-Based Models

� Variable-based (Graphical) models� Basic search� Constraint propagation: bounded inference� Improving search by branching ahead

� Improving search by looking-back� The alternative AND/OR search space� Hybrid Schemes

August 2005 Ijcai-05 - Principles 28

32,1,

32,1, 32,1,

1 ≤≤≤≤ X, Y, Z, T ≤≤≤≤ 3X <<<< YY = ZT <<<< ZX ≤≤≤≤ T

X Y

T Z

32,1,<<<<

=

<

Arc-consistency

Page 47: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

15

August 2005 Ijcai-05 - Principles 29

1 ≤≤≤≤ X, Y, Z, T ≤≤≤≤ 3X <<<< YY = ZT <<<< ZX ≤≤≤≤ T

X Y

T Z

<<<<

=

<

1 3

2 3

• Only domains are reduced:

• Can be accomplished efficiently

∏←X YXYX DRR

Arc-consistency

)( 2ekO

August 2005 Ijcai-05 - Principles 30

Arc-consistency

A binary constraint R(X,Y) is arc-consistent w.r.t. X is every value in x’s domain has a match in y’s domain.

YXRR YX <== constraint },3,2,1{ },3,2,1{

).(},2,1{ to ofdomain reduces y)Revise(x, 2kORX X =

Page 48: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

16

August 2005 Ijcai-05 - Principles 31

21

3

A

232C

1A

12

32

1323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R

2R

4R

3R

5R

6R

Distributed Relational Arc-consistency

A

B C

D F

G

The message that R2 sends to R1 is

R1 updates its relation and domains and sends messages to neighbors

August 2005 Ijcai-05 - Principles 32

21

3

A

232C

1A

12

32

1323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R

2R

4R

3R

5R

6R

Relational Arc-consistency

A

B C

D F

G

The message that R2 sends to R1 is

R1 updates its relation and domains and sends messages to neighbors

Page 49: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

17

August 2005 Ijcai-05 - Principles 33

2

1

3

A

232C

1A

12321323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

DR-AC on a Dual Join-Graph

August 2005 Ijcai-05 - Principles 34

2

1

3

A

232C

1A

12321323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

DR-AC on a dual join-graph

Page 50: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

18

August 2005 Ijcai-05 - Principles 35

21

3

A

232C

1A

12321323

32B

11A

13F

232C

1B

3121322131

23D

23

32B

11A

33G

12F

21D

21

3

A21

3

A 21

3

A13

A

21

3

B13

B

21

3

A12

D

13

F

21

3

D

2C

21

3

B

2C

13

F

21

3

A

21

3

B

Iteration 1

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

August 2005 Ijcai-05 - Principles 36

13

A

232C

1A12

3213

3B

1A

13F

232C

1B

1322131

2D

23

3B

1A

3G

1F

2D

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 1

Page 51: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

19

August 2005 Ijcai-05 - Principles 37

13

A

232C

1A12

3213

3B

1A

13F

232C

1B

1322131

2D

23

3B

1A

3G

1F

2D

13

A

13

A 21

3

A13

A

13

A2D

13

F

21D

2C

13

B

2C

1F

21

3

A

13

B

21

3

B

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

Iteration 2

13

B

August 2005 Ijcai-05 - Principles 38

13

A

232C

1A13

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

Iteration 2

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Page 52: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

20

August 2005 Ijcai-05 - Principles 39

13

A

13

A

13

A

3B

13

A2D

1F

2D

2C

13

B

2C

1F

13

A13

A13

A

232C

1A13

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

13

B

13

B

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 3

August 2005 Ijcai-05 - Principles 40

13

A

232C

1A

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 3

Page 53: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

21

August 2005 Ijcai-05 - Principles 41

13

A

13

A1A

3B

13

A2D

1F

2D

2C

3B

2C

1F

13

A13

A13

A

232C

1A

3B

1A

1F

23CB

2132D

3B

1A

3G

1F

2D

13

B

13

B

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 4

August 2005 Ijcai-05 - Principles 42

1A

232C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 4

Page 54: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

22

August 2005 Ijcai-05 - Principles 43

1A

1A

1A

3B

3B

3B

1A

2D

1F

2D

2C

3B

2C

1F

1A

1A

1A

232C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

21h

31h

13h1

2h 14h

35h

24h2

5h

41h4

6h 42h

65h6

4h

52h 5

3h 56h

1R

2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Iteration 5

August 2005 Ijcai-05 - Principles 44

1A

2C

1A

3B

1A

1F

23CB

2D

3B

1A

3G

1F

2D

1R2R

4R

3R

5R

6R

A

AB AC

ABD BCF

DFG

B

4 5

3

6

2

B

D F

A

A

A

C

1

Arc-Consistent Network

Page 55: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

23

August 2005 Ijcai-05 - Principles 45

Gausian and Boolean

Propagation, Resolution

� Linear inequalities

� Boolean constraint propagation, unit resolution

)(),( BCBA ¬¬∨∨

⇒≥≤++ 13,15 zzyx

August 2005 Ijcai-05 - Principles 46

Gausian and Boolean

Propagation, Resolution

� Linear inequalities

� Boolean constraint propagation, unit resolution

)(

)(),(

CA

BCBA

¬∨⇒¬¬∨∨

2,2

13,15

≤≤⇒≥≤++

yx

zzyx

Page 56: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

24

August 2005 Ijcai-05 - Principles 47

Path-consistency

A pair (x, y) is path-consistent relative to Z, if every consistent

assignment (x, y) has a consistent extension to z.

)( 33knO

August 2005 Ijcai-05 - Principles 48

From Global to Local Consistency

Page 57: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

25

August 2005 Ijcai-05 - Principles 49

Road Map:

Search in Variable-Based Models

� Variable-based (Graphical) models� Basic search and basic Inference � Constraint propagation: bounded inference� Improving search by constraint propagation

in branching ahead� Improving search by looking-back� The alternative AND/OR search space� Hybrid Schemes

August 2005 Ijcai-05 - Principles 50

� Before search: (reducing the search space)• By constraint propation (e.g., Arc-consistency)

� During search:• apply constraint propagation at each node, • pruning values, and • advising values and variable orderings.

Improving Search by constraint

propagation

Page 58: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

26

August 2005 Ijcai-05 - Principles 51

The Search Space

Before Arc-Consistency

X

..... ..... .....

Y

T

X Y

T Z

<<<<

=

<<<<

∧∧∧∧

1 2 3

2 3 3

2 3

Z

D={1,2,3}

August 2005 Ijcai-05 - Principles 52

The Search Space

After Arc-Consistency

X

..... ..... .....

Y

T

1

2

2

Z

X Y<

=

<<<<

∧∧∧∧

1 3

2 3T Z

Page 59: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

27

August 2005 Ijcai-05 - Principles 53

Branching-Ahead:

Constraint Propagation in Search

� Apply some level of constraint propagation at each node,• Forward-checking (FC) • Arc- consistency (MAC)

� Then:• Value pruning • Value ordering (choose a value that leaves most

options open) • Variable ordering (choose a variable that leaves

least options open

August 2005 Ijcai-05 - Principles 54

Forward-Checking for Value Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

Page 60: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

28

August 2005 Ijcai-05 - Principles 55

Forward-Checking for Value Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

August 2005 Ijcai-05 - Principles 56

MAC for Value Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

Page 61: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

29

August 2005 Ijcai-05 - Principles 57

MAC for Value Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

Arc-consistency prunes x1=redPrunes the whole tree Not searched

By MAC

August 2005 Ijcai-05 - Principles 58

Forward-Checking, Variable Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

Page 62: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

30

August 2005 Ijcai-05 - Principles 59

Forward-Checking, Variable Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

After X1 = red choose X3 and not X2

August 2005 Ijcai-05 - Principles 60

Forward-Checking, Variable Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

After X1 = red choose X3 and not X2

Page 63: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

31

August 2005 Ijcai-05 - Principles 61

Forward-Checking, Variable Ordering

)( 2ekO

)(

)(3

2

ekO

ekOFW overhead:

MAC overhead:

After X1 = red choose X3 and not X2

August 2005 Ijcai-05 - Principles 62

Branching-Ahead for SAT: DLLexample: (~AVB)(~CVA)(AVBVD)(C)

Only enclosed area will be explored with unit-propagation

Backtracking look-ahead with Unit propagation= Generalized arc-consistency

(Davis, Logeman and Laveland, 1962)

Page 64: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

32

August 2005 Ijcai-05 - Principles 63

Look-Back: Backjumping

� (X1=r,x2=b,x3=b,x4=b,x5=g,x6=r,x7={r,b})� (r,b,b,b,g,r) conflict set of x7� (r,-,b,b,g,-) c.s. of x7� (r,-,b,-,-,-,-) minimal conflict-set� Leaf deadend : (r,b,b,b,g,r)� Every conflict-set is a no-good

August 2005 Ijcai-05 - Principles 64

Jumps at dead-ends

(Gascnnig 1977)

Page 65: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

33

August 2005 Ijcai-05 - Principles 65

Jumps at Dead-Ends

(Gascnnig 1977)

August 2005 Ijcai-05 - Principles 66

Complexity of Backjumping

Uses Pseudo-Tree Analysis

Simple: always jump back to parent in pseudo treeComplexity for csp: exp(w*)Complexity for csp: exp(w*log n)

Page 66: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

34

August 2005 Ijcai-05 - Principles 67

Complexity of Backjumping

Simple: always jump back to parent in pseudo treeComplexity for csp: exp(w*)Complexity for csp: exp(w*log n)From exp(n) to exp(w*logn) while linear space

August 2005 Ijcai-05 - Principles 68

Look-back: No-good Learning

� (x1=2,x2=2,x3=1,x4=2) is a dead-end

� Conflicts to record:• (x1=2,x2=2,x3=1,x4=2) 4-ary• (x3=1,x4=2) binary• (x4=2) unary

Learning means recording conflict setsused as constraints to prune future search space.

Page 67: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

35

August 2005 Ijcai-05 - Principles 69

No-good Learning Example

August 2005 Ijcai-05 - Principles 70

Complexity of Nogood-Learning

for consistency

� The number of dead-ends is bounded by� Number of constraint tests per dead-end are

Space complexity is Time complexity is )(

)()*(2

)*(

dw

dw

kenO

nkO

� The complexity of learning along d is time and space exponential in w*(d):

)( )*( dwnkO)(eO

Page 68: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

36

August 2005 Ijcai-05 - Principles 71

Complexity of Nogood-Learning

for consistency

� The number of dead-ends is bounded by� Number of constraint tests per dead-end are

Space complexity is Time complexity isNo-good Learning reduces time to O(exp(w*)) but O(exp(w*)) space.

)(

)()*(2

)*(

dw

dw

kenO

nkO

� The complexity of learning along d is time and space exponential in w*(d):

)( )*( dwnkO)(eO

August 2005 Ijcai-05 - Principles 72

All Solutions and Counting

� For all solutions and counting we will see • The additional impact of Good learning • BFS makes sense with good learning• BFS and DFS time and space exp(path- width)• Good- learning doesn’t help consistency task

Page 69: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

37

August 2005 Ijcai-05 - Principles 73

#CSP – OR Search Tree

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

August 2005 Ijcai-05 - Principles 74

#CSP - OR Search Tree

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

11111011010110010110101011001000

RBCDDCB

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

Page 70: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

38

August 2005 Ijcai-05 - Principles 75

#CSP - OR Search Tree

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

11111011010110010110101011001000

RBCDDCB

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

14 solutions

1 2 3 4 6 7 9 10 11 12 13 145 8

August 2005 Ijcai-05 - Principles 76

#CSP - Tree DFS Traversal

0 1

0

0 1

0 1

0

C

D

F

E

B

A 0

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

0 1

1 0

1

0 1

0 1

0 1

1 0

1 1

2

0

0 1

0 1

0 1

1 0

1 0 1

1

3

Value of node = number of solutions below it

5

0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1

1 0 1

1

0 1 0 11 1 1 1 1 0 1 0 1 0 1 1

1 2 1 2

0

01

01

02

0

0

0

2

2

2

1

03 3

6

6

9

1 1 1

12

3

14

Page 71: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

39

August 2005 Ijcai-05 - Principles 77

#CSP - Searching the Graph by

Good Caching

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1

0 1 0 1

0 1 0 1

C context(C) = [ABC]

D context(D) = [ABD]

F context(F) = [F]

E context(E) = [AE]

B context(B) = [AB]

A context(A) = [A] 0 1

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

August 2005 Ijcai-05 - Principles 78

#CSP - Searching the Graph by

Good Caching

0

0 1

0 1

0 1

0

C context(C) = [ABC]

D context(D) = [ABD]

F context(F) = [F]

E context(E) = [AE]

B context(B) = [AB]

A context(A) = [A] 0

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

0 1

1 0

1 1

1 0 1 0 1 0 1

0 1 0 1 0 1

0 1

1 0 1

1

2

3

1

9

2

3 3

6

6

12

1 1

2 1

3

2

2

2

5

14

Page 72: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

40

August 2005 Ijcai-05 - Principles 79

#CSP - Searching the Graph by

Good Caching

0

0 1

0 1

0 1

0

C context(C) = [ABC]

D context(D) = [ABD]

F context(F) = [F]

E context(E) = [AE]

B context(B) = [AB]

A context(A) = [A] 0

A

E

C

B

F

D

01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

0 1

1 0

1 1

1 0 1 0 1 0 1

0 1 0 1 0 1

0 1

1 0 1

1

2

3

1

9

2

3 3

6

6

12

1 1

2 1

3

2

2

2

5

14

(A=0,E=0) is goodV(A=0,E=0)=1

August 2005 Ijcai-05 - Principles 80

#CSP - Searching the Graph by

Good Caching

A

E

C

B

F

D

0

0 1

0 1

0 1

0

0

0 1

1 0

1 1

1 0 1 0 1 0 1

0 1 0 1 0 1

0 1

1 0 1

1

2

3

1

9

3 3

6

6

12

1 1

2 1

3

2

2

2

5

14

0 1

0

0 1

0 1

0

0

01

1 0

1

0 1

0 1

01

1 0

11

2

0

0 1

0 1

01

1 0

1 01

1

3

5

0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1

1 0 1

1

01 0111 11 10 10 10 11

1 2 1 2

0

0

1

01

0

2

0

0

0

2

2

2

1

03 3

6

6

9

1 1 1

12

3

14

Good-caching:O(exp(pw))No caching:

O(exp(n))

Page 73: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

41

August 2005 Ijcai-05 - Principles 81

Summary: Time-Space for

Constraint Processing� Constraint-satisfaction one

solution• Naive backtracking

• Space: O(n), • Time: O(exp(n))

• Backjumping• Space: O(n),• Time: O(exp(log n w*))

• Learning no-goods• Space: O(exp(w*)) • Time: O(exp(w*))

• Variable-elimination• Space: O(exp(w*)) • Time: O(exp(w*))

� Counting, enumeration

• Backtracking, backjumping• Space: O(n),• Time: O(exp(n ))

• Learning no-goods • space: O(exp(w*))• Time: O(exp(n))

• Search with goods and no-goods learning

• Space: O(exp(pw*)) • Time: O(exp(pw*)), pw

<=w*logn• Variable-elimination

• Space: O(exp(w*)) • Time: O(exp(w*))

• BFS is time and space O(exp(pw*))

August 2005 Ijcai-05 - Principles 82

Summary: Search Principles

� DFS is better than BFS search � Constraint propagation (bounded inference)

prunes search space� Constraint propagation yields good advise for

how to branch and where to go � Backjumping and no-good learning helps

prune search space and revise problem.� Good learning revise problem but helps only

counting, enumeration

Page 74: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

42

August 2005 Ijcai-05 - Principles 83

From Constraint Processing to

� Belief networks tasks� Optimization tasks� Task expressed as a value of a root node:

• V(n) = probability of sub-tree below n• V(n) = optimal solution below n• V(n) can be derived recursively • V(n) have Bellman recursive equations

August 2005 Ijcai-05 - Principles 84

Belief Updating: Belief Updating: Belief Updating: Belief Updating:

Searching the Probability TreeSearching the Probability TreeSearching the Probability TreeSearching the Probability Tree

∑∑∑∑=

==0

),|(),|()|()|()()0,(ebcb

cbePbadPacPabPaPeaP

Brute-force Complexity: exponential time, linear spaceVery similar to counting solution task

Page 75: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

43

August 2005 Ijcai-05 - Principles 85

Caching Goods for Beliefs

� For strictly positive distributions only caching goods is relevant.

� Both BFS and DFS are relevant

� Time and space O(exp(path-width))

August 2005 Ijcai-05 - Principles 86

Optimization Tasks

( ) ( )∑=

Χ=Χ9

1

mini

iX ff

A

E

C

B

F

D

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

Objective function:

101411

02f1

10B

00A

001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

Page 76: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

44

August 2005 Ijcai-05 - Principles 87

Optimization Tasks

Arc-cost is caculated based on cost components.

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

101411

02f1

10B

00A

A

E

C

B

F

D001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

3 02 23 0 2 23 0 2 2 3 02 2 3 02 23 0 2 23 0 2 23 02 2

0 0

3 5 3 5 3 5 3 5 1 3 1 3 1 3 1 3

5 6 4 2 2 4 1 0

3 1

2

5 4

0

1 20 41 2 0 41 2 0 4 1 20 4 1 20 41 20 41 2 0 41 20 4

5 2 5 2 5 2 5 2 3 0 3 0 3 0 3 0

5 6 4 2 2 4 1 0

0 2 2 5

0 4

August 2005 Ijcai-05 - Principles 88

Tree DFS Traversal for Values

Value of node = minimal cost solution below it

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

101411

02f1

10B

00A

A

E

C

B

F

D001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

3 0

0

2 2

6

2

3

3 0 2 23 0 2 2 3 02 2 3 02 23 0 2 23 0 2 23 02 2

0 0 02 2 2 0 2 0 0 02 2 2

3 3 3 1 1 1 1

8 5 3 1

5

5

1 0 1 1 10 0 0 1 0 1 1 10 0 0

2 2 2 2 0 0 0 0

7 4 2 0

7 4

7

50 0

3 5 3 5 3 5 3 5 1 3 1 3 1 3 1 3

5 6 4 2 2 4 1 0

3 1

2

5 4

0

1 20 41 2 0 41 2 0 4 1 20 4 1 20 41 20 41 2 0 41 20 4

5 2 5 2 5 2 5 2 3 0 3 0 3 0 3 0

5 6 4 2 2 4 1 0

0 2 2 5

0 4

Page 77: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

45

August 2005 Ijcai-05 - Principles 89

Tree DFS Traversal for Values

Value of node = minimal cost solution below it

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

101411

02f1

10B

00A

A

E

C

B

F

D001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

3 0

0

2 2

6

2

3

3 0 2 23 0 2 2 3 02 2 3 02 23 0 2 23 0 2 23 02 2

0 0 02 2 2 0 2 0 0 02 2 2

3 3 3 1 1 1 1

8 5 3 1

5

5

1 0 1 1 10 0 0 1 0 1 1 10 0 0

2 2 2 2 0 0 0 0

7 4 2 0

7 4

7

50 0

3 5 3 5 3 5 3 5 1 3 1 3 1 3 1 3

5 6 4 2 2 4 1 0

3 1

2

5 4

0

1 20 41 2 0 41 2 0 4 1 20 4 1 20 41 20 41 2 0 41 20 4

5 2 5 2 5 2 5 2 3 0 3 0 3 0 3 0

5 6 4 2 2 4 1 0

0 2 2 5

0 4

August 2005 Ijcai-05 - Principles 90

Searching the Graph

C context(C) = [ABC]

D context(D) = [ABD]

F context(F) = [F]

E context(E) = [AE]

B context(B) = [AB]

A context(A) = [A]

A

E

C

B

F

D101411

02f1

10B

00A

001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1

0 1 0 1

0 1 0 1

0 1

5

0 0

2 0 0 4

3 1 5 4 0 2 2 5

30

2

2 1

2

0

4

3

53 5 1 3

1

3

56 4

2 24 1

0 56 4

2 24

0

5

25 2 3 0

3

0

Page 78: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

46

August 2005 Ijcai-05 - Principles 91

Searching the Graph

C context(C) = [ABC]

D context(D) = [ABD]

F context(F) = [F]

E context(E) = [AE]

B context(B) = [AB]

A context(A) = [A]

A

E

C

B

F

D101411

02f1

10B

00A

001111

03f2

10C

00A

201011

30f3

10E

00A

001211

02f4

10F

00A

201411

10f5

10C

00B

101011

24f6

10D

00B

101011

23f7

10E

00B

001011

41f8

10D

00C

001211

01f9

10F

00E

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1

0 1 0 1

0 1 0 1

0 1

0 2 1 0

3 3 1 1 2 2 0 0

8 5 3 1 7 4 2 0

6 5 7 4

5 7

5

0 0

2 0 0 4

3 1 5 4 0 2 2 5

30

2

2 1

2

0

4

3

53 5 1 3

1

3

56 4

2 24 1

0 56 4

2 24 1

0

5

25 2 3 0

3

0

August 2005 Ijcai-05 - Principles 92

Summary:

Time-Space for Optimization/Belief

• DFS Search (with/without backjumping) • Space: O(n), Time: O(exp(n ))

• DFS Search with no-goods caching only• space: O(exp(w*)) Time: O(exp(n))

• Search with goods and no-goods learning• Space: O(exp(pw*)) Time: O(exp(pw*)), pw

<=w*logn• For optimization

• BFS Space: O(exp(c*)) Time: O(exp(c*)), c*=best-solution length.

• Variable-elimination• Space: O(exp(w*)) Time: O(exp(w*))

Page 79: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

47

August 2005 Ijcai-05 - Principles 93

Road Map:

Search in Graphical Models

� Variable-based (Graphical) models� Basic search� Constraint propagation: bounded inference� Improving search by bounded-inference in

branching ahead� Improving search by looking-back

� The alternative AND/OR search space

August 2005 Ijcai-05 - Principles 94

OR Search Space

A

D

B C

E

F

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

E

C

F

D

B

A 0 1

Ordering: A B E C D F

Page 80: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

48

August 2005 Ijcai-05 - Principles 95

AND/OR Search Space

AOR

0AND 1

BOR B

0AND 1 0 1

EOR C E C E C E C

OR D F D F D F D F D F D F D F D F

AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

AND 0 10 1 0 10 1 0 10 1 0 10 1

A

D

B C

E

F

A

D

B

CE

F

Primal graph DFS tree

A

D

B C

E

F

A

D

B C

E

F

August 2005 Ijcai-05 - Principles 96

AND/OR vs. OR

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

AOR

0AND 1

BOR B

0AND 1 0 1

EOR C E C E C E C

OR D F D F D F D F D F D F D F D F

AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

AND 0 10 1 0 10 1 0 10 1 0 10 1

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

AND/OR

OR

A

D

B C

E

F

A

D

B

CE

F

AND/OR size: exp(4), OR size exp(6)

Page 81: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

49

August 2005 Ijcai-05 - Principles 97

AND/OR vs. OR

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

AOR

0AND 1

BOR B

0AND 1 0 1

EOR C E C E C E C

OR D F D F D F D F D F D F D F D F

AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

AND 0 10 1 0 10 1 0 10 1 0 10 1

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

E 0 1 0 1 0 1 0 1

0C 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

F 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0 1

A 0 1

AND/OR

OR

A

D

B C

E

F

A

D

B

CE

F

No-goods(A=1,B=1)(B=0,C=0)

August 2005 Ijcai-05 - Principles 98

AND/OR vs. OR

F

AND/OR

A

D

B C

E

F

A

D

B

CE

F

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

AOR

0AND 1

BOR B

0AND 1 0

EOR C E C E C

OR D F D F D F D F

AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

AND 10 1 0 10 1 10 1

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

OR

(A=1,B=1)(B=0,C=0)

Page 82: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

50

August 2005 Ijcai-05 - Principles 99

AND/OR vs. OR

F

AND/OR

A

D

B C

E

F

A

D

B

CE

F

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

AOR

0AND 1

BOR B

0AND 1 0

EOR C E C E C

OR D F D F D F D F

AND 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

AND 10 1 0 10 1 10 1

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

E 0 1 0 1 0 1

C 1 1 0 1 0 1 1 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0B 1 0

A 0 1

OR

(A=1,B=1)(B=0,C=0)

Space: linearTime:O(exp(m))O(w* log n)

Linear space,Time:O(exp(n))

August 2005 Ijcai-05 - Principles 100

OR space vs. AND/OR space

18,25536,5100.11,048,5752,097,1503.104135

3,9037,8060.021,048,5752,097,1503.125104

4,4638,9260.031,048,5752,097,1503.124105

2,5515,1020.011,048,5752,097,1503.13594

5,24710,4940.031,048,5752,097,1503.154105

OR nodesAND nodesTime (sec.)BacktracksNodesTime (sec.)

AND/OR spaceOR spaceheightwidth

Random graphs with 20 nodes, 20 edges and 2 values per node.

Page 83: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

51

August 2005 Ijcai-05 - Principles 101

#CSP – AND/OR Search Tree

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

B

0

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

August 2005 Ijcai-05 - Principles 102

#CSP – AND/OR Search Tree

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

B

0

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

Page 84: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

52

August 2005 Ijcai-05 - Principles 103

#CSP – AND/OR Tree DFS

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F

AND 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1 1 1 0 0 1

2 1 1

2 1 1 0

3 1

3

9

9

1

E

F F

0 1 0 1

0 1

C

D

0 1

0 1

1

B

0

E

F

0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F

0 1

0 1

C

D

0 1

0 1

1 1 0 1 1 1

2 1 2

2 1 20

2 3

6

1 1 1 0 1 0 1 0 1 1

2 1 1 1 2

3 1

2 1 10 01 02

1 2

3 2

5

5

14

OR node: Marginalization operator (summation)

AND node: Combination operator (product)

August 2005 Ijcai-05 - Principles 104

Mixed Networks

A

D

B C

E

FA

D

B C

E

F

A

D

B C

E

F

∈∈

=∈=

otherwise ,0

if ,)(

)()|(

)(ρ

ρρ x

xP

xPxxP

xP B

BBΜ

Moral mixed graph

Belief Network Constraint Network

.5

.3

.1

.2

D=0

.511

.701

.910

.800

D=1CB

),|( CBDP

0

0

1

D

11

10

00

CB

)(3 BCDR

Page 85: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

53

August 2005 Ijcai-05 - Principles 105

The Effect of Constraint

Propagation

1 2

A

C

3 4

B CB

2 3 4

ED

3 4 3 4

HG

4 4

G I

4

I

D

4

G

ED

2 3 4

FF

4

K

F

4

K

3

K

4

3 4 3 4

4

G

D D

4

K

F F

B

4

D

B

A

D

B C

E F

G H I K

>

>

>

>

>

>> >

>

Domains are {1,2,3,4}

1

A

CB

2

ED

3 3

H

4 4

I

4

2

F

3

K

4

G

CONSTRAINTS ONLY

FORWARD CHECKING

MAINTAINING ARC CONSISTENCY

1 2

A

C

3

B CB

2 3

ED

3 3

HG

4 4

I

4

D

2 3

FF

3

K

4

3 3

D F

B

A

D

B C

E F

G H I K

August 2005 Ijcai-05 - Principles 106

0

A

B

0

E D

0 1

C

0

0 1

1

C

0 1

1

E D

0 1

C

0

0 1

1

C

0 1

P(A=0)

P(B=0|A=0) P(B=1|A=0)

P(E=0|A=0,B=0)

P(D=0|B=0,C=0)×P(C=0|A=0)

P(D=1|B=1,C=1)×P(C=1|A=0)

P(D=0|B=0,C=1)×P(C=1|A=0)

P(D=1|B=0,C=0)×P(C=0|A=0)

P(D=1|B=0,C=1)×P(C=1|A=0)

P(D=0|B=1,C=0)×P(C=0|A=0)

P(D=0|B=1,C=1)×P(C=1|A=0)

P(D=1|B=1,C=0)×P(C=0|A=0)

P(E=1|A=0,B=0) P(E=0|A=0,B=1) P(E=1|A=0,B=1)

A

C

B

DE

A

D

B C

EBelief-Updating

DFS: Linear spaceO(w* log n)

Page 86: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

54

August 2005 Ijcai-05 - Principles 107

Tasks and value of nodes� V( n) is the value of the tree T(n) for the task:

• Consistency : v(n) is 0 if T(n) inconsistent, 1 othewise.• Counting : v(n) is number of solutions in T(n) • Optimization : v(n) is the optimal solution in T(n)• Belief updating : v(n), probability of evidence in T(n).• Partition function: v(n) is the total probability in T(n).

� Goal : compute the value of the root node recursively using DFS or BFS search of the AND/OR tree.

� Theorem: Complexity of AO DFS search is• Space: O(n)• Time: O(n km)• Time: O(exp(w* log n))

� Time and Space of BFS: O(exp(w* log n))

August 2005 Ijcai-05 - Principles 108

From Search Trees to Search Graphs

� Any two nodes that root identical subtrees/subgraphs can be merged

� Minimal AND/OR search graph: closure under merge of the AND/OR search tree

• Inconsistent sub-trees can be pruned too.• Some portions can be collapsed or reduced.

Page 87: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

55

August 2005 Ijcai-05 - Principles 109

AND/OR TreeAND/OR TreeAND/OR TreeAND/OR Tree

A

D

B C

E

F

A

D

B

CE

F

G H

J

K

G

H

J

KAOR

0AND 1

BOR B

0AND 1 0 1

EOR C E C E C E C

OR D F D F D F D F D F D F D F D F

AND

AND 0 10 1 0 10 1 0 10 1 0 10 1

OR

OR

AND

AND

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

August 2005 Ijcai-05 - Principles 110

An AND/OR Graph:

Caching Goods

A

D

B C

E

F

A

D

B

CE

F

G H

J

K

G

H

J

KAOR

0AND 1

BOR B

0AND 1 0 1

EOR C E C E C E C

OR D F D F D F D F D F D F D F D F

AND

AND 0 10 1 0 10 1 0 10 1 0 10 1

OR

OR

AND

AND

0

G

H H

0 1 0 1

0 1

1

G

H H

0 1 0 1

0 1

0

J

K K

0 1 0 1

0 1

1

J

K K

0 1 0 1

0 1

Page 88: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

56

August 2005 Ijcai-05 - Principles 111

Context-based Caching

� Caching is possible when context is the same

� context = parent-separator set in induced pseudo-graph= current variable +

parents connected to subtree belowA

D

B C

E

F

A

D

B

CE

F

G H

J

K

G

H

J

K

context(B) = {A, B}

context(c) = {A,B,C}

context(D) = {D}

context(F) = {F}

August 2005 Ijcai-05 - Principles 112

Complexity of AND/OR Graph Complexity of AND/OR Graph Complexity of AND/OR Graph Complexity of AND/OR Graph

� Theorem: Traversing the AND/OR search graphis time and space exponential in the induced width/tree-width.

� If applied to the OR graph complexity is time and space exponential in the path-width.

Page 89: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

57

August 2005 Ijcai-05 - Principles 113

#CSP – AND/OR Search Tree

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

B

0

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

August 2005 Ijcai-05 - Principles 114

#CSP – AND/OR Tree DFS

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F

AND 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1 1 1 0 0 1

2 1 1

2 1 1 0

3 1

3

9

9

1

E

F F

0 1 0 1

0 1

C

D

0 1

0 1

1

B

0

E

F

0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F

0 1

0 1

C

D

0 1

0 1

1 1 0 1 1 1

2 1 2

2 1 20

2 3

6

1 1 1 0 1 0 1 0 1 1

2 1 1 1 2

3 1

2 1 10 01 02

1 2

3 2

5

5

14

Page 90: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

58

August 2005 Ijcai-05 - Principles 115

#CSP – AND/OR Search Graph

(Caching Goods)

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1

AND 0 1

C

D D

0 1

0 1

1

EC

D D

0 1

1

B

0

E

F F

0 1

C

1

EC

August 2005 Ijcai-05 - Principles 116

#CSP – AND/OR Search Graph

(Caching Goods)

A

E

C

B

F

D

A

D

B

EC

F01111011110110011110001011001000

RABCCBA

01111011110100011110101001001000

RABEEBA

01111011110110011110101011000000

RAEFFEA

11111011010110010110101011001000

RBCDDCB

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1

AND 0 1

C

D D

0 1

0 1

1

EC

D D

0 1

1

B

0

E

F F

0 1

C

1

EC

Time and SpaceO(exp(w*))

Page 91: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

59

August 2005 Ijcai-05 - Principles 117

All Four Search Spaces

Full OR search tree

126 nodes

Full AND/OR search tree

54 AND nodes

Context minimal OR search graph

28 nodes

Context minimal AND/OR search graph

18 AND nodes

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 1

CD

FE

BA 0 1

AOR

0AND

BOR

0AND

OR E

OR F F

AND 0 1 0 1

AND 0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

B

0

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

1

E

F F

0 1 0 1

0 1

C

D D

0 1 0 1

0 1

0 1 0 1 0 1 0 1

0 1 0 1 0 1 0 1

0 1

0 1 0 1

0 1 0 1

C

D

F

E

B

A 0 1

AOR0ANDBOR

0ANDOR E

OR F F

AND 0 1

AND 0 1

C

D D

0 1

0 1

1

EC

D D

0 1

1

B

0

E

F F

0 1

C

1

EC

August 2005 Ijcai-05 - Principles 118

Searching AND/OR Graphs

� AO(i): searches depth-first, cache i-context• i = the max size of a cache table (i.e. number

of variables in a context)

i=0 i=w*

Space: O(n)

Time: O(exp(w* log n))

Space: O(exp w*)

Time: O(exp w*)

AO(i) time complexity?

Page 92: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

60

August 2005 Ijcai-05 - Principles 119

Impact of AND/OR

for Constraint Processing

� Minor impact for Constraint-satisfaction• Search with backjumping or without backjumping

• Space: linear, Time: O(exp(logn w*))• Search with learning no-goods

• time and space: O(exp(w*))• Variable-elimination

• time and space: O(exp(w*))

� Counting, enumeration• Search with backjumping

• Space: linear, Time: O(exp(n ))• Space: linear, Time: O(exp(log n w*))

• Search with no-goods caching only• space: O(exp(w*)) Time: O(exp(n)) • space: O(exp(w*)) Time: O(exp(log n w*))

• Search with goods and no-goods learning• Time and space: O(exp(path-width), O(exp(log n w*))• Time and space: O(exp(tree-width), O(exp(w*))

• Variable-elimination• Time and space: O(exp(w*))

August 2005 Ijcai-05 - Principles 120

Impact of AND/OR

for Any Graphical Model

� Optimization, Belief• Search with backjumping

• Space: O(n), Time: O(exp(n ))• Space: linear, Time: O(exp(log n w*))

• Search with no-goods caching only• space: O(exp(w*)) Time: O(exp(n))• space: O(exp(w*)) Time: O(exp(log n w*))

• Search with goods and no-goods learning• Space: O(exp(pw*)) Time: O(exp(pw*)), pw <=w*logn• Time and space: O(exp(w*), O(exp(w*))

• For optimization can be• Space: O(exp(c*)) Time: O(exp(c*)), c*=best-solution length.

• Variable-elimination• Space: O(exp(w*)) Time: O(exp(w*))

Page 93: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

61

August 2005 Ijcai-05 - Principles 121

Algorithms for AND/OR Space

� Backjumping for CSPs (Gaschnig 1977, Dechter1990, Prosser, Bayardo et. Al, 1994.)

� Pseudo-search rearangement , for any CSP task (Freuder 1987)

� Recursive Conditioning (Darwiche, 1999), explores the AND/OR tree or graph for any query

� Searching tree-decomspositions for optimization: (Jeagou, 2000)

� Valued-elimination (Bacchus, 2003)� Variable-elimination ( next session, pure inference)

Page 94: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

1

A. Darwiche

Problem Solving Problem Solving by Inferenceby Inference

A. Darwiche

Basic PrinciplesBasic Principles

• Inference by Variable Elimination• Inference by Factor Elimination

(Tree-clustering, Jointree)• Inference by Recursive Conditioning

(Decomposition)

Page 95: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

2

A. Darwiche

The Inference ProblemThe Inference Problem

• Answer queries about a function which is given in factored form.

• Logic/Constraints: Boolean functions• Probability: Probability functions

• Techniques apply to other types of inference: belief functions, penalty logics, etc.

A. Darwiche

Bayesian NetworksBayesian Networks

.020ffffffff

.........

.........

.001fttttttt

.004tttttttt

Pr(.)HGFEDCBAA

C

D E

B

F GH

Bayesian Network Probability Function

.3fff...

.1ftt

.9ttt

Pr(D|BC)DCB

...

.6ft

.4tt

Pr(H|B)HB

Page 96: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

3

A. Darwiche

Bayesian NetworksBayesian Networks

.020ffffffff

.........

.........

.001fttttttt

.004tttttttt

Pr(.)HGFEDCBAA

C

D E

B

F GH

Bayesian Network Probability Function

.3fff...

.1ftt

.9ttt

Pr(D|BC)DCB

...

.6ft

.4tt

Pr(H|B)HB

A. Darwiche

Bayesian NetworksBayesian Networks

.020ffffffff

.........

.........

.001fttttttt

.004tttttttt

Pr(.)HGFEDCBAA

C

D E

B

F GH

Bayesian Network Probability Function

.3fff...

.1ftt

.9ttt

Pr(D|BC)DCB

...

.6ft

.4tt

Pr(H|B)HB

Page 97: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

4

A. Darwiche

Probabilistic InferenceProbabilistic Inference

.020ffffffff

.........

.........

.001fttttttt

.004tttttttt

Pr(.)HGFEDCBAA

C

D E

B

F GH

Bayesian Network

Pr(A=t or H=f)

MPE: row r with max Pr(r)

MAP: partial instantiation i with max Pr(i)

Probability Function

A. Darwiche

Propositional Knowledge BasesPropositional Knowledge Bases

F

F

T

OK_YOK_Y

1FFFF

……………

……………

……...……

0TTTT

0TTTT

F(…)F(…)OK_XOK_XCCBBAAA & ok_X => ¬B

¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

Boolean FunctionPropositional KB

1FFF....0FFT1TTTF(.)CBOK_Y

Page 98: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

5

A. Darwiche

Propositional Knowledge BasesPropositional Knowledge Bases

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

Boolean FunctionPropositional KB

Is there a satisfying assignment?

How many satisfying assignments

Are two KBs equivalent?

F

F

T

OK_YOK_Y

0FFFF

……………

……………

……...……

0TTTT

1TTTT

F(…)F(…)OK_XOK_XCCBBAA

A. Darwiche

Example: map coloringVariables - countries (A,B,C,etc.)Values - colors (e.g., red, green, yellow)Constraints: etc. ,ED D, AB,A ≠≠≠

Constraint SatisfactionConstraint Satisfaction

0yellow………

1…………

1…………

0…...……

0greenredredred

0redredredred

F()F()……CCBBAA

C

A

B

DE

FG

………

………

1greenred

0redred

F(AB)BA

Page 99: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

6

A. Darwiche

Example: map coloringVariables - countries (A,B,C,etc.)Values - colors (e.g., red, green, yellow)Constraints: etc. ,ED D, AB,A ≠≠≠

Are the constraints consistent?

Find a solution, find all solutions

Count all solutions

Constraint SatisfactionConstraint Satisfaction

0yellow………

1…………

1…………

0…...……

1greenredredred

0redredredred

F()F()……CCBBAA

A. Darwiche

Inference by Variable Inference by Variable EliminationElimination

Page 100: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

7

A. Darwiche

Basic PrincipleBasic Principle

Reduce: A query about a function f = f1 f2 … fm

over n variables into a query about a function f’ over n-1 variables.

Eliminate a variable X from f, while keeping the result, f’, as factored as possible

A. Darwiche

Basic PrincipleBasic PrincipleIf variable X appears in only one factor f1 of f, all we have to do is replace f1 with elm(f1,X):

f’ = elm(f1,X) f2 …fm

If variable X appears in more than one factor, say, f1 and f2 , we must combine (multiply) them first before eliminating X:

f’ = elm(f1 f2,X) f3 …fm

Notes: The more factors we have to combine, the less factored the result is.The order in which we eliminate variables matters only computationally.

Page 101: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

8

A. Darwiche

Elimination in ProbabilityElimination in Probability

.5FF

.2TF

.2FT

.1TTF(AB)BA

.7F

.3T

F(A)AEliminate B

Project on A

A. Darwiche

.5FF

.2TF

.2FT

.1TTF(AB)BA

.7F

.3T

F(A)AEliminate B

Project on A

Elimination in ProbabilityElimination in Probability

Page 102: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

9

A. Darwiche

.5FF

.2TF

.2FT

.1TTF(AB)BA

.7F

.3T

F(A)AEliminate B

Project on A

Elimination in ProbabilityElimination in Probability

∑=B

ABFAF )()(

A. Darwiche

.5FF

.2TF

.2FT

.1TTF(AB)BA

.7F

.3T

F(A)AEliminate B

Project on A

Elimination in ProbabilityElimination in Probability

Different notions of elimination: sum out, max outEach preserves ability to answer a different type of querySum out: compute probabilities Max out: compute MPE Sum then Max: compute MAP

Page 103: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

10

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

.8FF

.2TF

.1FT

.9TTf2(AB)BA

A B C

.5FF

.5TF

.7FT

.3TTf3(BC)CB

.4F

.6Tf 1(A)A

Multiply factorsTo eliminate A

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

.32FF

.08TF

.06FT

.54TTf4(AB)BA

A B C

.5FF

.5TF

.7FT

.3TTf3(BC)CB

To eliminate AEliminate A

Page 104: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

11

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

A B C

.5FF

.5TF

.7FT

.3TTf3(BC)CB

Multiply factorsTo eliminate B

.38F

.62Tf5(B)B

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

A B C

.190FF

.190TF

.434FT

.186TTf6(BC)CB

Page 105: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

12

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

A B C

.190FF

.190TF

.434FT

.186TTf6(BC)CB

Eliminate B

A. Darwiche

Variable Elimination ExampleVariable Elimination Example

A B C

.624F

.376Tf7(C)C

Page 106: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

13

A. Darwiche

Elimination in LogicElimination in Logic

1FFF1TFF0FTF1TTF0FFT0TFT0FTT1TTTF(ABC)CBA

A => B, B => C

1FF1TF0FT1TTF(AC)CA

Eliminate B

A => C

Project on A C

A. Darwiche

Elimination in LogicElimination in Logic

1FFF1TFF0FTF1TTF0FFT0TFT0FTT1TTTF(ABC)CBA

A => B, B => C

1FF1TF0FT1TTF(AC)CA

Eliminate B

A => C

Project on A C

Page 107: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

14

A. Darwiche

Elimination in LogicElimination in Logic

1FFF1TFF0FTF1TTF0FFT0TFT0FTT1TTTF(ABC)CBA

A => B, B => C

1FF1TF0FT1TTF(AC)CA

Eliminate B

A => C

Project on A C

A. Darwiche

Elimination in LogicElimination in Logic

A => B, B => C

Eliminate B

A => C

Project on A C

~A or B~B or C

Resolve on B~A or B~B or C~A or C

Throw out B clauses

~A or C

∆∃ .B∆

Page 108: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

15

A. Darwiche

Elimination in LogicElimination in Logic

• Different notions of elimination:– Existential elimination (quantification)– Universal elimination (quantification)

• Preserve ability to answer different queries– E.g. Existential preserves SAT

• Different types of eliminations can be mixedto solve more sophisticated problems: diagnosis and planning

A. Darwiche

Interaction GraphsInteraction Graphs

• Can simulate variable elimination on connectivity graph:– Node for every variable– Edge between two nodes iff appear in same factor

f(ABCDEF) = f1(AB) f2(BCD) f3(CF) f4(EF)

B

D

A

C

F

E

Page 109: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

16

A. Darwiche

Interaction Graph: ExampleInteraction Graph: Example

A B C

OK_X OK_Y

Interaction Graph

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

Also known as primal graph in constraint satisfactionOther types of graphs can be defined: dual & hyper

A. Darwiche

Interaction GraphsInteraction Graphs• Eliminate F:

f(ABCDEF) = f1(AB) f2(BCD) f3(CF) f4(EF)

f’(ABCDE) = f1(AB) f2(BCD) f34(CE)

B

D

A

C

F

E B

D

A

C E

Interaction graph for f Interaction graph for f’

Connect neighbors of FRemove node F

Page 110: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

17

A. Darwiche

Interaction GraphsInteraction Graphs• Eliminate C:

f’(ABCDEF) = f1(AB) f2(BCD) f34(CE)

f’’(ABCDEF) = f1(AB) f234(BDE)

B

D

A

C E

Interaction graph for f’

Connect neighbors of CRemove node C

B

D

A

E

Interaction graph for f’’

A. Darwiche

Induced Width / Induced Width / TreewidthTreewidth• The factor constructed upon eliminating variable X will

be over X’s neighbors in interaction graph.

• If w is largest number of neighbors encountered when eliminating variables according to order O, then w is called the induced width of elimination order O.

• The complexity of variable elimination is O(n exp(w)), where n is number of variables

• The induced width of a graph is width of its best elimination order

• This is also known as treewidth in graph theoretic literature

Page 111: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

18

A. Darwiche

TreewidthTreewidth

Higher treewidth

A. Darwiche

Bucket EliminationBucket EliminationA mechanism for managing variable elimination

f3(CF)CD

f4(EF)EF

f2(BCD)BA

FactorsVar

f(ABCDEF) = f1(AB) f2(BCD) f3(CF) f4(EF)

CDEF

BA

FactorsVarElm A

f5(B)f1(AB)f2(BCD)f3(CF)

f4(EF)

Page 112: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

19

A. Darwiche

Bucket EliminationBucket EliminationA mechanism for managing variable elimination

f3(CF)CD

f4(EF)EF

f2(BCD) f5(B)BA

FactorsVar

f(ABCDEF) = f1(AB) f2(BCD) f3(CF) f4(EF)

f3(CF)CD

f4(EF)EF

BA

FactorsVar

Elm Bf6(CD)

A. Darwiche

Another View of Another View of TreewidthTreewidth

ABC

BCD

CE

EF EG

BH

Tree decomposition

A

B C

DH

E

F G

Interaction graph

Page 113: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

20

A. Darwiche

Tree DecompositionTree Decomposition

ABC

BCD

CE

EF EG

BH

Tree decomposition

• A tree of clusters

• Every pair of variables connected byan edge in interaction graph must appear together in some cluster

• If a variable appears in two clusters,it must appear in all clusters on thepath between them

A. Darwiche

Tree DecompositionTree Decomposition

ABC

BCD

CE

EF EG

BH

Tree decomposition

• A tree of clusters

• The variables of every factor must appear in some cluster

• If a variable appears in two clusters,it must appear in all clusters on thepath between them

Page 114: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

21

A. Darwiche

Tree DecompositionTree Decomposition

ABC

BCD

CE

EF EG

BH

Tree decomposition• Width of tree decomposition is sizeof its largest cluster - 1

• Width of best tree decomposition istreewidth of connectivity graph

• Treewidth quantifies the resemblance of a graph to a tree structure

• Tree decompositions correspond tojointrees (junction trees)

A. Darwiche

Inference by FactorInference by FactorEliminationElimination

(Jointree algorithm)(Tree clustering algorithm)

Page 115: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

22

A. Darwiche

Basic PrincipleBasic PrincipleReduce: A query about a function

f = f1 f2 … fminto a query about a function f’ over m-1 factors.

Eliminate factor fi while keeping result, f’, as factored as possible

Allows n queries to be answered in O(n exp(w)) time instead of O(n2 exp(w)) [Standard VE]

A. Darwiche

Basic PrinciplesBasic Principles

• To eliminate a factor f1 :– Eliminate all variables appearing in f1 but not

in other factors f2….fm

– Multiply resulting factor into one of f2…fm

• To control elimination:– Choose a factor to eliminate– Decide on which factor to multiply into

• Factor elimination is controlled by an elimination tree (instead of elimination order)

Page 116: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

23

A. Darwiche

Elimination TreesElimination Trees• Spanning tree of factors• Any spanning tree will do, some lead to

more work than others

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

∑ ECEf )(

Eliminate factor f5

Factor EliminationFactor Elimination

Page 117: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

24

A. Darwiche

2

1

4

3

f(AB)

f(A)

f(BCD)

f(AC)

Factor EliminationFactor Elimination

Eliminate factor f2

)( ABf

A. Darwiche

1

4

3

f(AB)

f(BCD)

f(AC)

Factor EliminationFactor Elimination

)(f

Eliminate factor f1

)(ABf

Page 118: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

25

A. Darwiche

4

3

f(ABCD)

f(AC)

Factor EliminationFactor Elimination

)(f

Eliminate factor f4

∑BD

ABCDf )(

A. Darwiche

3f(AC)

Factor EliminationFactor Elimination

∑∑

=

=

BDE

BDE

CEfBCFfACfAfABf

ABCDEfACf

)()()()()(

)()(

Resulting factor represents projection of original factors on variables AC

Page 119: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

26

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

SeparatorsSeparators

CEABCD

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

SeparatorsSeparators

C

Page 120: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

27

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

SeparatorsSeparators

ACE

ABCD

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

SeparatorsSeparators

AC

Page 121: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

28

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

SeparatorsSeparators

AB

AB

ACC

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

Messages over SeparatorsMessages over Separators

∑=E

CEfCm )()()(ABm

)(ABm

)(ACm

Page 122: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

29

A. Darwiche

2

1

4

3

5f(AB)

f(A)

f(BCD)

f(AC)

f(CE)

ClustersClusters

AB

AB

ACC

Cluster of node: variables of its factor union neighboring separators

A. Darwiche

AB

AB

ABCD

AC

CEf(AB)

f(A)

f(BCD)

f(AC)

f(CE)

ClustersClusters

AB

AB

ACC

Cluster of node: variables of its factor union neighboring separatorsWidth of elm tree: size of largest cluster -1

Page 123: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

30

A. Darwiche

ComplexityComplexity

Project on AC

AB

AB

ABCD

AC

CEf(AB)

f(A)

f(BCD)

f(AC)

f(CE)

AB

AB

ABCD

AC

CEf(AB)

f(A)

f(BCD)

f(AC)

f(CE)

Project on CE

AB

AB

ABCD

AC

CEf(AB)

f(A)

f(BCD)

f(AC)

f(CE)

Project on ABCD

-To project on variables of a cluster, choose cluster as root-Number of messages passed is twice number of edges-Sending a message from a cluster is exponential in size of cluster-With appropriate elim tree, all messages passed in O(n exp(w))

A. Darwiche

Tree Decomposition Elm TreeTree Decomposition Elm Tree

Every tree decomposition of width w embeds

an elimination tree of width w

Page 124: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

31

A. Darwiche

Tree Decomposition Elm TreeTree Decomposition Elm Tree

A

B

C

D

E F

f(ABE) f(ACD) f(DEF)Interaction graph

ABE

DEF

ADE

ACD

Tree decomposition

f(ACD)f(ABE)

f(DEF)

Elimination tree

A. Darwiche

Elm Tree Elm Tree TreeTree DecompositionDecomposition

Every elimination tree of width w induces

a tree decomposition of width w

Page 125: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

32

A. Darwiche

A

B

C

D

E F

f(ABE) f(ACD) f(DEF)Interaction graph

f(ACD)f(ABE)

f(DEF)

Elimination tree

AE AD

DE

ACDABE

DEF

Tree decomposition

ADE

Elm Tree Elm Tree TreeTree DecompositionDecomposition

A. Darwiche

Inference by RecursiveInference by RecursiveConditioningConditioning

Page 126: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

33

A. Darwiche

Basic PrincipleBasic PrincipleReduce: A query about a function

f = f1 f2 … fminto queries about a decomposition

fL = f1…fi fR = fi+1…. fm

Must condition on variables shared by fL and fR

Allows inference in O(n exp(w)) time Facilitates time-space tradeoffs

A. Darwiche

DecompositionDecomposition

Battery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Page 127: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

34

A. Darwiche

DecompositionDecomposition

Battery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

A. Darwiche

DecompositionDecomposition

Battery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Page 128: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

35

A. Darwiche

DecompositionDecompositionBattery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

LP RP*

A. Darwiche

DecompositionDecompositionBattery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

LP RP*

Page 129: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

36

A. Darwiche

Causal NetworkCausal Network

Battery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

A. Darwiche

Causal NetworkCausal Network

Battery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Page 130: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

37

A. Darwiche

Case AnalysisCase AnalysisBattery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Case I

Battery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Case II

A. Darwiche

Case AnalysisCase AnalysisBattery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Battery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Case I Case II

LP * RP

Page 131: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

38

A. Darwiche

Case AnalysisCase AnalysisBattery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Battery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Case I Case II

LP * RP LP * RP+

A. Darwiche

Case AnalysisCase AnalysisBattery Age Alternator Fan Belt

BatteryCharge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

LP * RP LP * RP+

Page 132: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

39

A. Darwiche

Battery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

Battery Age Alternator Fan Belt

Battery

Charge Delivered

Battery Power

Starter

Radio Lights Engine Turn Over

Gas Gauge

Gas

Leak

Fuel Line

Distributor

Spark Plugs

Engine Start

• Decomposition and Case Analysis can answer any query

• Non-Deterministic!

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B

f(A) f(AB) f(BC)

f(CD) f(BDE)

Page 133: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

40

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B C

C DD E

B

Page 134: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

41

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B

Page 135: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

42

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B C

C DD E

BLP RP

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B LP * RP

Page 136: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

43

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B LP * RP

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B C

C DD E

B LP * RP

LP RP

Page 137: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

44

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

B LP * RP LP * RP

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E

A A B B C

C DDB

E

LP * RP + LP * RP

Page 138: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

45

A. Darwiche

Computational ComplexityComputational Complexity

A B C D E

A A B B C

C DDB

E

A

B

C

D

B

BC

BCDAncestoral Cutset

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E F

A

A B

B C

C D

D E E F

AB

CA B C

Page 139: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

46

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E F

A

A B

B C

C D

D E E F

AB

C CC

.27

.39

ABCABCABCABCABCABCABCABC

A B C

Context(N)= A-Cutset(N)&Vars(N)

A. Darwiche

Decomposition TreeDecomposition Tree

A B C D E F

A

A B

B C

C D

D E E F

AB

CD

E

AB

CD

Page 140: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

47

A. Darwiche

Computational ComplexityComputational Complexity• Given

– DAG with n nodes– elimination order of width w

• Can construct a dtree, such that– time complexity: O(n exp(w logn))

space complexity O(n) [no caching]• Can construct a dtree, such that

– time complexity: O(n exp(w))space complexity: O(n exp(w)) [ full caching]

A. Darwiche

3.3 MB = 28 Sec7.6 MB = 12 Sec

Page 141: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

48

A. Darwiche

Recursive Conditioning in Logic/CSPRecursive Conditioning in Logic/CSP

SAT

X=t X=f

SAT SATor

X=t X=t X=f X=f

A. Darwiche

Graphical ModelsGraphical Models

Elimination Order Jointree/Elm trees

Dtree

W Width preserving transformations

Variable Elimination Factor Elimination

Recursive Conditioning

Page 142: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

49

A. Darwiche

Elimination Orders to Elimination Orders to dtreesdtreesA

DB

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

Cutset <= w+1

A. Darwiche

A

DB

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

Elimination Orders to Elimination Orders to dtreesdtrees

Page 143: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

50

A. Darwiche

A

D

B

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

Elimination Orders to Elimination Orders to dtreesdtrees

A. Darwiche

A

D

B

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

Elimination Orders to Elimination Orders to dtreesdtrees

Page 144: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

51

A. Darwiche

A

DB

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

DBC

AB ABC

Context <= w+1

Elimination Orders to Elimination Orders to dtreesdtrees

A. Darwiche

A

DB

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBC

A

W=2

DBC

AB ABC

DtreesDtrees to to JointreeJointree

Page 145: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

52

A. Darwiche

A

DB

E

C

F

F E A B C D

A AB AC ABE BCD DF

DBCD

ABC

W=2

AB ABC

Cluster<= w+1

DtreesDtrees to to JointreesJointrees

A. Darwiche

Hypergraph PartitioningHypergraph Partitioning

The problem of hypergraphpartitioning is well-studied

in VLSI design.….and is alive!

A hypergraph is a generalization of a graph, such that an edge is permitted to connect an arbitrary number of vertices, rather than exactly two.

The task of hypergraph partitioning is to find a way to split the vertices of a hypergraph into k approximately equal parts, such that the number of hyperedges connecting vertices in different parts is minimized.

Page 146: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

53

A. Darwiche

HypergraphHypergraph Partitioning => dtreesPartitioning => dtrees

A AB

CDBC

A AB CDBC

A AB CDBC

For DAG:

A. Darwiche

A

CB

ED

F

HG

DFDF

AC ACE

EFH A AF

AB ABD

DFG

CCEE

HH

AAGG

BB

dtreesdtrees to Elimination Ordersto Elimination OrdersC H E B A G DFG C H E B A DF

Page 147: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

54

A. Darwiche

Graphical ModelsGraphical Models

Elimination Order Jointree/Elm trees

Dtree

W Width preserving transformations

Variable Elimination Factor Elimination

Recursive Conditioning

A. Darwiche

SummarySummary• Inference by variable elimination:

Elimination orders• Inference by factor elimination:

Elimination trees / tree decompositions / cluster trees / jointrees

• Inference by recursive conditioning:Decomposition trees (dtrees)

• Treewidth guarantees shared between all methods

Page 148: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

55

A. Darwiche

Knowledge CompilationKnowledge Compilation

A. Darwiche

Knowledge CompilationKnowledge Compilation

• Representational factorization: Compactrepresentation/specification of a function (Bayesian network, CNF, CSP, …)

• Computational factorization: A representationof a function on which (some) inference can be performed in polytime

• Knowledge Compilation: Convert a representational factorization into a (smallest) computational factorization

Page 149: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

56

A. Darwiche

KC in Logic: Boolean CircuitsKC in Logic: Boolean Circuits((NNFsNNFs / AND/ AND--OR Graphs)OR Graphs)

Succinctness

Polytime OperationsConsistency (CO)Validity (VA)Clausal entailment (CE)Sentential entailment (SE)Implicant testing (IP)Equivalence testing (EQ)Model Counting (CT)Model enumeration (ME)

Projection (existential quantification)ConditioningConjoin, Disjoin, Negate

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or DecomposabilityDeterminismSmoothness

FlatnessDecisionOrdering

Negation Normal Form

A. Darwiche

Example from DiagnosisExample from Diagnosis

X YA CB

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

KB =

Is A, ¬C a normal device behavior?

Page 150: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

57

A. Darwiche

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

Is A, ¬C a normal device behavior?

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

A, ¬C, ok_X, ok_Y

Satisfiability Algorithm

Example from DiagnosisExample from Diagnosis

A. Darwiche

FFFFF

……………

……………

……...……

FTTTT

TTTTT

OK_YOK_YOK_XOK_XCCBBAAA & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

A, ¬C, ok_X, ok_Y

Satisfiability Algorithm

Is there a satisfying assignment?

Example from DiagnosisExample from Diagnosis

Page 151: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

58

A. Darwiche

FFFFF

……………

……………

……...……

FTTTT

TTTTT

OK_YOK_YOK_XOK_XCCBBAAA & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

A, ¬C, ok_X, ok_Y

Counting Algorithm

How many satisfying assignments?

Example from DiagnosisExample from Diagnosis

A. Darwiche

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

CompiledStructureCompiler

Knowledge CompilationKnowledge Compilation

EvaluatorQueries

Page 152: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

59

A. Darwiche

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C ?Compiler

Knowledge CompilationKnowledge Compilation

EvaluatorQueries

A. Darwiche

A & ok_X => ¬B¬A & ok_X => B

B & ok_Y => ¬C¬B & ok_Y => C

.....Prime Implicates

OBDD…

Compiler

Knowledge CompilationKnowledge Compilation

EvaluatorQueries

Page 153: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

60

A. Darwiche

Knowledge CompilationKnowledge Compilation

Succinctness

Polytime OperationsConsistency (CO)Validity (VA)Clausal entailment (CE)Sentential entailment (SE)Implicant testing (IP)Equivalence testing (EQ)Model Counting (CT)Model enumeration (ME)

Projection (existential quantification)ConditioningConjoin, Disjoin, Negate

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or DecomposabilityDeterminismSmoothness

FlatnessDecisionOrdering

Negation Normal Form

A. Darwiche

• Diagnosis– Is this a normal behavior?– What are the possible faults?

• Planning– Can this goal be achieved?– Generate a set of plans

• Probabilistic reasoning– What is the probability of X given Y

• Non-monotonic reasoning (penalty logics)– Does X follow preferentially from Y

• Formal verification / CAD:– Is it possible that the design will exhibit behavior X?– Are two designs equivalent?

ApplicationsApplications

Page 154: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

61

A. Darwiche

Negation Normal Form (NNF)Negation Normal Form (NNF)

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or

rooted DAG

A. Darwiche

Negation Normal FormNegation Normal Form

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or DecomposabilityDeterminismSmoothness

FlatnessDecision

Ordering

Page 155: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

62

A. Darwiche

¬XX ¬YY ¬ZZ

and

or

and andand

FlatnessFlatness

Nested vs Flat languages

(X∧Y ∧Z)∨(Z∧¬X∧¬Y) ∨(Y∧Z∧¬X) ∨(¬X∧¬Y ∧¬Z)

A. Darwiche

DecomposabilityDecomposability

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or

A,B C,D

Page 156: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

63

A. Darwiche

DeterminismDeterminism

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or

A. Darwiche

SmoothnessSmoothness

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or

A,BA,B

Page 157: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

64

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

A. Darwiche

¬A B ¬ B A C ¬ D D ¬ C

and and and and and and and and

or or or or

and and

or

Given A, ¬ B

0 0 1 1 1 1 1 1

0 0 0 1 1 1 1 1

1 2 0 1

2 02

CountingCounting

Page 158: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

65

A. Darwiche

¬XX ¬YY ¬ZZ

and

or

and andand

Simple ConjunctionSimple Conjunction

Implies decomposability

A. Darwiche

¬XX Y Z

or

and

oror

Simple DisjunctionSimple Disjunction

Page 159: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

66

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

IP PICO, CE, ME, VA, IP, SE, EQVA, IP, SE, EQ

Page 160: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

67

A. Darwiche

or

and and

X1 ¬ X1or or

and and andand

X2 X2¬ X2 ¬ X2

and and andand

X3 X3¬ X3 ¬ X3

or or

true false

DecisionDecision

A. Darwiche

or

and and

X1 ¬ X1or or

and and andand

X2 X2¬ X2 ¬ X2

and and andand

X3 X3¬ X3 ¬ X3

or or

true false

DecisionDecision

Decision implies determinism

Page 161: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

68

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

IP PICO, CE, ME, VA, IP, SE, EQVA, IP, SE, EQ

BDD

A. Darwiche

X ¬Xα β

and

or

and

α β

X

Decision NodesDecision Nodes

Page 162: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

69

A. Darwiche(X2 ∧ X3) ∨ (X1 ∧ ¬X2 ∧ ¬ X3)

X1

X2 X2

X3X3

1 0

Binary Decision DiagramBinary Decision Diagramor

and andX1 ¬ X1

or or

and and andand

X2 X2¬ X2 ¬ X2

and and andandX3 X3¬ X3 ¬ X3

or or

true false

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

IP PICO, CE, ME, VA, IP, SE, EQVA, IP, SE, EQ

BDD

FBDD EQ?

Page 163: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

70

A. Darwiche

X1

X2 X2

X3X3

1 0

Free Binary Decision DiagramFree Binary Decision Diagram

Test-once property

A. Darwiche

or

and and

X1 ¬ X1or or

and and andand

X2 X2¬ X2 ¬ X2

and and andand

X3 X3¬ X3 ¬ X3

or or

true false

In the context of decision: Test-once = decomposability

Page 164: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

71

A. Darwiche

or

and and

X1 ¬ X1or or

and and andand

X2 X2¬ X2 ¬ X2

and and andand

X3 X3¬ X3 ¬ X3

or or

true false

OrderingOrdering

A. Darwiche

or

and and

X1 ¬ X1or or

and and andand

X2 X2¬ X2 ¬ X2

and and andand

X3 X3¬ X3 ¬ X3

or or

true false

OrderingOrdering

Page 165: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

72

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

IP PICO, CE, ME, VA, IP, SE, EQVA, IP, SE, EQ

BDD

FBDD EQ?

OBDDSE, EQ

A. Darwiche

NNF

d-NNF s-NNF f-NNF

NNF SubsetsNNF Subsets

sd-DNNF

DNNFCO, CE, ME

d-DNNFVA, IP, CT

EQ?

CNFDNF

IP PICO, CE, ME, VA, IP, SE, EQVA, IP, SE, EQ

BDD

FBDD EQ?

OBDDSE, EQ

MODSSE, EQ

Page 166: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

73

A. Darwiche

Language SuccinctnessLanguage Succinctness

Size nSize p(n)

L1 <= L2L1 <= L2L1 at least as succinct as L2

L1 < L2L1 < L2L1 is more succinct than L2

A. Darwiche

NNF

DNNFCNF

d-DNNFDNF

PIFBDD

OBDDIP

MODS

sd-DNNF

PI <= DNNFDNNF <=? PI

DNF <= OBDDOBDD <= DNF

=*

Page 167: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

74

A. Darwiche

OBDD

FBDD

d-DNNF

DNNF

Space Efficiency

Tractable OperationsNNF

decomposability

determinism

decision

ordering

Tractability Tractability vsvs SuccinctnessSuccinctness

Diagnosis,Non-mon

Probabilisticreasoning

A. Darwiche

Propositional TransformationsPropositional Transformations

• Project (Forget)• Condition• Conjoin• Disjoin• Negate

Page 168: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

75

A. Darwiche

ProjectionProjection

A & ok(X) => ¬B¬A & ok(X) => B

X YA CB

A & ok(X) => ¬B¬A & ok(X) => B

B & ok(Y) => ¬C¬B & ok(Y) => C

KB =

A. Darwiche

ProjectionProjectionor

and and

or or or or

A C¬A ¬C

¬okX ¬okY

B ¬B

X YA CB

Page 169: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

76

A. Darwiche

ProjectionProjectionor

and and

or or or or

A¬A true

¬okX

B ¬B

true

true

X YA CB A & ok(X) => ¬B¬A & ok(X) => B

A. Darwiche

NNF

DNNFCNF

d-DNNFDNF

PIFBDD

OBDDIP

MODS

sd-DNNF

PolytimePolytime TransformationsTransformations

FO

FO

FO

FO

=

Page 170: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

77

A. Darwiche

NNF

DNNFCNF

d-DNNFDNF

PIFBDD

OBDDIP

MODS

sd-DNNF

PolytimePolytime TransformationsTransformations

SFO

FO

FO

FO

FO

SFO

SFO

A. Darwiche

PolytimePolytime TransformationsTransformations• Closure under conjunction: none!

Bounded conjunction: OBDD, DNF, IP, MODs

• Closure under disjunction: DNF, DNNFBounded disjunction: OBBD, PI

• Closure under negation: FBDD, OBDD

• Conditioning: all!• Forgetting multiple variables: DNNF, DNF, PI, MODS

• Forgetting single variable: OBDD

Page 171: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

78

A. Darwiche

A Knowledge Compiler:A Knowledge Compiler:DPLL with a TraceDPLL with a Trace

SAT

X=t X=f

SAT SATor

DPLL with fixed order and caching OBDD compilerDPLL with caching FBDD compiler

or

comp( ∆ |X)

and

X comp( ∆ |~X)

and

~X

A. Darwiche

A Knowledge Compiler:A Knowledge Compiler:DPLL with a TraceDPLL with a Trace

SAT

X=t X=f

SAT SATor

DPLL with fixed order and caching OBDD compilerDPLL with caching FBDD compiler

Page 172: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

79

A. Darwiche

X=f X=f

A Knowledge Compiler:A Knowledge Compiler:DPLL with a TraceDPLL with a Trace

SAT

SAT SATor

DPLL with fixed order and caching OBDD compilerDPLL with caching FBDD compilerDPLL with caching and decomposition d-DNNF compiler*

X=t X=t

? DNNF compiler

com( ∆ l

|X) com( ∆ r

|X)

and

or

X

com( ∆ l

|~X) com( ∆ r

|~X)

and

~X

A. Darwiche

Knowledge Compilation in Probability:Knowledge Compilation in Probability:Arithmetic CircuitsArithmetic Circuits

**

* *

λ~b λ~aλbλa

+

+ +* * * *

θa θab θa~b θ~ab θ~a~b θ~a

ADD (Algebraic Decision Diagrams) *BMD (Binary Moment Diagrams) PDGs (Probabilistic Decision Graphs)…

Page 173: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

80

A. Darwiche

ConclusionConclusion• Knowledge compilation converts a

representational factorization into acomputational factorization:– Target language (succinctness, tractability)

• Knowledge compilers can be constructed bykeeping the trace of various search algorithms

• Another view of knowledge compilation isbased on deductive closure

A. Darwiche

Knowledge Compilation as Knowledge Compilation as Deductive Closure: Two ExamplesDeductive Closure: Two Examples

1. Eliminate all variables X1,…, Xn , whilekeeping all intermediate CNFs

– The intermediate CNFs represent projectionsof initial CNF on subsets X2,…, Xn, X3,…, Xn, Xn-1Xn , Xn

– The result can be used to answer some hard queries in polytime

2. Add enough clauses to make CNF completeunder unit resolution

Page 174: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

81

A. Darwiche

ReferencesReferences

• Dechter. Bucket elimination: A unifying framework for probabilistic inference. In UAI, pages 211-219, 1996.

• Zhang and Poole. Exploiting causal independence in bayesian network inference. JAIR, 5:301-328, 1996.

• Lauritzen and Spiegelhalter. Local computations with probabilities on graphical structures and their application to expert systems. Journal of Royal Statistics Society, Series B, 50(2):157-224, 1988.

• Jensen, Lauritzen, and Olesen. Bayesian updating in recursive graphical models by local computation. Computational Statistics Quarterly, 4:269-282, 1990.

• Huang and Darwiche. Inference in Belief Networks: A procedural guide.International Journal of Approximate Reasoning, 15(3): 225-263, 1996.

• Darwiche. Recursive Conditioning. Artificial Intelligence, 126(1-2):5-41, 2001.• Darwiche and Marquis. A knowledge compilation map. JAIR, 17, 229-264, 2002.

Page 175: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

1

August 2005 Ijcai-05 - Principles 1

Road Map:

Search in Variable-Based Models

� Variable-based (Graphical) models� Basic search and basic Inference � Constraint propagation: bounded inference� Improving search by branching ahead

� Improving search by looking-back� The alternative AND/OR search space� Hybrid search and inference

August 2005 Ijcai-05 - Principles 2

Solution TechniquesSolution TechniquesSolution TechniquesSolution Techniques

Search: Conditioning

Inference: Elimination

Complete

Incomplete

Simulated Annealing

Gradient Descent

Complete

Incomplete

Adaptive Consistency

Tree ClusteringDynamic Programming

Resolution

Local Consistency

Unit Resolutionmini-bucket(i)

Time: exp(w*)Space:exp(w*)

Time: exp(n)Space: linear

Hybrids:

Page 176: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

2

August 2005 Ijcai-05 - Principles 3

Solution TechniquesSolution TechniquesSolution TechniquesSolution Techniques

Search: Conditioning

Inference: EliminationAND/OR Graph search

Complete

Incomplete

Simulated Annealing

Gradient Descent

Complete

Incomplete

Adaptive Consistency

Tree ClusteringDynamic Programming

Resolution

Local Consistency

Unit Resolutionmini-bucket(i)

Time: exp(w*)Space:exp(w*)

AND/OR tree searchTime: exp(w* log n)Space: linear

Hybrids:

Time: exp(w*)Space:exp(w*)

August 2005 Ijcai-05 - Principles 4

Solution TechniquesSolution TechniquesSolution TechniquesSolution Techniques

Search: Conditioning

Inference: EliminationAND/OR Graph search

Complete

Incomplete

Simulated Annealing

Gradient Descent

Complete

Incomplete

Adaptive Consistency

Tree ClusteringDynamic Programming

Resolution

Local Consistency

Unit Resolutionmini-bucket(i)

Time: exp(w*)Space:exp(w*)

AND/OR tree searchTime: exp(w* log n)Space: linear

Hybrids:AND-OR(i)

Space: exp(i)Time: exp(m_i)

Page 177: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

3

August 2005 Ijcai-05 - Principles 5

Search Basic Step: Variable

Branching by Conditioning

X1

X3

X5X4

X2

August 2005 Ijcai-05 - Principles 6

Search Basic Step: Variable

Branching by conditioning

X1

X3

X5X4

X2•Select a variable

Page 178: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

4

August 2005 Ijcai-05 - Principles 7

Search Basic Step: Variable

Branching by Conditioning

X1

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

…...

…...

X1 ←←←← aX1 ←←←← b

X1 ←←←← c

August 2005 Ijcai-05 - Principles 8

Search Basic Step: Variable

Branching by Conditioning

X1

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

…...

…...

X1 ←←←← aX1 ←←←← b

X1 ←←←← c

General principle:Condition until tractableThen solve sub-problemsefficiently

Page 179: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

5

August 2005 Ijcai-05 - Principles 9

Search Basic Step: Variable

Branching by Conditioning

X1

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

X3

X5X4

X2

…...

…...

X1 ←←←← aX1 ←←←← b

X1 ←←←← c

Example: solve subproblemBy inference, BE(w=2).

August 2005 Ijcai-05 - Principles 10

Eliminate First

Page 180: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

6

August 2005 Ijcai-05 - Principles 11

Eliminate First

August 2005 Ijcai-05 - Principles 12

Eliminate First

Solve the rest of the problemBy any means

Page 181: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

7

August 2005 Ijcai-05 - Principles 13

Two Hybrids

� Condition, condition, condition… and then only eliminate (i-cutset, cycle-cutset)

� Interleave conditioning and elimination(elim-cond(i))

August 2005 Ijcai-05 - Principles 14

The Cycle-Cutset Scheme:

Condition Until Treeness

•Cycle-cutset•i-cutset•C(i)-size of i-cutset

Space: exp(i), Time: O(exp(i+c(i))

Page 182: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

8

August 2005 Ijcai-05 - Principles 15

AND/OR i-cutset

A

C

B K

G L

D F

H

M

J

E

AC

B K

G

L

D

FH

M

J

E

A

C

B K

G L

D F

H

M

J

E

C

B K

G

L

D

FH

M

J

E

3-cutset

A

C

B K

G L

D F

H

M

J

E

C

K

G

L

D

FH

M

J

E

2-cutset

A

C

B K

G L

D F

H

M

J

E

L

D

FH

M

J

E

1-cutset

August 2005 Ijcai-05 - Principles 16

Time-Space Complexity

� Space: O(exp(i))• i-cutset: a set that when removed the induced-

width is i. • c(i): size of i-cutset. • m(i): depth of AO i-cutset

� Time: O(exp(i+c(i))) on OR space� Time: O(exp(i+m(i))) on AND/OR space and

m(i) <= c(i)

Page 183: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

9

August 2005 Ijcai-05 - Principles 17

Time-Space complexity

� Space: O(exp(i))• i-cutset: a set that when removed the induced-

width is i. • c(i): size of i-cutset. • m(i): depth of AO i-cutset

� Time: O(exp(i+c(i))) on OR space� Time: O(exp(i+m(i))) on AND/OR space and

m(i) <= c(i)

,)()(*

**)(*...)(...)2(21)1(

iiciimtw

twwcwicicc

+≤+≤=+≥+≥≥+≥+

August 2005 Ijcai-05 - Principles 18

Interleaving Cond and Elim

Page 184: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

10

August 2005 Ijcai-05 - Principles 19

Interleaving Cond and Elim

August 2005 Ijcai-05 - Principles 20

Interleaving Cond and Elim

Page 185: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

11

August 2005 Ijcai-05 - Principles 21

Interleaving Cond and Elim

August 2005 Ijcai-05 - Principles 22

Interleaving Cond and Elim

Page 186: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

12

August 2005 Ijcai-05 - Principles 23

Interleaving Cond and Elim

August 2005 Ijcai-05 - Principles 24

Interleaving Cond and Elim

...

...

Page 187: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

13

August 2005 Ijcai-05 - Principles 25

Time-space Tradeoffs

� AO(i): dfs searche of AO, caches i-context • i = max number of variables in a context

� AO i-cutset� Elimination-conditioning( i)

i=0 i=w*

Space: O(n)

Time: O(exp(w* log n))

Space: O(exp w*)

Time: O(exp w*)Space: O(exp(i) )

Time: O(exp(m(i)+i )

m(i) - AO depth of w-cutset

i

August 2005 Ijcai-05 - Principles 26

Super-Bucket Elimination, SBE(k)

� Eliminate sets of variables such that:• individual eliminations are too costly in space

(namely, each variable in the set has degreelarger than k)

• the join degree is lower than k

Page 188: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

14

August 2005 Ijcai-05 - Principles 27

SBE(2): example

.

.

.

.

.

.

x1

x2

x3

x4

x5

x6

x7

August 2005 Ijcai-05 - Principles 28

SBE(2): example

.

.

.

.

.

.

x1

x2

x3

x4

x5

x6

x7

dg1=5

dg2=5

dg3=6

dg4=5

dg5=5

Page 189: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

15

August 2005 Ijcai-05 - Principles 29

SBE(2): example

.

.

.

.

.

.

x1

x2

x3

x4

x5

x6

x7

S

August 2005 Ijcai-05 - Principles 30

SBE(2): example

.

.

.

.

.

.

x1

x2

x3

x4

x5

x6

x7

S

Ns

|Ns|=2

Page 190: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

16

August 2005 Ijcai-05 - Principles 31

SBE(2): example

.

.

.

.

.

.

x1

x2

x3

x4

x5

x6

x7

Super bucket: set of functions mentioning variablesin the set S

)(sup

5,4,3,2,1 ∑−∈ bucketerf

felim

August 2005 Ijcai-05 - Principles 32

SBE(2): example

.

.

.

.

.

.

x6

x7

Page 191: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

17

August 2005 Ijcai-05 - Principles 33

Super-buckets and Super-Clusters

Larger super-buckets (cliques) =>more time but less space

Complexity:1. Time: exponential in clique (super-bucket) size2. Space: exponential in separator size

August 2005 Ijcai-05 - Principles 34

SBE(i)

� Complexity:• space : O(exp( i))

• time : O(exp( wi*))

i-augmented induced width

Separator-width

Page 192: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

18

August 2005 Ijcai-05 - Principles 35

Time vs Space for w-cutset

• Random Graphs (50 nodes, 200 edges, average degree 8, w*≈≈≈≈23)

Branch and bound

Bucket elimination

0

10

20

30

40

50

60

-1 2 5 8 11 14 17 20 23 26 29 32

w

W+

c(w

)

August 2005 Ijcai-05 - Principles 36

Time vs Space in SBE

0

10

20

30

40

50

60

-1 2 5 8 11 14 17 20 23 26 29 32

k

k-aug

mente

d in

duc

e w

idth

• Random Graphs (50 nodes, 200 edges, average degree 8, w*≈≈≈≈23)

Branch and bound

Bucket elimination

Page 193: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

19

August 2005 Ijcai-05 - Principles 37

Time-space Tradeoffs

� AO(i): dfs searche of AO, caches i-context • i = max number of variables in a context

� AO i-cutset� Elimination-conditioning( i)

i=0 i=w*

Space: O(n)

Time: O(exp(w* log n))

Space: O(exp w*)

Time: O(exp w*)Space: O(exp(i) )

Time: O(exp(m(i)+i )

m(i) - AO depth of w-cutset

i

August 2005 Ijcai-05 - Principles 38

Time-space Tradeoffs

� AO(i): dfs searche of AO, caches i-context • i = max number of variables in a context

� AO i-cutset� Elimination-conditioning( i)� AO*(i) avoiding dead-end caches = SBE( i)� i controls space

i=0 i=w*

Space: O(n)

Time: O(exp(w* log n))

Space: O(exp w*)

Time: O(exp w*)Space: O(exp(i) )

Time: O(exp(m(i)+i )

m(i) - AO depth of w-cutset

i

Page 194: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

20

August 2005 Ijcai-05 - Principles 39

Hybrids in State Models

� Search = Best-first or Depth-first� Inference = estimating v(n) for each node

through h(n)� Inference = search from goal to start in a

relaxed model� Reinforcement learning = improving heuristic

during search

� Transposition tables = caching goods.

August 2005 Ijcai-05 - Principles 40

Some Connections

Inference, Search and Compilation

� Minimal OR space = OBDD

� Minimal AND/OR space = Tree-OBDD

Page 195: Principles of AI Problem Solving Tutorial IJCAI-05dechter/talks/ijcai-tutorial2005.pdf · Principles of AI Problem Solving Tutorial IJCAI-05 Adnan Darwiche (UCLA, Los Angeles) Rina

21

August 2005 Ijcai-05 - Principles 41

Wrap-Up

� Models: State-models, graphical models• Graphical models are more informed

• Tasks: satisfaction, optimization, counting/belief

� Algorithms: Inference, Search, Hybrids� Inference requires space� Search can trade space for time, naturally� State-of-the art: anytime hybrid methods that

trade space and time

August 2005 Ijcai-05 - Principles 42

Wrap-Up (continue)

� Algorithmic principles:• DFS vs BFS or inference• Constraint propagation, bounded inference,

learning heuristics from relaxed models• Backjumping, AND/OR search space• no-good-caching, good-caching• Good-caching and transposition tables• Reinforcement learning = learning goods

and no-goods during search while searching