1 / 18

An Introduction to Artificial Intelligence

An Introduction to Artificial Intelligence. Lecture 5: Constraint Satisfaction Problems Ramin Halavati (halavati@ce.sharif.edu).

iram
Download Presentation

An Introduction to Artificial Intelligence

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. An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati (halavati@ce.sharif.edu) In which we see how treating states as more than just black boxes leads to the invention of a range of powerful new search methods and a deeper understanding of problem structure and complexity.

  2. Overview • States/Goal(s) • Black Box vs. Structured • General Purpose Heuristics

  3. What is Constraint Satisfaction? • A set of variables: X1,X2,…,Xn. • A set of constraints: C1,C2,…,Cm. • Each variable, a domain: D1,D2,…,Dn. • State: An assignment of values to Xis. • Consistent: Obeying all constraints. • Complete: All variables having values. • Solution: A complete, consistent state. • Objective Function: Extra!

  4. Real World Samples of CSP • Assignment problems • e.g., who teaches what class • Timetabling problems • e.g., which class is offered when and where? • Transportation scheduling • Factory scheduling

  5. CSP, Sample • To assign one of {red, green, blue} to each of 7 variables: WA, BT, SA, Q, NSW, V, T. • Constraints: • WA ≠ NT,WA ≠ SA , NT ≠ Q, SA ≠ Q , … • Solution: • {WA = red , NT = green, Q = red , NSW = green, …

  6. Formulation • Initial State: { } • Successor Function: Value assignment to one variable with no conflict. • Goal Test: Consistent, Complete, assignment. • Path Cost: 1 for each step.

  7. Constraint Types • Constraint Types: • Unary / Binary / More… • Auxiliary Variables • Variables: F T U W, R O X1 X2 X3 • Constraints: All Different (F, T, U, W, R, O) • O + O = R + 10 · X1 • X1 + W + W = U + 10 · X2 • X2 + T + T = O + 10 · X3 • X3 = F, T ≠ 0, F≠ 0 TWO +TWO FOUR

  8. Constraint Graph

  9. Recursive Back Track Algorithm • Recursive Back Track( assignment , CSP ) If assignment is complete, return assignment. Var Select an unassigned variable. For each Value in Domain (Var), if Consistent( assignment + Var  Value ) Then result  RBT (assignment + Var  Value ) if ( result≠ failure ) return result. remove (Var  Value ) from assignment Return failure.

  10. Major Questions… • Which variable to assign. • What to assign. • How to prevent further repetitions of a failure.

  11. Minimum Remaining Values (MRV) • To choose one which is most likely to fail • Immediate recognition of failure

  12. Most Constraining Variable • To choose one who interferes the others most! • Major reduction in branching factor. 3 3 2 5 3 2 0

  13. Least Constraining Value (LCV) • To choose a value which puts minimum constraint on other variables. • To leave maximum flexibility.

  14. Forward Checking • Keep track of remaining legal values for unassigned variables • Terminate search when any variable has no legal values

  15. Arc Consistency • AB is consistent if for each remaining value in domain of A, there may be a consistent value in domain of B. • Consistent: • SANSW, NSWV,… • Not C.: • NSWSA, NTSA,…

  16. Intelligent Backtracking • Q  Red • NSW  Green • V  Blue • T  Red • SA  ? 1 2 ? 3 4

  17. Back Jumping • Q  Red • NSW  Green • V  Blue • T  Red • SA  ? • Conflict Set: {Q, V, NSW} 1 2 ? 3 4

  18. Local Search for Constraint Satisfaction Problems • Min Conflict Algorithm • Create a random complete state. • For a fixed number of times • If current state is consistent, return. • Choose a random variable v, and change assignment of v to a value that causes minimum conflict.

More Related