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 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
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
Text Book (not required) Rina Dechter, Constraint Processing , Morgan Kaufmann class2 828X 2019
Sudoku – Approximation: Constraint Propagation • Variables: empty slots • Constraint • Domains = • Propagation {1,2,3,4,5,6,7,8,9} • Constraints: • Inference • 27 all-different 2 3 2 4 6 Each row, column and major block must be alldifferent “Well posed” if it has unique solution: 27 constraints class2 828X 2019
Sudoku Alternative formulations: Variables? Domains? Constraints? Each row, column and major block must be alldifferent “Well posed” if it has unique solution class2 828X 2019
Constraint Networks A Example: map coloring Variables - countries (A,B,C,etc.) Values - colors (red, green, blue) A B, A D, D E , etc. Constraints: Constraint graph A E A B A E red green D red yellow D green red B F B green yellow F yellow green G yellow red C G C class2 828X 2019
Constraint Satisfaction Tasks Example: map coloring A B C D E… Variables - countries (A,B,C,etc.) Values - colors (e.g., red, green, yellow) red green red green blue Constraints: A B, A D, D E , etc. red blue green green blue … … … … green Are the constraints consistent? … … … … red Find a solution, find all solutions green red blue red red Count all solutions Find a good (optimal) solution class2 828X 2019
Constraint Network A constraint network is: R= (X,D,C) X variables X { ,..., } X X 1 n { ,..., }, { ,... } D domain D D D D v v 1 1 n i k C constraints { ,... } C C C 1 t ( , ) C S R i i i 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 class2 828X 2019
Crossword Puzzle Formulation? Variables: x 1 , …, x 13 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
Crossword Puzzle class2 828X 2019
The Queen Problem The network has four variables, all with domains D i = {1, 2, 3, 4} . (a) The labeled chess board. (b) The constraints between variables. class2 828X 2019
The Queen Problem The network has four variables, all with domains D i = {1, 2, 3, 4} . (a) The labeled chess board. (b) The constraints between variables. class2 828X 2019
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
Constraint’s Representations X Y Z Relation: allowed tuples 1 3 2 2 1 3 Algebraic expression: 2 10 , X Y X Y ) ( Propositional formula: a b c Semantics: by a relation class2 828X 2019
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
Constraint Graphs: Primal, dual and hypergraphs CSP: When defining variables as squares: 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 2 1 4 3 12 12,13 1,2,3,4,5 3,6,9,12 Primal graph? 3 5 6 5 9 13 7 11 9 Dual graph? 5,7,11 8,9,10,11 12 11 10 10,13 8 10 13 (b) (a) class2 828X 2019
Constraint Graphs (primal) When variables are words class2 828X 2019 Queen problem
Graph Concepts class2 828X 2019
Graph Concepts Reviews: Hyper Graphs and Dual Graphs A hypergraph Primal graphs Dual graph Factor graphs 21
Propositional Satisfiability = {(¬C), (A v B v C), (¬A v B v E), (¬B v C v D)}. class2 828X 2019
Example: Radio Link Assignment cost f f i j 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 class2 828X 2019
Constraint graphs of 3 instances of the Radio frequency assignment problem in CELAR’s benchmark class2 828X 2019
Operations With Relations Intersection Union Difference Selection Projection Join Composition class2 828X 2019
Local Functions f Combination g Join : x 1 x 2 x 2 x 3 x 1 x 2 x 3 a a a a a a a a a b b b a b b b a b a f g Logical AND: x 1 x 2 x 3 h true a a a f g x 1 x 2 x 2 x 3 true a a b a a true a a true false a b a a b false a b true false a b b b a false b a true false b a a false b a b b b true b b false true b b a false b b b class2 828X 2019
Global View of the Problem C 1 C 2 Global View x 1 x 2 x 2 x 3 x 1 x 2 x 3 a a a a a a a a a b b b a b b b a b a The problem has a solution if the Does the problem a solution? global view is not empty x 1 x 2 x 3 h true a a a true a a b TASK The problem has a solution if there is some false a b a true tuple in the global view, the universal relation false a b b false b a a false b a b true b b a false b b b class2 828X 2019
Example of Selection, Projection and Join class2 828X 2019
Global View of the Problem C 1 C 2 Global View x 1 x 2 x 2 x 3 x 1 x 2 x 3 a a a a a a a a a b b b a b b b a b a What about counting? x 1 x 2 x 3 h x 1 x 2 x 3 h true 1 a a a a a a true 1 TASK a a b a a b false 0 a b a a b a false 0 a b b a b b true is 1 false 0 b a a b a a false is 0 false 0 b a b b a b logical AND? true 1 b b a b b a false 0 b b b b b b Number of true tuples class2 828X 2019 Sum over all the tuples
Examples Numeric constraints v1 < v2 V1 {1, 2, 3, 4} { 3, 6, 7 } V2 v1+v3 < 9 v2 < v3 v2 > v4 { 3, 4, 9 } { 3, 5, 7 } V3 V4 Can we specify numeric constraints as relations? class2 828X 2019
Numeric Constraints • Given P = ( V, D, C ), where V , , , V V V 1 2 n D , , , D D D 1 2 V V V n C , , , C C C 1 2 l Example I: v1 < v2 V1 {1, 2, 3, 4} { 3, 6, 7 } V2 v1+v3 < 9 v2 > v4 v2 < v3 { 3, 4, 9 } { 3, 5, 7 } V3 V4 • Define C ? class2 828X 2019
The minimal network, An extreme case of re-parameterization Binary Constraint Networks class2 828X 2019
Properties of Binary Constraint Networks A graph to be colored by two colors, an equivalent representation ’ having a newly inferred constraint between x1 and x3. Equivalence and deduction with constraints (composition) Winter 2016 33
Equivalence, Redundancy, Composition Equivalence: Two constraint networks are equivalent if they have the same set of solutions. Composition in relational operation ( ) R R R ⋈ xz xz xy yz Winter 2016 34
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
The 4-queens constraint network 2 2 The minimal domains The minimal network Solutions are: (2,4,1,3) (3,1,4,2) Winter 2016 36
The 4-queen problem The constraint graph The minimal domains The minimal constraints Solutions are: (2,4,1,3) (3,1,4,2) class2 828X 2019
The 4-queens problem Solutions are: (2,4,1,3) (3,1,4,2) 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) class2 828X 2019
Recommend
More recommend