Constraint Satisfaction Problems Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages 104-105 CS121 – Winter 2003.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems
Constraint Satisfaction Problems Russell and Norvig: Parts of Chapter 5 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
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.
MBD and CSP Meir Kalech Partially based on slides of Jia You and Brian Williams.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
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
Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. 5.
Constraint Satisfaction Problems
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.
Constraint Satisfaction Problems Russell and Norvig: Chapter 5 CMSC 421 – Fall 2005.
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. 5 1.
Constraint Satisfaction Problems
Constraint Satisfaction Problems
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Constraint Satisfaction Read Chapter 5. Model Finite set of variables: X1,…Xn Variable Xi has values in domain Di. Constraints C1…Cm. A constraint specifies.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
PSU CS 370 – Introduction to Artificial Intelligence 1 Constraint Satisfaction Problems Chapter 5.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
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.
1 CS B551: Elements of Artificial Intelligence Instructor: Kris Hauser
Chapter 5 Constraint Satisfaction Problems
Constraint Satisfaction Problems (Chapter 6)
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
C ONSTRAINT S ATISFACTION P ROBLEMS Instructor: Kris Hauser 1.
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.
Constraint Satisfaction Problems Rich and Knight: 3.5 Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Dr. Shazzad Hosain Department of EECS North South University Lecture 01 – Part C Constraint Satisfaction Problems.
Constraint Satisfaction Problems (CSP) (Where we delay difficult decisions until they become easier) R&N: Chap. 6 (These slides are primarily from a course.
PSU CS 370 – Introduction to Artificial Intelligence 1 Constraint Satisfaction Problems.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
Constraint Satisfaction Problems Russell and Norvig: Chapter 5 CMSC 421 – Fall 2006.
ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information Systems.
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. Slides taken from.
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction Problems
Constraint Propagation
Constraint Satisfaction Problems
Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Propagation
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Constraint Satisfaction Problems Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages CS121 – Winter 2003

Constraint Satisfaction Problems2 Intro Example: 8-Queens Purely generate-and-test The “search” tree is only used to enumerate all possible 64 8 combinations

Constraint Satisfaction Problems3 Intro Example: 8-Queens Another form of generate-and-test, with no redundancies  “only” 8 8 combinations

Constraint Satisfaction Problems4 Intro Example: 8-Queens

Constraint Satisfaction Problems5 What is Needed? Not just a successor function and goal test But also a means to propagate the constraints imposed by one queen on the others and an early failure test  Explicit representation of constraints and constraint manipulation algorithms

Constraint Satisfaction Problems6 Constraint Satisfaction Problem Set of variables {X 1, X 2, …, X n } Each variable X i has a domain D i of possible values Usually D i is discrete and finite Set of constraints {C 1, C 2, …, C p } Each constraint C k involves a subset of variables and specifies the allowable combinations of values of these variables

Constraint Satisfaction Problems7 Constraint Satisfaction Problem Set of variables {X1, X2, …, Xn} Each variable Xi has a domain Di of possible values Usually Di is discrete and finite Set of constraints {C1, C2, …, Cp} Each constraint C k involves a subset of variables and specifies the allowable combinations of values of these variables Assign a value to every variable such that all constraints are satisfied

Constraint Satisfaction Problems8 Example: 8-Queens Problem 64 variables X ij, i = 1 to 8, j = 1 to 8 Domain for each variable {1,0} Constraints are of the forms: X ij = 1  X ik = 0 for all k = 1 to 8, k  j X ij = 1  X kj = 0 for all k = 1 to 8, k  i Similar constraints for diagonals   X ij = 8

Constraint Satisfaction Problems9 Example: 8-Queens Problem 8 variables X i, i = 1 to 8 Domain for each variable {1,2,…,8} Constraints are of the forms: X i = k  X j  k for all j = 1 to 8, j  i Similar constraints for diagonals

Constraint Satisfaction Problems10 Example: Map Coloring 7 variables {WA,NT,SA,Q,NSW,V,T} Each variable has the same domain {red, green, blue} No two adjacent variables have the same value: WA  NT, WA  SA, NT  SA, NT  Q, SA  Q, SA  NSW, SA  V,Q  NSW, NSW  V WA NT SA Q NSW V T WA NT SA Q NSW V T

Constraint Satisfaction Problems11 Example: Street Puzzle Ni = {English, Spaniard, Japanese, Italian, Norwegian} Ci = {Red, Green, White, Yellow, Blue} Di = {Tea, Coffee, Milk, Fruit-juice, Water} Ji = {Painter, Sculptor, Diplomat, Violonist, Doctor} Ai = {Dog, Snails, Fox, Horse, Zebra}

Constraint Satisfaction Problems12 Example: Street Puzzle Ni = {English, Spaniard, Japanese, Italian, Norwegian} Ci = {Red, Green, White, Yellow, Blue} Di = {Tea, Coffee, Milk, Fruit-juice, Water} Ji = {Painter, Sculptor, Diplomat, Violonist, Doctor} Ai = {Dog, Snails, Fox, Horse, Zebra} The Englishman lives in the Red house The Spaniard has a Dog The Japanese is a Painter The Italian drinks Tea The Norwegian lives in the first house on the left The owner of the Green house drinks Coffee The Green house is on the right of the White house The Sculptor breeds Snails The Diplomat lives in the Yellow house The owner of the middle house drinks Milk The Norwegian lives next door to the Blue house The Violonist drinks Fruit juice The Fox is in the house next to the Doctor’s The Horse is next to the Diplomat’s Who owns the Zebra? Who drinks Water?

Constraint Satisfaction Problems13 Example: Task Scheduling T1 must be done during T3 T2 must be achieved before T1 starts T2 must overlap with T3 T4 must start after T1 is complete Are the constraints compatible? Find the temporal relation between every two tasks T1 T2 T3 T4

Constraint Satisfaction Problems14 Finite vs. Infinite CSP Finite domains of values  finite CSP Infinite domains  infinite CSP (particular case: linear programming)

Constraint Satisfaction Problems15 Finite vs. Infinite CSP Finite domains of values  finite CSP Infinite domains  infinite CSP We will only consider finite CSP

Constraint Satisfaction Problems16 Constraint Graph Binary constraints T WA NT SA Q NSW V Two variables are adjacent or neighbors if they are connected by an edge or an arc T1 T2 T3 T4

Constraint Satisfaction Problems17 CSP as a Search Problem Initial state: empty assignment Successor function: a value is assigned to any unassigned variable, which does not conflict with the currently assigned variables Goal test: the assignment is complete Path cost: irrelevant

Constraint Satisfaction Problems18 CSP as a Search Problem Initial state: empty assignment Successor function: a value is assigned to any unassigned variable, which does not conflict with the currently assigned variables Goal test: the assignment is complete Path cost: irrelevant n variables of domain size d  O(d n ) distinct complete assignments

Constraint Satisfaction Problems19 Remark Finite CSP include 3SAT as a special case (see class on logic) 3SAT is known to be NP-complete So, in the worst-case, we cannot expect to solve a finite CSP in less than exponential time

Constraint Satisfaction Problems20 Commutativity of CSP The order in which values are assigned to variables is irrelevant to the final assignment, hence: 1. Generate successors of a node by considering assignments for only one variable 2. Do not store the path to node

Constraint Satisfaction Problems21  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {}

Constraint Satisfaction Problems22  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11)}

Constraint Satisfaction Problems23  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11),(var2=v21)}

Constraint Satisfaction Problems24  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11),(var2=v21),(var3=v31)}

Constraint Satisfaction Problems25  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11),(var2=v21),(var3=v32)}

Constraint Satisfaction Problems26  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11),(var2=v22)}

Constraint Satisfaction Problems27  Backtracking Search empty assignment 1 st variable 2 nd variable 3 rd variable Assignment = {(var1=v11),(var2=v22),(var3=v31)}

Constraint Satisfaction Problems28 Backtracking Algorithm CSP-BACKTRACKING({}) CSP-BACKTRACKING(a) If a is complete then return a X  select unassigned variable D  select an ordering for the domain of X For each value v in D do  If v is consistent with a then Add (X= v) to a result  CSP-BACKTRACKING(a) If result  failure then return result Return failure partial assignment of variables

Constraint Satisfaction Problems29 Map Coloring {} WA=redWA=greenWA=blue WA=red NT=green WA=red NT=blue WA=red NT=green Q=red WA=red NT=green Q=blue WA NT SA Q NSW V T

Constraint Satisfaction Problems30 Questions 1. Which variable X should be assigned a value next? 2. In which order should its domain D be sorted?

Constraint Satisfaction Problems31 Questions 1. Which variable X should be assigned a value next? 2. In which order should its domain D be sorted? 3. What are the implications of a partial assignment for yet unassigned variables? (  Constraint Propagation -- see next class)

Constraint Satisfaction Problems32 Choice of Variable Map coloring WA NT SA Q NSW V T WA NTSA

Constraint Satisfaction Problems33 Choice of Variable 8-queen

Constraint Satisfaction Problems34 Choice of Variable Most-constrained-variable heuristic: Select a variable with the fewest remaining values

Constraint Satisfaction Problems35 Choice of Variable Most-constraining-variable heuristic: Select the variable that is involved in the largest number of constraints on other unassigned variables WA NT SA Q NSW V T SA

Constraint Satisfaction Problems36 {} Choice of Value WA NT SA Q NSW V T WA NT

Constraint Satisfaction Problems37 Choice of Value Least-constraining-value heuristic: Prefer the value that leaves the largest subset of legal values for other unassigned variables {blue} WA NT SA Q NSW V T WA NT

Constraint Satisfaction Problems38 Local Search for CSP Pick initial complete assignment (at random) Repeat Pick a conflicted variable var (at random) Set the new value of var to minimize the number of conflicts If the new assignment is not conflicting then return it (min-conflicts heuristics)

Constraint Satisfaction Problems39 Remark Local search with min-conflict heuristic works extremely well for million-queen problems The reason: Solutions are densely distributed in the O(n n ) space, which means that on the average a solution is a few steps away from a randomly picked assignment

Constraint Satisfaction Problems40 Applications CSP techniques allow solving very complex problems Numerous applications, e.g.: Crew assignments to flights Management of transportation fleet Flight/rail schedules Task scheduling in port operations Design Brain surgery

Constraint Satisfaction Problems41 Stereotaxic Brain Surgery

Constraint Satisfaction Problems42 Stereotaxic Brain Surgery 2000 < Tumor < < B2 + B4 < < B4 < < B3 + B4 < < B3 < < B1 + B3 + B4 < < B1 + B4 < < B1 + B2 + B4 < < B1 < < B1 + B2 < < Critical < < B2 < 500 T C B1 B2 B3 B4 T

Constraint Satisfaction Problems43  Constraint Programming “Constraint programming represents one of the closest approaches computer science has yet made to the Holy Grail of programming: the user states the problem, the computer solves it.” Eugene C. Freuder, Constraints, April 1997

Constraint Satisfaction Problems44 Additional References  Surveys: Kumar, AAAI Mag., 1992; Dechter and Frost, 1999  Text: Marriott and Stuckey, 1998; Russell and Norvig, 2 nd ed.  Applications: Freuder and Mackworth, 1994  Conference series: Principles and Practice of Constraint Programming (CP)  Journal: Constraints (Kluwer Academic Publishers)  Internet  Constraints Archive

Constraint Satisfaction Problems45 Summary Constraint Satisfaction Problems (CSP) CSP as a search problem Backtracking algorithm General heuristics Local search technique Structure of CSP Constraint programming