Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems (Chapter 6). What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search.
Constraint Satisfaction Problems
This lecture topic (two lectures) Chapter 6.1 – 6.4, except
Lecture 11 Last Time: Local Search, Constraint Satisfaction Problems Today: More on CSPs.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 Constraint Satisfaction Problems. 2 Intro Example: 8-Queens Generate-and-test: 8 8 combinations.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
ICS-271:Notes 5: 1 Lecture 5: Constraint Satisfaction Problems ICS 271 Fall 2008.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Constraint Satisfaction Problems. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
Constraint Satisfaction Problems
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction Problems
CS460 Fall 2013 Lecture 4 Constraint Satisfaction Problems.
Constraint Satisfaction
Constraint Satisfaction Problems Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Lecture 5: On-line search Constraint Satisfaction Problems
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems
Constraint Satisfaction Problems
ISC 4322/6300 – GAM 4322 Artificial Intelligence Lecture 4 Constraint Satisfaction Problems Instructor: Alireza Tavakkoli September 17, 2009 University.
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
CSC 8520 Spring Paula Matuszek Based on Hwee Tou Ng, aima.eecs.berkeley.edu/slides-ppt, which are based on Russell, aima.eecs.berkeley.edu/slides-pdf.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
1 Chapter 5 Constraint Satisfaction Problems. 2 Outlines  Constraint Satisfaction Problems  Backtracking Search for CSPs  Local Search for CSP  The.
Constraint Satisfaction Russell & Norvig Ch. 5. Overview Constraint satisfaction offers a powerful problem- solving paradigm –View a problem as a set.
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Search 3: Constraint Satisfaction Problems Paula Matuszek Spring, 2013.
Chapter 5 Constraint Satisfaction Problems
Review Test1. Robotics & Future Technology Future of Intelligent Systems / Ray Kurzweil futurist Ray Kurzweil / A Long Bet A Long Bet / Robot Soccer.
CSE 473: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer.
Constraint Satisfaction Problems (Chapter 6)
An Introduction to Artificial Intelligence Lecture 5: Constraint Satisfaction Problems Ramin Halavati In which we see how treating.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
Constraint Satisfaction Problems University of Berkeley, USA
4/18/2005EE5621 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 5, 4/18/2005 University of Washington, Department of Electrical Engineering Spring.
Constraint Satisfaction Problems
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Computing & Information Sciences Kansas State University Friday, 08 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 7 of 42 Friday, 08 September.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
EXAMPLE: MAP COLORING. Example: Map coloring Variables — WA, NT, Q, NSW, V, SA, T Domains — D i ={red,green,blue} Constraints — adjacent regions must.
Dr. Shazzad Hosain Department of EECS North South University Lecture 01 – Part C Constraint Satisfaction Problems.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information Systems.
Cse 150, Fall 2012Gary Cottrell: Many slides borrowed from David Kriegman! Constraint Satisfaction Problems Introduction to Artificial Intelligence CSE.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Advanced Artificial Intelligence
Constraint Satisfaction Problems
Artificial Intelligence
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
Constraint Satisfaction Problems
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Artificial Intelligence Constraint satisfaction Chapter 5, AIMA

Constraint Satisfaction Problem (CSP) A set X = {X 1,X 2,...,X n } of variables Each variable X i has a nonempty domain D i = {v 1,v 2,...,v k(i) } of possible values A set C = {C 1,C 2,...,C m } of constraints A solution is a complete assignment of values for the variables, which satisfies all the constraints. Examples: Map coloring, scheduling, logistics (transportation), N-queens, crossword puzzles,...

Map coloring (Image borrowed from V. Pavlovic) X = {WA, NT, Q, NSW, V, SA, T} D = {R,G,B} (for all variables) C = {WA  NT, WA  SA, NT  SA, NT  Q, SA  Q, SA  NSW, SA  V, Q  NSW, NSW  V} (Neighboring regions must have different colors) Goal: All regions must have a color

Map coloring CSP can be visualized with constraint graph –Nodes = variables –Arcs = constraints

Types of constraints Unary: X i  v j Binary: X i  X j Higher order Preferences

CSP cast as a search problem Depth-first search (depth limit = n )  Backtracking search Very inefficient Initial state Successor function Goal test Path cost (not relevant)

”Vanilla” backtracking WA NT SA Q NSW V T WA NT Q SA Animation adapted from V. Pavlovic V NSW Q WA NT QQQ SA VVV NSW VVV

Improve ”vanilla” Backtracking 1.Smart choice of next variable - Min. remaining values (+ degree heuristic) - Least constraining value 2.Check consequences of choice - Forward checking - Arc consistency 3.Intelligent backtracking - Backjumping

Minimum remaining values Choose next the variable that is most constrained based on current assignment (& choose the one with the highest degree first in ties) WA NT SA Q NSW V T WA NT SA Animation adapted from V. Pavlovic Q NSW V T

Least constraining value Image borrowed from V. Pavlovic Select the value that least constrains the other variables (rules our fewest other variables)

Forward checking Delete values that are inconsistent with the last selection Animation adapted from V. Pavlovic Stop search early, if necessary

Arc consistency The arc X i  X j is consistent if for every value of X j there exists some valid value of X i. Detects failures sooner than forward checking. Use as preprocessor or as check after each move (MAC) Animation adapted from V. Pavlovic

4-queens X = {q 1, q 2, q 3, q 4 } ( q i = queen in column i ) D = {1,2,3,4} (row for queen) C : No queen may attack another queen Goal: Place all queens on the board q06 4% %6 40q q1q1 q4q4 q3q3 q2q2

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. F {1,2,3,4} q1q1 q3q3 q2q2 q4q4 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, 1998

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints.

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 2,q 1 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 3,q 1 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 4,q 1 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 3,q 2 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 q4q4 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 (q 3,q 2 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 2,q 3 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 2,q 3 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 3,q 4 )

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 1 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q The arc (i,j) is consistent if each value at the tail j of the arc has at least one value at the head i that does not violate the constraints. 1 {1,2,3,4}{1,2,3,4} {1,2,3,4} q1q1 q3q3 q2q2 q4q4 (q 3,q 4 )  No solution with q 1 = 1

Arc consistency: 4-queens q i = queen placed in column i {1,2,3,4} = The allowed values (row number) for the queen. First move: q 1 = 2 2 {1,2,3,4} q1q1 q3q3 q2q2 q4q4 Example from N.J. Nilsson, ”Artificial Intelligence: A New Synthesis”, q06 4% %6 40q Arc consistency (constraint propagation) finds the solution

Local search: Simple and efficient Start with initial (invalid) state Modify this state, using the min-conflicts heuristic: Select the value that minimizes the number of conflicts Continue until a solution is found

% q06 40q0q Local search: 4-queens %6 4% q06 40q Stuck! Choose random move that does not increase conflicts q%6 4% q q06 4% %6 40q Solution in three moves!

Map coloring: Australia Using Java AIMA site, calling from within MATLAB. Backtracking ~ 1.5 sec 7 variables (countries) 9 constraints 3 values (R,G,B)

Map coloring: Africa 49 variables (countries) 107 constraints 4 values (R,G,B,Y)

Map coloring: Africa Modified the AIMA Java code, calling from within MATLAB. Backtracking ~ 5.5 min