Class2: Constraint Networks Rina Dechter dechter1: chapters 2-3, - - PowerPoint PPT Presentation

class2 constraint networks
SMART_READER_LITE
LIVE PREVIEW

Class2: Constraint Networks Rina Dechter dechter1: chapters 2-3, - - PowerPoint PPT Presentation

Algorithms for Reasoning with graphical models Class2: Constraint Networks Rina Dechter dechter1: chapters 2-3, Dechter2: Constraint book: chapters 2 and 4 class2 828X 2019 Text Books class2 828X 2019 Road Map Graphical models


slide-1
SLIDE 1

Algorithms for Reasoning with graphical models

Class2: Constraint Networks

Rina Dechter

class2 828X 2019

dechter1: chapters 2-3, Dechter2: Constraint book: chapters 2 and 4

slide-2
SLIDE 2

Text Books

class2 828X 2019

slide-3
SLIDE 3

Road Map

 Graphical models  Constraint networks model  Inference

 Variable elimination for Constraints

 Variable elimination for CNFs  Variable elimination for Linear Inequalities  Constraint propagation

 Search  Probabilistic Networks

class2 828X 2019

slide-4
SLIDE 4

Road Map

 Graphical models  Constraint networks model  Inference

 Variable elimination for Constraints

 Variable elimination for CNFs  Variable elimination for Linear Inequalities  Constraint propagation

 Search  Probabilistic Networks

class2 828X 2019

slide-5
SLIDE 5

Text Book (not required)

Rina Dechter, Constraint Processing, Morgan Kaufmann

class2 828X 2019

slide-6
SLIDE 6

Sudoku – Approximation: Constraint Propagation

Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints

2 3 4 6

2

  • Variables: empty slots
  • Domains =

{1,2,3,4,5,6,7,8,9}

  • Constraints:
  • 27 all-different
  • Constraint
  • Propagation
  • Inference

class2 828X 2019

slide-7
SLIDE 7

Sudoku

Each row, column and major block must be alldifferent “Well posed” if it has unique solution

class2 828X 2019

Alternative formulations: Variables? Domains? Constraints?

slide-8
SLIDE 8

A B

red green red yellow green red green yellow yellow green yellow red

Example: map coloring

Variables - countries (A,B,C,etc.) Values - colors (red, green, blue) Constraints:

etc. , E D D, A B, A   

C A B D E F G

A

Constraint Networks

A B E G D F C

Constraint graph

class2 828X 2019

slide-9
SLIDE 9

Example: map coloring

Variables - countries (A,B,C,etc.) Values - colors (e.g., red, green, yellow) Constraints:

etc. , E D D, A B, A   

A B C D E… red

green

red

green blue

red

blue

green

green blue

… … … …

green

… … … … red red

blue

red

green

red

Constraint Satisfaction Tasks

Are the constraints consistent? Find a solution, find all solutions Count all solutions Find a good (optimal) solution

class2 828X 2019

slide-10
SLIDE 10

Constraint Network

} ,..., {

1 n

X X X 

 A constraint network is: R=(X,D,C)

X variables

D domain

C constraints

R expresses allowed tuples over scopes

A solution is an assignment to all variables that satisfies all constraints (join of all relations).

Tasks: consistency?, one or all solutions, counting, optimization

} ,... { }, ,..., {

1 1 k i n

v v D D D D  

) , ( } ,... {

1 i i i t

R S C C C C  

class2 828X 2019

slide-11
SLIDE 11

Crossword Puzzle

 Variables: x1, …, x13  Domains: letters  Constraints: words from

{HOSES, LASER, SHEET, SNAIL, STEER, ALSO, EARN, HIKE, IRON, SAME, EAT, LET, RUN, SUN, TEN, YES, BE, IT, NO, US}

class2 828X 2019

Formulation?

slide-12
SLIDE 12

class2 828X 2019

Crossword Puzzle

slide-13
SLIDE 13

The Queen Problem

The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables.

class2 828X 2019

slide-14
SLIDE 14

The Queen Problem

The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables.

class2 828X 2019

slide-15
SLIDE 15

Varieties of Constraints

Unary constraints involve a single variable,

e.g., SA ≠ green

Binary constraints involve pairs of variables,

e.g., SA ≠ WA

Higher-order constraints involve 3 or more variables,

e.g., cryptarithmetic column constraints

class2 828X 2019

slide-16
SLIDE 16

Constraint’s Representations

 Relation: allowed tuples  Algebraic expression:  Propositional formula:  Semantics: by a relation

Y X Y X    , 10

2

c b a

 ) (

3 1 2 2 3 1 Z Y X

class2 828X 2019

slide-17
SLIDE 17

Partial Solutions

Not all partial consistent instantiations are part of a solution: (a) A partial consistent instantiation that is not part of a solution. (b) The placement of the queens corresponding to the solution (2, 4, 1, 3). (c) The placement of the queens corresponding to the solution (3, 1, 4, 2).

class2 828X 2019

slide-18
SLIDE 18

Constraint Graphs:

Primal, dual and hypergraphs

1 2 5 4 3 6 9 12 7 11 8 10 13 5,7,11 8,9,10,11 10,13 12,13 1,2,3,4,5 3,6,9,12 3 12 13 10 11 5 9 (a) (b)

A (primal) constraint graph: a node per variable arcs connect constrained variables. A dual constraint graph: a node per constraint’s scope, an arc connect nodes sharing variables =hypergraph class2 828X 2019

CSP: When defining variables as squares: Primal graph? Dual graph?

slide-19
SLIDE 19

Constraint Graphs (primal)

Queen problem

class2 828X 2019

When variables are words

slide-20
SLIDE 20

Graph Concepts

class2 828X 2019

slide-21
SLIDE 21

Graph Concepts Reviews:

Hyper Graphs and Dual Graphs

21

Primal graphs Dual graph Factor graphs A hypergraph

slide-22
SLIDE 22

Propositional Satisfiability

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

class2 828X 2019

slide-23
SLIDE 23

cost

i j

f f   Given a telecommunication network (where each communication link has various antenas) , assign a frequency to each antenna in such a way that all antennas may operate together without noticeable interference.

Encoding?

Variables: one for each antenna Domains: the set of available frequencies Constraints: the ones referring to the antennas in the same communication link

Example: Radio Link Assignment

class2 828X 2019

slide-24
SLIDE 24

Constraint graphs of 3 instances of the Radio frequency assignment problem in CELAR’s benchmark

class2 828X 2019

slide-25
SLIDE 25

Operations With Relations

 Intersection  Union  Difference  Selection  Projection  Join  Composition

class2 828X 2019

slide-26
SLIDE 26

Join :

Logical AND:

x1 x2

a a b b

x2 x3

a a a b b a

x1 x2 x3 a a a a a b b b a

Local Functions Combination

g f g f 

x1 x2

f a a true a b false b a false b b true

x2 x3

g a a true a b true b a true b b false

x1 x2 x3 h a a a

true

a a b

true

a b a

false

a b b

false

b a a

false

b a b

false

b b a

true

b b b

false

class2 828X 2019

slide-27
SLIDE 27

Global View of the Problem

x1 x2 x3 h a a a

true

a a b

true

a b a

false

a b b

false

b a a

false

b a b

false

b b a

true

b b b

false

x1 x2

a a b b

x2 x3

a a a b b a

x1 x2 x3 a a a a a b b b a

C1 C2 Global View The problem has a solution if the global view is not empty The problem has a solution if there is some true tuple in the global view, the universal relation

Does the problem a solution?

TASK

class2 828X 2019

slide-28
SLIDE 28

Example of Selection, Projection and Join

class2 828X 2019

slide-29
SLIDE 29

Global View of the Problem

x1 x2 x3 h a a a

true

a a b

true

a b a

false

a b b

false

b a a

false

b a b

false

b b a

true

b b b

false

x1 x2

a a b b

x2 x3

a a a b b a

x1 x2 x3 a a a a a b b b a

C1 C2 Global View

What about counting?

x1 x2 x3 h a a a

1

a a b

1

a b a a b b b a a b a b b b a

1

b b b

Number of true tuples Sum over all the tuples true is 1 false is 0 logical AND? TASK

class2 828X 2019

slide-30
SLIDE 30

Examples Numeric constraints

Can we specify numeric constraints as relations?

{1, 2, 3, 4} { 3, 5, 7 } { 3, 4, 9 } { 3, 6, 7 } v2 > v4 V4 V2 v1+v3 < 9 V3 V1 v2 < v3 v1 < v2

class2 828X 2019

slide-31
SLIDE 31

class2 828X 2019

Numeric Constraints

  • Given P = (V, D, C ), where

 

n

V V V , , ,

2 1

  V

 

n V V V

D D D , , ,

2 1

  D

Example I:

  • Define C ?

{1, 2, 3, 4} { 3, 5, 7 } { 3, 4, 9 } { 3, 6, 7 } v2 > v4 V4 V2 v1+v3 < 9 V3 V1 v2 < v3 v1 < v2

 

l

C C C , , ,

2 1

  C

slide-32
SLIDE 32

class2 828X 2019

The minimal network,

An extreme case of re-parameterization

Binary Constraint Networks

slide-33
SLIDE 33

Winter 2016 33

Properties of Binary Constraint Networks

Equivalence and deduction with constraints (composition) A graph  to be colored by two colors, an equivalent representation ’ having a newly inferred constraint between x1 and x3.

slide-34
SLIDE 34

Equivalence, Redundancy, Composition

 Equivalence: Two constraint networks

are equivalent if they have the same set

  • f solutions.

 Composition in relational operation

Winter 2016 34

) (

yz xy xz xz

R R R   

slide-35
SLIDE 35

The N-queens Constraint Network

The network has four variables, all with domains Di = {1, 2, 3, 4}. (a) The labeled chess board. (b) The constraints between variables. Solutions are: (2,4,1,3) (3,1,4,2)

class2 828X 2019

slide-36
SLIDE 36

Winter 2016 36

The 4-queens constraint network

Solutions are: (2,4,1,3) (3,1,4,2) 2 2 The minimal network The minimal domains

slide-37
SLIDE 37

The 4-queen problem

class2 828X 2019

Solutions are: (2,4,1,3) (3,1,4,2)

The constraint graph The minimal constraints The minimal domains

slide-38
SLIDE 38

The 4-queens problem

Solutions are: (2,4,1,3) (3,1,4,2)

class2 828X 2019

slide-39
SLIDE 39

class2 828X 2019

Figure 2.11: The 4-queens constraint network: (a) The constraint graph. (b) The minimal binary constraints. (c) The minimal unary constraints (the domains).

Solutions are: (2,4,1,3) (3,1,4,2)

slide-40
SLIDE 40

The Minimal Network

 The minimal network is perfectly explicit for

binary and unary constraints:

 Every pair of values permitted by the minimal

constraint is in a solution.

class2 828X 2019

slide-41
SLIDE 41

The Projection Networks

 The projection network of a relation is obtained

by projecting it onto each pair of its variables (yielding a binary network).

 Relation = {(1,1,2)(1,2,2)(1,2,1)}

 What is the projection network?

 What is the relationship between a relation and

its projection network?

 {(1,1,2)(1,2,2)(2,1,3)(2,2,2)} are the solutions

  • f its projection network?

Winter 2016 41

slide-42
SLIDE 42

Example: Sudoku

Winter 2016 42

Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints

2 3 4 6

2

Constraint propagation

  • Variables: 81 slots
  • Domains =

{1,2,3,4,5,6,7,8,9}

  • Constraints:
  • 27 not-equal

What is the minimal network? The projection network?

slide-43
SLIDE 43

Algorithms for Reasoning with graphical models

Class3

Rina Dechter

class2 828X 2019