constraint satisfaction problems problems
play

Constraint Satisfaction Problems Problems Artificial Intelligence - PDF document

Constraint Satisfaction Problems Problems Artificial Intelligence AIMA 2 nd edition, chapter 5 Section 1 3 Hadi Moradi 1 Outline Constraint Satisfaction Problems (CSP) Backtracking search for CSPs B kt ki h f CSP Local


  1. Constraint Satisfaction Problems Problems Artificial Intelligence AIMA 2 nd edition, chapter 5 Section 1 – 3 Hadi Moradi 1 Outline � Constraint Satisfaction Problems (CSP) � Backtracking search for CSPs B kt ki h f CSP � Local search for CSPs 2 1

  2. Constraint satisfaction problems (CSPs) � CSP: � � State � � goal test � 3 Example: Map-Coloring Variables � Domains � Constraints: � 4 2

  3. Example: Map-Coloring � Solutions are complete and consistent assignments, 5 Constraint graph � Binary CSP: each constraint relates two variables � � Constraint graph: nodes are variables, arcs are constraints � 6 3

  4. Varieties of CSPs � Discrete variables � finite domains: � infinite domains: � Continuous variables � 7 Varieties of constraints � Unary constraints involve a single variable, � Binary constraints involve pairs of variables, � Higher-order constraints involve 3 or more variables, 8 4

  5. Real-world CSPs � Assignment problems � Timetabling problems � Transportation scheduling p g � Factory scheduling 9 Standard search formulation (incremental) Let's start with the straightforward approach, then fix it Initial state: Initial state: � Successor function � � � Goal test: � Branching factor : B anching facto 1. 10 5

  6. Backtracking search Variable assignments are commutative}, i.e., � [ WA = red then NT = green ] same as [ NT = green then WA = red ] Depth-first search for CSPs with single-variable assignments is called � backtracking search Can solve n -queens for n ≈ 25 � 11 Backtracking search 12 6

  7. Backtracking example 13 Backtracking example 14 7

  8. Backtracking example 15 Backtracking example 16 8

  9. Improving backtracking efficiency � General-purpose methods can give huge gains in speed: gains in speed: � Which variable should be assigned next? � In what order should its values be tried? � Can we detect inevitable failure early? 17 Minimum Remaining Variable 18 9

  10. Degree Heuristic � Choose the Most constraining variable: 19 Least constraining value � Given a variable, choose the least constraining value: constraining value: � � 20 10

  11. Forward checking � Idea: � Keep track of remaining legal values for unassigned variables p g g g � Terminate search when any variable has no legal values 21 Forward checking 22 11

  12. Forward checking 23 Forward checking 24 12

  13. Constraint propagation � Forward checking doesn't provide early detection for all failures: failures: � 25 Arc consistency � Simplest form of propagation makes each arc consistent � X � Y is consistent iff X � Y i i t t iff � for every value x of X there is some allowed y 26 13

  14. Arc consistency � Simplest form of propagation makes each arc consistent � X � Y is consistent iff X � Y i i t t iff � for every value x of X there is some allowed y 27 Arc consistency � If X loses a value, neighbors of X need to be rechecked � 28 14

  15. Arc consistency � � 29 Arc consistency algorithm AC-3 30 15

  16. Local search for CSPs � Hill-climbing, simulated annealing typically work with "complete" states, i.e., all variables assigned � To apply to CSPs: 31 Example: 4-Queens � States: 4 queens in 4 columns (4 4 = 256 states) � � Actions: move queen in column � � Goal test: no attacks � � Evaluation: h(n) = number of attacks � 32 16

  17. Summary CSPs are a special kind of problem: � states defined by values of a fixed set of variables � goal test defined by constraints on variable values goal test defined by constraints on variable values � � Backtracking = depth-first search with one variable assigned per node � Variable ordering and value selection heuristics help significantly � Forward checking prevents assignments that guarantee later failure � Constraint propagation (e.g., arc consistency) does additional work to � constrain values and detect inconsistencies constrain values and detect inconsistencies Iterative min-conflicts is usually effective in practice � 33 17

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