Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Constraint Networks Dario Maggi University Basel October 9, 2014 Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Overview 1 What is a Constraint Network? 2 Formulation of a Constraint Network 3 Constraint Graphs 4 Solutions of Constraint Networks 5 Properties of Binary Constraint Networks Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks What is a Constraint Network? Groceries Shopping Daily routine Seat arrangement at a wedding Transportation scheduling Factory scheduling Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Seat arrangement at a wedding Constraints: Table Layout Bride and groom sit at the “head table” Bride and groom sit next to each other Parents of the bride and groom sit close to the married couple, but not too close Beside every woman sits a man. There needs to be a children’s table. The children’s table must not be close to the gifts table. . . . Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks What is a constraint network? Variables (Positions in a bag, slots in a schedule, seats at a wedding, . . . ) Possible values for the variables. ((Milk, Bread, Egs), (shower, training, work, homework, eat), � (Adam, Beatrice, Carla, . . . ) Constraints: ”You must not put the milk on top of the eggs.” ”You should take a shower after the training.” . . . Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Definition: Constraint Network A constraint network R is given by a triple R = ( X , D , C ), where: X = { x 1 , . . . , x n } is a finite set of variables , D = { D 1 , . . . , D n } is the set of domains , where each D i is a finite set that contains the possible values for variable x i , and C = { C 1 , . . . , C k } is a finite set of constraints . Each constraint C i ∈ C is given by a tuple C i = ( S i , R i ). S i is called the scope . The scope provides the variables over which the relation is defined. The scope therefore needs to be a subset of X . The relation R i is a set of tuples. Each of these tuples holds an allowed assignment for the variables of its scope. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Constraint can be written as its Relation, if the scope is indexed and clear: � � C i = { x , y } , { (1 , 1) , (1 , 2) } C i = R xy = { (1 , 1) , (1 , 2) } Network Scheme: Set of all scopes S = { S 1 , . . . , S k } Arity of a constraint: | S i | unary constraint: arity = 1 binary constraint: arity = 2 binary constraint network: only unary and binary constraints. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Constraint network R = ( X , D , C ) : Cells as variables: Crossword Puzzle � � X = x 1 , x 2 , x 3 , x 4 , x 5 , x 6 , x 7 . Domains are the letters of the alphabet: D = � D i = � � | 1 ≤ i ≤ 7 � . A , . . . , Z Constraints: R 1 , 4 = { ( M , E ) , ( H , I ) , ( B , E ) , ( D , O ) } R 2 , 7 = { ( M , E ) , ( H , I ) , ( B , E ) , ( D , O ) } R 3 , 4 , 5 , 6 , 7 = { ( H , E , L , L , O ) , ( T , H , E , R , E ) , ( D , O , I , N , G ) , ( B , E , N , N , I ) } Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks 4-Queens Problem Constraint network R = ( X , D , C ) : Columns as variables: X = � � x 1 , x 2 , x 3 , x 4 Domains are the rows the queen stands in: � � � � D = D i = 1 , 2 , 3 , 4 | 1 ≤ i ≤ 4 Constraints: � R ij = ( v i , v j ) | v i � = v j , | v i − v j | � = | i − j | � for 1 ≤ i < j ≤ 4 Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Constraint Graphs Constraint Graphs Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Primal Constraint Graph Primal constraint graph of the crossword puzzle. x 1 x 2 x 4 x 7 Variables are vertices/nodes. Variables which share a x 5 common scope are x 3 x 6 connected with edges. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Dual Constraint Graph Dual constraint graph of the crossword puzzle. x 1 , x 4 x 2 , x 7 Relations are vertices/nodes. x 4 x 7 Edges connect relations sharing a common variable. x 3 , x 4 , x 5 , x 6 , x 7 Edge is labeled with the shared variables. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Solutions of Constraint Networks Solutions of Constraint Networks Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Instantiation If a variable x i gets assigned value the variable has been instantiated. Notations: � � ¯ a = ( x i , a i ) , . . . , ( x k , a k ) � � ¯ a = x i = a i , . . . , x k = a k � ¯ a = a 1 , a 2 , . . . ) Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Satisfying a Constraint An instantiation ¯ a satisfies a constraint C i = ( S i , R i ) if: Every variable in the scope S i is assigned by ¯ a . There must be a tuple in R i that corresponds to the values of ¯ a on the variables in S i . Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Satisfying a Constraint: Example � � a = ¯ ( x , 1) , ( y , 2) , ( z , 3) R 1 � � a satisfies R 1 xy = (1 , 2) ← − ¯ xy R 2 � � a does not satisfy R 2 xy = (1 , 3) ← − ¯ xy (y cannot take the value 2) R 3 � � a satisfies R 3 xy = (1 , 1) , (1 , 2) , (2 , 4) ← − ¯ xy R 4 � � a does not satisfy R 4 xy = (1 , 1) , (1 , 3) , (2 , 4) ← − ¯ xy R 4 a does not satisfy R 4 ux ← − ¯ ux (¯ a does not assign a value to u ). Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks A Consistent Partial Instantiation A partial instantiation is consistent if it satisfies all constraints which scopes are covered by ¯ a � � a = ¯ ( x , 1) , ( y , 2) , ( z , 3) a has to satisfy every constraint where: S i ⊆ { x , y , z } ¯ R xy , R xz , R xyz have to be satisfied. R wxy , R axy do not have to be satisfied. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Solution An instantiation is a solution of a constraint network if all variables are instantiated and the instantiation is consistent. Solution( R ) is the set of all complete consistent instantiations. Solution( R ) can also be interpreted as a relation ρ X We say that R expresses relation ρ X . Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Equivalence of Constraint Networks Two networks are equivalent if they are defined over the same variables and express the same solutions. y : red/green y : red/green � = � = � = = x : red/green z : red/green x : red/green z : red/green Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Deduction with Constraints The goal is to infer or deduct additional constraints. The network has to stay equivalent. Constraint deduction can be accomplished through composition: Composition � R xy · R yz = R xz = ( a , c ) | a ∈ D x , c ∈ D z , ∃ b ∈ D y � such that ( a , b ) ∈ R xy and ( b , c ) ∈ R yz � � R xy · R yz = R xz = π { x , z } R xy ⋊ ⋉ R yz Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Composition Example x y y z y : red/green � = � = R xy : R yz : red green green red green red red green x : red/green z : red/green The natural join R xy ⋊ ⋉ R yz : x y z red green red green red green The projection on { x , z } , R xz : x z green green red red Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Properties of Binary Constraint Networks Properties of Binary Constraint Networks Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Expressive Power of Binary Networks We want to get a feeling of the expressive powers of binary networks. Can any relation be represented as a binary network? For this to be the case, every relation has to be representable by a binary network. Dario Maggi
Constraint Network Formulation Constraint Graphs Solutions Properties Binary Constraint Networks Expressive Power of Binary Networks II Given: n variables each variable can have k different values Number of possible relations: 2 k n Number of possible binary networks: 2 k 2 n ( n − 1) 2 Dario Maggi
Recommend
More recommend