lectur ture 9 e 9 arc consistency
play

Lectur ture 9 e 9 Arc Consistency (4. (4.5, 4. 4.6) 6) Slide - PowerPoint PPT Presentation

Computer Science CPSC 322 Lectur ture 9 e 9 Arc Consistency (4. (4.5, 4. 4.6) 6) Slide 1 Lect cture re O Overvi rview Recap of Lecture 8 Arc Consistency for CSP Domain Splitting 2 Course rse O Overvi rview


  1. Computer Science CPSC 322 Lectur ture 9 e 9 Arc Consistency (4. (4.5, 4. 4.6) 6) Slide 1

  2. Lect cture re O Overvi rview • Recap of Lecture 8 • Arc Consistency for CSP • Domain Splitting 2

  3. Course rse O Overvi rview Representation Environm nment ent Reasoning Stochastic Deterministic Technique Problem Type Arc We’ll start Consistency Constraint Vars + from CPS Search Satisfaction Constraints Static Belief Nets Logics Query Variable Search Elimination Decision Nets Sequential STRIPS Variable Planning Elimination Search Markov Processes Value 3 Iteration

  4. We e will l look ook at at Sear earch f ch for or C CSP • Constraint Satisfaction Problems (CPS): • State • Successor function • Goal test • Solution • Heuristic function • Query : • State • Successor function • Goal test • Solution • Heuristic function • Planning • State • Successor function • Goal test • Solution • Heuristic function 4

  5. Cons onstra raint Sat atisfaction n Probl roblems (C (CSPs): s): Def efinitions Definition: A constraint satisfaction problem (CSP) consists of: a set of variables V • a domain dom(V) for each variable • a set of constraints C • • Constraints are restrictions on the values that one or more variables can take • Unary constraint: restriction involving a single variable • k-ary constraint: restriction involving k different variables  We will mostly deal with binary constraints • Constraints can be specified by 1. listing all combinations of valid domain values for the variables participating in the constraint 2. giving a function that returns true when given values for each variable which satisfy the constraint

  6. Exam ample: Map Map-Col olor oring ng Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, NT ≠ SA, NT ≠ QU, ….., WA NT NT NT NT SA SA NT NT QU Red Green Red Green Red Green Or Red Bue Red Bue Red Bue Green Red Green Red Green Red ………….. Green Blue Green Blue Green Blue Blue Red Blue Red Blue Red Blue Green Blue Green Blue Green 6

  7. Cons onstra raint Sat atisfaction n Probl roblems (C (CSPs): s): Def efinitions Definition: A constraint satisfaction problem (CSP) consists of: a set of variables V • a domain dom(V) for each variable • a set of constraints C • Definition: A model of a CSP is an assignment of values to all of its variables (i.e., a possible world) that satisfies all of its constraints. WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green

  8. Sol olving C ng Cons onstrai aint nt S Sat atisf sfact ction P on Probl oblem ems • Even the simplest problem of determining whether or not a model exists in a general CSP with finite domains is NP- hard • There is no known algorithm with worst case polynomial runtime. • However, we can try to: • identify special cases for which algorithms are efficient • find efficient (polynomial) consistency algorithms that reduce the size of the search space • work on approximation algorithms that can find good solutions quickly, even though they may offer no theoretical guarantees • find algorithms that are fast on typical (not worst case) cases 8

  9. Search rch-Ba Base sed A Appro roach ch • Constraint Satisfaction (Problems): • State: assignments of values to a subset of the variables • Successor function: assign values to a “free” variable • Goal test: all variables assigned a value and all constraints satisfied? • Solution: possible world that satisfies the constraints • Heuristic function: none (all solutions at the same distance from start) {} • Planning : V 1 = v 1 • State V 1 = v k • Successor function • Goal test • V 1 = v 1 Solution V 1 = v 1 V 1 = v 1 V 2 = v k • Heuristic function V 2 = v 1 V 2 = v 2 • Inference • State • Successor function V 1 = v 1 V 1 = v 1 V 2 = v 1 V 2 = v 1 • Goal test V 3 = v 1 V 3 = v 2 • Solution 9 • Heuristic function

  10. Backt ktra racki cking a algori rithms ms • Explore search space via DFS but evaluate each constraint as soon as all its variables are bound. • Any partial assignment that doesn’t satisfy the constraint can be pruned. {} Check unary constraints on V 1 V 1 = v 1 V 1 = v k If not satisfied = PRUNE V 1 = v 1 Check constraints on V 1 V 1 = v 1 V 2 = v k V 1 = v 1 and V 2 If not satisfied = V 2 = v 1 V 2 = v 2 PRUNE V 1 = v 1 V 1 = v 1 V 2 = v 1 V 2 = v 1 V 3 = v 1 V 3 = v 2 10

  11. Selec ecting v ng variab ables es i in a smar art w way • Backtracking relies on one or more heuristics to select which variables to consider next. E.g, variable involved in the largest number of constraints: - “If you are going to fail on this branch, fail early!” • But we will look at an alternative approach that can do much better • Arc C Cons onsistenc ncy: • Key idea: prune the domains as much as possible before searching for a solution. 11

  12. Lect cture re O Overvi rview • Recap of Lecture 8 • Arc Consistency for CSP • Domain Splitting 12

  13. Can an w we e do bet do better t than han S Sea earch? Key idea • prune the domains as much as possible before searching for a solution. Definition : A variable is domain consistent if no value of its domain is ruled impossible by any unary constraints. • Example: dom(V ) = {1, 2, 3, 4}. • Variable V is not domain consistent with the constraint V≠ 2 - It is domain consistent once we remove 2 from its domain. Pruning domains is trivial for unary constraints. Trickier for k-ary ones. 13

  14. Cons nstrai aint nt N Networ works Def. A constraint network is defined by a graph, with one node for every variable (drawn as circle) - one node for every constraint (drawn as rectangle) - undirected edges running between variable nodes and constraint - nodes whenever a given variable is involved in a given constraint. C {1,2} A>C B A A< B {3} {2,3} - Three variables: A, B, C - Two constraints: A<B, A>C 14

  15. Example C e Cons nstrai aint nt N Networ work Def. A constraint network is defined by a graph, with - one node for every variable (drawn as circle) - one node for every constraint (drawn as rectangle) - undirected edges running between variable nodes and constraint nodes whenever a given variable is involved in a given constraint. Example: • Variables: A,B,C • Domains: {1, 2, 3, 4} • 3 Constraints: A < B, B < C, B = 3 5 edges/arcs in the constraint network: 〈 A,A<B 〉 , 〈 B,A<B 〉 〈 B,B<C 〉 , 〈 C,B<C 〉 〈 B, B=3 〉 15

  16. A more c e compl plicated e ed exam ampl ple How many variables are there in this constraint network? 16

  17. A more c e compl plicated e ed exam ampl ple How many variables are there in this constraint network? A. 5 B. 6 C. 9 D. 14 17

  18. A more c e compl plicated e ed exam ampl ple How many variables are there in this constraint network? A. 5 B. 6 C. 9 D. 14 18

  19. A more c e compl plicated e ed exam ampl ple How many variables are there in this constraint network? A. 5 How many constraints? A. 6 B. 9 C. 14 D. 18 19

  20. Arc C Consi sist stency cy Definition: An arc <x, r(x,y)> is arc consistent if for each value x in dom(X) there is some value y in dom(Y) such that r(x,y) is satisfied. A network is arc consistent if all its arcs are arc consistent. B A 2,3 A< B 1,2,3 Not arc consistent: Arc consistent: Both B=2 and No value in domain of B that satisfies A<B if B=3 have ok values for A - e.g. for A = 1 20

  21. Arc C Consi sist stency cy Definition: An arc <x, r(x,y)> is arc consistent if for each value x in dom(X) there is some value y in dom(Y) such that r(x,y) is satisfied. A network is arc consistent if all its arcs are arc consistent. B A 2,3 A< B 1,2,3 Not arc consistent: Arc consistent: Both B=2 and No value in domain of B that satisfies A<B if B=3 have ok values for A A = 3 A = 1 - e.g. for B=2 21

  22. Arc C Consi sist stency cy Definition: An arc <x, r(x,y)> is arc consistent if for each value x in dom(X) there is some value y in dom(Y) such that r(x,y) is satisfied. A network is arc consistent if all its arcs are arc consistent . Y X X< Y/2 3, 6, 12 2, 5

  23. Arc C Consi sist stency cy Definition: An arc <x, r(x,y)> is arc consistent if for each value x in dom(X) there is some value y in dom(Y) such that r(x,y) is satisfied. A network is arc consistent if all its arcs are arc consistent . Y X X< Y/2 3, 6, 12 2, 5 A. Both arcs are consistent B. Left consistent, right inconsistent C. Left inconsistent, right consistent D. Both arcs are inconsistent Left = <X, (X < Y/2)> Right = <Y, (X < Y/2)> 23

  24. Arc C Consi sist stency cy Definition: An arc <x, r(x,y)> is arc consistent if for each value x in dom(X) there is some value y in dom(Y) such that r(x,y) is satisfied. A network is arc consistent if all its arcs are arc consistent. Not arc consistent: Arc consistent: Both No value in domain of X X=2 and X=5 have that satisfies X< Y/2 ok values for Y (e.g. if Y= ) Y X X< Y/2 3,5,12 2,5, 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend