Outline 1 The topic 2 Decision support systems 3 Modeling 3.4 Constraints Computing with relations Finite domains Solution algorithms Complexity vs. completeness Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 163 Group of the Technical University of Munich
Example: A Crossword Puzzle 1 2 3 Instructions fill in words from the list 4 5 List of Words 6 7 Aft Laser Ale Lee 8 Eel Line Hike Sails Hoses Sheet Keel Steer Knot Tie Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 164 Group of the Technical University of Munich
Definitions Variables and Domains variables V = {v 1 , v 2 , ..., v n } domains D = {DOM(v 1 ), DOM(v 2 ), ..., DOM(v n )} Constraints C relations R i DOM(v k1 ) DOM(v k2 ) ... DOM(v kj ) Constraint Satisfaction Problem (CSP) Given (V, D, C) determine tuples in DOM(v 1 ) DOM(v 2 ) ... DOM(v n ) that satisfy given set of constraints C = {R 1 , R 2 , ..., R c } Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 165 165 Group of the Technical University of Munich
Example: CSP for the Crossword Puzzle Variables V = {1 across, 4 across, 2 down, ... } Domains For all i DOM i = {Aft, Ale, Eel, Hike, ...} Constraints For each variable v i : Equal(LengthWord(v i ), NumberPositions(v i )) For two variables v i , v j sharing positions p ik , p jl : Equal(Character(p ik ),Character(p jl )) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 166 Group of the Technical University of Munich
Graphical Representations of CSPs v 1 v 2 Primal Constraint Graph C 1 C 2 nodes represent variables hyperarcs represent constraints v 4 v 3 C 3 v 2 C 1 C 2 Dual Constraint Graph nodes represent constraints v 2 v 3 v 2 v 4 multiarcs represent variables C 3 Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 167 Group of the Technical University of Munich
Example: Primal Constraint Graph for the Crossword Puzzle 1 across 4 across 7 across 8 across Aft Aft Aft Aft Ale Ale Ale Ale Eel Eel Eel Eel Hike Hike Hike Hike ... ... ... ... Aft Aft Aft Aft Ale Ale Ale Ale Eel Eel Eel Eel Hike Hike Hike Hike ... ... ... ... 2 down 3 down 5 down 6 down Model-Based Systems & Qualitative Reasoning 168 WS 11/12 EMDS 3 Group of the Technical University of Munich
Solving CSPs Basic Search Methods general search strategies – generate and test – chronological backtracking: backtracking to the last choice “gather information while searching” strategies – dependency-directed backtracking: (ddp) backtracking to a choice that caused the inconsistency – truth maintenance systems: record dependencies and avoid choices leading to discovered inconsistencies (see ch. 4.3) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 169 Group of the Technical University of Munich
Problem Reduction Basic Idea reduce size of CSP without ruling out solutions Removing Domain Values through Constraint Filtering remove values for nodes (1-consistency, “node consistency”) remove values for arcs (2-consistency, “arc consistency”) ... remove values for paths of length k-1 (k-consistency) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 170 Group of the Technical University of Munich
Algorithm for Node Consistency Procedure NC (V, D, C) For each v i V For each R j C with R j DOM(v i ) For each val DOM(v i ) If val R j Then DOM(v i ) DOM(v i ) \ {val} Return (V, D, C) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 171 Group of the Technical University of Munich
Crossword Puzzle: After Applying Node Consistency 1 across 4 across 7 across 8 across Hoses Aft Hoses Laser Hike Ale Laser Sails Keel Eel Sails Sheet Knot Lee Sheet Steer Line Tie Steer Hoses Hoses Aft Laser Laser Hike Ale Sails Sails Keel Eel Sheet Sheet Knot Lee Steer Steer Line Tie 2 down 3 down 5 down 6 down Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 172 Group of the Technical University of Munich
Definition: (Classical) Arc-Consistency (2-Consistency) Constraint network R = ( V, D, C) Binary constraints R ik C Variable v i is arc-consistent relative to v k iff for every value a i DOM(v i ) there exists a k DOM(v k ) such that (a i , a k ) R ik Arc (v i , v k ) is arc-consistent iff v i is arc-consistent relative to v k and v k is arc-consistent relative to v i ( V, D, C) is arc-consistent iff all arcs are arc-consistent compute by closure over DOM(v i ) DOM(v i ) i (R ik DOM(v k ) ) Model-Based Systems & Qualitative Reasoning 173 WS 11/12 EMDS 3 Group of the Technical University of Munich
Algorithm for Arc Consistency Procedure REVISE_DOMAIN (v i ,v k ) deleted False; For each val i DOM(v i ) If Not exists val k DOM(v k ) such that (val i ,val k ) R i,k Then DOM(v i ) DOM(v i ) \ {val i }; deleted True return(deleted) compute by closure over DOM(v i ) DOM(v i ) i (R ik DOM(v k ) ) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 174 Group of the Technical University of Munich
AC-1: A Simple Algorithm for Arc Consistency Procedure AC-1 (V, D, C) agenda {(v i ,v k ) i,k n, i k}; Repeat changed False; For each (v i ,v k ) agenda changed REVISE_DOMAIN(v i ,v k ) or changed Until Not changed; return(V,D,C) compute by closure over DOM(v i ) DOM(v i ) i (R ik DOM(v k ) ) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 175 Group of the Technical University of Munich
AC-3: An Improved Algorithm for Arc Consistency Procedure AC-3 (V, D, C) agenda {(v i ,v k ) i,k n, i k}; While agenda { } choose (v i ,v k ) agenda; agenda agenda \ (v i ,v k ); If REVISE_DOMAIN(v i ,v k ) Then agenda agenda {(v m ,v i ) m n, m k,i} Wend; return(V,D,C) compute by closure over DOM(v i ) DOM(v i ) i (R ik DOM(v k ) ) Model-Based Systems & Qualitative Reasoning 176 WS 11/12 EMDS 3 Group of the Technical University of Munich
Example: Crossword Puzzle: Applying Arc Consistency 1 across 4 across 7 across 8 across Aft Hoses Hoses Hike Ale Laser Laser Keel Eel Sails Sails Knot Lee Sheet Sheet Line Tie Steer Steer Hoses Hoses Aft Laser Laser Hike Ale Sails Sails Keel Eel Sheet Sheet Knot Lee Steer Steer Line Tie 2 down 3 down 5 down 6 down Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 177 Group of the Technical University of Munich
Example: Crossword Puzzle: Solution 1 2 3 H O S E S A T 4 5 H I K E 6 7 A L E E 8 L A S E R E L Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 178 Group of the Technical University of Munich
Definition: Classical Path-Consistency (3-Consistency) Constraint network R = ( V, D, C) { v i , v j } is path-consistent relative to v k iff for every consistent assignment (v i = a i , v j = a j ) there is a value a k DOM(v k ) such that the assignments (v i =a i , v k =a k ) and (v k =a k ,v j =a j ) are consistent A binary constraint R ij is path-consistent relative to v k iff for every tuple (a i ,a j ) R ij there is a k DOM(v k ) such that (a i ,a k ) R ik and (a k ,a j ) R kj A constraint network is path-consistent iff every R ij is path-consistent relative to v k for every k i, j compute by closure over R ij R ij ij (R ik DOM(v k ) R kj ) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 179 Group of the Technical University of Munich
Complexity of Constraint Filtering (Binary CSPs) Polynomial Algorithms n: number of variables c: number of constraints d: (maximal) domain size Time Space 2-consistency O(cd 3 ) O(c+nd) O(cd 2 ) O(cd 2 ) 3-consistency O(n 3 d 3 ) O(n 3 d 3 ) Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 180 Group of the Technical University of Munich
Example: Centigrade - Fahrenheit: 9C = 5(F-32) u=Mult(C,w) u=Mult(v,x) F=Add(v,y) C u v F w x y 9 5 32 Evaluation of Constraints no built-in “direction” compare this to statement in programming language like C ++ Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 181 Group of the Technical University of Munich
Completeness of Consistency Filtering x y z x = 1 ADD z = 5 ADD y = ? Theoretical Results [Freuder 78]: k-consistency does in general not guarantee existence of solutions [Dechter-Pearl 88]: arc consistency sufficient for tree-structured constraint graphs Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 182 Group of the Technical University of Munich
References [Dechter 03] “Constraint Processing”, Morgan Kaufmann, 2003 • http://www.aispace.org/index.shtml Model-Based Systems & Qualitative Reasoning WS 11/12 EMDS 3 183 Group of the Technical University of Munich
Recommend
More recommend