1 / 38

Artificial Intelligence CSC 361

Artificial Intelligence CSC 361. Tutorial# 4_Exercise#4. Constraint Satisfaction Problems. What is a CSP? Finite set of variables V 1 , V 2 , …, V n Nonempty domain of possible values for each variable D V1 , D V2 , … D Vn Finite set of constraints C 1 , C 2 , …, C m

isabelleg
Download Presentation

Artificial Intelligence CSC 361

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Artificial IntelligenceCSC 361 Tutorial#4_Exercise#4

  2. Constraint Satisfaction Problems • What is a CSP? • Finite set of variables V1, V2, …, Vn • Nonempty domain of possible values for each variable DV1, DV2, … DVn • Finite set of constraints C1, C2, …, Cm • Each constraint Ci limits the values that variables can take, • e.g., V1 ≠ V2 • A state is defined as an assignment of values to some or all variables. • Consistent assignment • assignment does not violate the constraints. • A solution to a CSP is a complete assignment that satisfies all constraints.

  3. Backtracking search • Similar to Depth-first search • Chooses values for one variable at a time and backtracks when a variable has no legal values left to assign.

  4. Improving CSP efficiency • Previous improvements on uninformed search  introduce heuristics • For CSPS, general-purpose methods can give large gains in speed, e.g., • Which variable should be assigned next? • In what order should its values be tried? • Can we detect inevitable failure early?

  5. Minimum remaining values (MRV) • Choose variable with the fewest legal moves. • e.g., will immediately detect failure if X has no legal values.

  6. Least constraining value for value-ordering • Given a variable choose the least constraining value. • leaves the maximum flexibility for subsequent variable assignments.

  7. Forward checking • Can we detect inevitable failure early? • And avoid it later? • Forward checking idea: keep track of remaining legal values for unassigned variables. • Terminate search when any variable has no legal values.

  8. Exercise#4

  9. Q2 Q3 Q4 Q5 Q6 Q1 1 2 3 4 5 6 Solve 6-queens Problem using Foreword Checking

  10. Q2 Q3 Q4 Q5 Q6 Q1 1 2 3 4 5 6 Forward Checking • Solve 6-queens …

  11. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  12. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  13. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  14. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  15. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 6 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  16. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 5 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  17. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  18. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  19. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 6 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  20. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  21. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 5 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  22. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  23. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  24. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  25. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 6 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  26. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  27. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 5 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  28. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 5 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  29. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  30. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  31. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  32. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  33. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 Column 6 has domain wipeout Backtrack to next “choice” 1 2 3 4 5 6

  34. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  35. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  36. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 4 5 6

  37. Forward Checking • Solve 6-queens … 2 3 4 5 6 1 1 2 3 First Solution! 4 5 6

  38. Questions..

More Related