1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Patrick Prosser. An Example, Exam Timetabling Someone timetables the exams We have a number of courses to examine how many? Dept.
Constraint Satisfaction Problems Russell and Norvig: Chapter
Constraint Satisfaction Problems
Constraint Satisfaction
Constraint Satisfaction Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.
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
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
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)
Constraint Satisfaction Problems. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Constraint Satisfaction
Constraint Satisfaction Problems
CS460 Fall 2013 Lecture 4 Constraint Satisfaction Problems.
Constraint Satisfaction
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems
Constraint Satisfaction Problems
1 Constraint Satisfaction and Backtrack Search 22c:31 Algorithms.
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Constraint Satisfaction Basics strongly influenced by Rina Dechter, “Constraint Processing”, 2003.
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.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
CMSC 471 Spring 2014 Class #7 Postponed due to snow day Class #8 Tue 2/18/14 Thu 2/20/14 Constraint Satisfaction Professor Marie desJardins,
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
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.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
Constraint Satisfaction Russell & Norvig Ch. 5. Overview Constraint satisfaction offers a powerful problem- solving paradigm –View a problem as a set.
Constraint Satisfaction Basics strongly influenced by Dr. Rina Dechter: “Constraint Processing”
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.
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
Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
G51IAI Introduction to Artificial Intelligence
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
BIL 472 SADI EVREN SEKER Constraint Satisfaction.
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.
Constraint Satisfaction Problems/Programming ZUI 2012/2013.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
Class #7 – Thursday, September 23
Constraint Satisfaction Problems Lecture # 14, 15 & 16
CS 188: Artificial Intelligence
CSP Search Techniques Backtracking Forward checking
Constraint Satisfaction Problems
Artificial Intelligence
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18

2 Today’s class Constraint Processing / Constraint Satisfaction Problem (CSP) paradigm Algorithms for CSPs –Backtracking (systematic search) –Constraint propagation (k-consistency) –Variable ordering heuristics –Backjumping and dependency-directed backtracking Viewing scheduling as a CSP

3 Constraint Processing Russell & Norvig 3.7, 4.2 end,

4 Overview Constraint Processing offers a powerful problem-solving paradigm –View a problem as a set of variables to which we have to assign values that satisfy a number of problem-specific constraints. –Constraint programming, CSPs, constraint logic programming… Algorithms for CSPs –Backtracking (systematic search) –Constraint propagation (k-consistency) –Variable ordering heuristics –Backjumping and dependency-directed backtracking

5 Informal Definition of CSP CSP = Constraint Satisfaction Problem Given (1) a finite set of variables (2) each with a domain of possible values (often finite) (3) a set of constraints that limit the values the variables can take on A solution is an assignment of a value to each variable such that the constraints are all satisfied. Tasks might be to decide if a solution exists, to find a solution, to find all solutions, or to find the “best solution” according to some metric.

6 Informal Example: Map Coloring Color the following map using three colors (red, green, blue) such that no two adjacent regions have the same color. E DA C B

7 Informal Example: Map Coloring Variables: A, B, C, D, E all of domain RGB Domains: RGB = {red, green, blue} Constraints: A  B, A  C,A  E, A  D, B  C, C  D, D  E One solution: A=red, B=green, C=blue, D=green, E=blue E DA C B E DA C B =>

8 Example: SATisfiability Given a set of propositions containing variables, find an assignment of the variables to {false,true} that satisfies them. Example, the clauses: –A or B or ~C, ~A or D –(equivalent to C -> A or B, D -> A) Are satisfied by A = false B = true C = false D = false

9 Real-world problems Scheduling Temporal reasoning Building design Planning Optimization/satisfaction Vision Graph layout Network management Natural language processing Molecular biology / genomics VLSI design

10 Formal definition of a constraint network (CN) A constraint network (CN) consists of a set of variables X = {x 1, x 2, … x n } –each with an associated domain of values {d 1, d 2, … d n }. –The domains are typically finite a set of constraints {c 1, c 2 … c m } where –each constraint defines a predicate which is a relation over a particular subset of X. –E.g., C i involves variables {X i1, X i2, … X ik } and defines the relation R i  D i1 x D i2 x … D ik Unary constraint: only involves one variable Binary constraint: only involves two variables

11 Formal definition of a CN (cont.) Instantiations –An instantiation of a subset of variables S is an assignment of a legal domain value to each variable in in S –An instantiation is legal iff it does not violate any (relevant) constraints. A solution is an instantiation of all of the variables in the network.

12 Typical Tasks for CSP Solutions: –Does a solution exist? –Find one solution –Find all solutions –Given a partial instantiation, do any of the above Transform the CN into an equivalent CN that is easier to solve.

13 Binary CSP A binary CSP is a CSP in which all of the constraints are binary or unary. Any non-binary CSP can be converted into a binary CSP by introducing additional variables. A binary CSP can be represented as a constraint graph, which has a node for each variable and an arc between two nodes if and only there is a constraint involving the two variables. –Unary constraint appears as self-referential arc

14 Example: Crossword Puzzle

15 Running Example: XWORD Puzzle Variables and their domains –X1 is 1 acrossD1 is 5-letter words –X2 is 2 downD2 is 4-letter words –X3 is 3 downD3 is 3-letter words –X4 is 4 acrossD4 is 4-letter words –X5 is 5 acrossD5 is 2-letter words Constraints (implicit/intensional) –C12 is “the 3rd letter of X1 must equal the 1st letter of X2” –C13 is “the 5th letter of X1 must equal the 1st letter of X3”. –C24 is … –C25 is … –C34 is...

Variables: X1 X2 X3 X4 X5 Domains: D1 = {hoses, laser, sheet, snail,steer} D2 = {hike, aron, keet, earn, same} D3 = {run, sun, let, yes, eat, ten} D4 = {hike, aron, keet, earn, same} D5 = {no, be, us, it} Constraints (explicit/extensional): C12 = {(hoses,same), (laser,same), (sheet,earn), (steer,earn)} C13 =... X1 X4 X5 X2 X3

17 Solving Constraint Problems Systematic search –Generate and test –Backtracking Constraint propagation (consistency) Variable ordering heuristics Backjumping and dependency-directed backtracking

18 Generate and test: XWORD Try each possible combination until you find one that works: –Hoses – hike – run – hike – no –Hoses – hike – run – hike – be –Hoses – hike – run – hike – us Doesn’t check constraints until all variables have been instantiated Very inefficient way to explore the space of possibilities

19 Systematic search: Backtracking (a.k.a. depth-first search) Consider the variables in some order Pick an unassigned variable and give it a provisional value such that it is consistent with all of the constraints If no such assignment can be made, we’ve reached a dead end and need to backtrack to the previous variable Continue this process until a solution is found or we backtrack to the initial variable and have exhausted all possible vlaues

20 Backtracking: XWORD  X1=hosesX1=laser X2=aron X2=same X2=hike … … … X3=run X3=sunX3=let X4=hike X4=same … hoses u n a m e

21 Problems with backtracking Thrashing: keep repeating the same failed variable assignments –Consistency checking can help –Intelligent backtracking schemes can also help Inefficiency: can explore areas of the search space that aren’t likely to succeed –Variable ordering can help

22 Consistency Node consistency –A node X is node-consistent if every value in the domain of X is consistent with X’s unary constraints –A graph is node-consistent if all nodes are node-consistent Arc consistency –An arc (X, Y) is arc-consistent if, for every value x of X, there is a value y for Y that satisfies the constraint represented by the arc. –A graph is arc-consistent if all arcs are arc-consistent To create arc consistency, we perform constraint propagation: that is, we repeatedly reduce the domain of each variable to be consistent with its arcs

23 Constraint propagation: XWORD example X1 X2X4 hoses laser sheet snail steer hike aron keet earn same hike aron keet earn same

24 K-consistency K- consistency generalizes the notion of arc consistency to sets of more than two variables. –A graph is K-consistent if, for legal values of any K-1 variables in the graph, and for any Kth variable V k, there is a legal value for V k Strong K-consistency = J-consistency for all J<=K Node consistency = strong 1-consistency Arc consistency = strong 2-consistency Path consistency = strong 3-consistency

25 Why do we care? 1.If we have a CSP with N variables that is known to be strongly N-consistent, we can solve it without backtracking 2.For any CSP that is strongly K- consistent, if we find an appropriate variable ordering (one with “small enough” branching factor), we can solve the CSP without backtracking

26 Improving Backtracking Use other search techniques: uniform cost, A*, … Variable ordering can help improve backtracking. Typical heuristics: –P refer variables which maximally constrain the rest of the search space –When picking a value, choose the least constraining value Smarter backtracking: Backjumping, backmarking, dependency-directed backtracking