Chapter 5 Outline Formal definition of CSP CSP Examples

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems Russell and Norvig: Chapter
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
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?
Lecture 5: Constraint Satisfaction
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.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
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.
CAP 492 Course Dr. Souham Meshoul 1 CONSTRAINT SATISFACTION PROBLEMS Chapter 5.
Constraint Satisfaction Problems
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.
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
CSPs Tamara Berg CS Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew.
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.
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.
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.
1 Chapter 5 Constraint Satisfaction Problems. 2 Outlines  Constraint Satisfaction Problems  Backtracking Search for CSPs  Local Search for CSP  The.
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.
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
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.
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.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
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
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
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:

Chapter 5 Outline Formal definition of CSP CSP Examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs

Constraint Satisfaction Problems World state: well defined set of variables Vi with domain Di Goal test: satisfy a set of constraints that specify allowable combinations of values for subsets of variables Depth first search appropriate – path doesn’t matter, only goal state, maximum depth fixed at n, the number of variables, select 1 variable to branch on at each level of the tree Backtracking: once a constraint is violated there is no point looking further Forward checking: reduce branching factor by “shrinking” domains of un-set variables to reflect constraints imposed by already set variables. Backtrack if any un-set variables domain is empty

Formal Definition: CSP Constraint Satisfaction Problem (CSP) Set of Variables: X1, X2, X3, … Xn Each Xi has a non-empty domain Di of possible values, vi. Set of Constraints: C1, C2, … Cn Each Ci has a subset of variables specifying the combination of vi’s.

Constraint Satisfaction Problems A problem state or assignment is represented by: {Xi = vi, Xj = vi, ...} An assignment is consistent if no constraints are violated. Constraint Graph Nodes represent variables Arcs represent constraints

Simple CSPs CSPs with discrete variables and finite domains. Map-coloring (graph coloring) SAT (3SAT) (NP-Complete) N-Queens

Question Any CSP can be reformulated into the standard notation (Set of Variables: X1, X2, X3, … Xn, Set of Constraints: C1, C2, … Cn, Bla bla) Why would we do that? Successor and goal test can be written in a generic way. Can develop generic heuristics that work for all CSPs. Structure of constraint graph can be taken advantage of to simplify solution process – exponentially for some cases.

CSP Example Graph coloring is a good example of a CSP. Graphs are also good for representing constraints! Assume we can use the colors {red, blue, yellow} Can we color the graph such that each adjacent node has a different color? Let’s choose blue for X1? X1 X2 What if we connect X5 to X2? What color can we choose for X2? X3 X5 Now what can we choose for X3? Does it matter what color we choose for X4? X4 What about X5?

CSP Example What happens if we only have two colors {red, blue}? Does adding the link between X2 and X5 change the problem? X1 X2 X3 X5 X4

Types of Constraints Unary Constraint Binary Constraint Constrains the value of a single variable. Binary Constraint Relates two variables. N-ary Constraint Relates multiple variables. Preference Constraint Indicate preferred solutions. Objective Function – maximize/minimize

More complex CSPs Discrete variables with infinite domains. For example, a set of integers. Characteristic of such problems Cannot enumerate all variable combinations. Requires a constraint language. Continuous Domains Example, linear progamming. No algorithm for general nonlinear constraints on integer variables

CSP Search Approach: Backtracking A depth-first search that chooses values for one variable at a time and backtracks when a variable has no legal values left to assign is a backtracking search.

Questions to address Which variable should we choose for assignment? What order should we assign values? What are the implications of the current variable assignments on the other unassigned variables? When a path fails, how do we avoid repeating the failure on subsequent paths?

Which variable to assign? Standard backtracking uses some arbitrary/fixed ordering and simply assigns the next available variable. It is rare that this is efficient. Is there a way to chose the variable with the fewest “legal” values?

Which variable to assign? Minimum remaining values (MRV) Simply select the variable with the fewest “legal” values. If a variable has no legal values, then MRV selects the variable and the failure is immediately detected. Can be implemented by changing the selection criteria of backtracking search.

Which variable to assign? MRV is useful if you have already started the search. But how is the first variable chosen? Degree Heuristic Choose the variable involved with the largest number of constraints with other unassigned variables. Can also be used as a tie-breaker in all other situations.

Which variable to assign? Degree Heuristic X1 X2 Which Variable has the largest number of constraints? X3 X5 X4

Choosing a value to assign Chose the value that rules out the fewest choices for the neighboring variables in the constraint graph. (Least-Constraining-Value) Attempts to provide maximum flexibility for remaining variable assignments

What are the implications of an assignment? Can we reduce the search space by looking at constraints earlier in the search process? Forward Checking Constraint Propagation

Forward Checking When variable X is assigned, check each unassigned variable Y connected to X by a constraint. Delete from Y’s domain any value that is inconsistent with the value assigned to X.

Constraint Propagation Propagate the implications of a constraint on one variable onto other variables. Must be able to do this quickly. Why?

Arc Consistency Requires a directed arc in the consistency graph. Provides early detection of inconsistencies. Must be applied repeatedly to detect ALL constraints.

Arc Consistency Check Algorithm AC3(CSP, queue) while(!queue.empty()) (xi, xj) = queue.dequeue() if(removeInconsistantValues(xi, xj) for each xk in neighbors[xi] queue.add(xk, xj) removeInconsistantValues(xi, xj) removed = false for each v  domain[xi] if !(w)((v,w) satisfies constraint (xi, xj)) domain[xi] = domain[xi] – v removed=true return removed

K-Consistency A CSP is k-consistent if for any set of k – 1 variables and for any constraint assignment to those variables, a consistent value can always be assigned to any kth value.

K-Consistency Node Consistency (1-Consistency) Each individual variable is consistent. 2-Consistency = arc consistency Path Consistency (3-Consistency) Any pair of adjacent variables can always be extended to a third neighboring variable. Stronger consistency checks require more processing time but reduce the branching factor and detection of inconsistencies.

Special Constraints AllDiff – All variables must have distinct values. To satisfy this constraint for m variables and n values, n >= m. Why? Resource (atmost) constraint Define an atmost constraint value and then add the minimum values of the current domains. The sum must be less than or equal to the constraint value.

How is repeating failures avoided? Chronological backtracking Backs up to the most recent decision point and tries a different value for it.

Chronological Backtracking X1 X2 X3 X5 Simple backtracking takes us to X5. What happens? X4 Back up to the conflict set The variables that caused the problem. Typically the set for X is the set of previously assigned variables connected to X by constraints.

Backjumping Backtracks to the most recent variable in the conflict set. Every branch pruned by backjumping is also pruned by forward checking.

Conflict-directed backjumping Modify backjumping to use conflict sets that include not only the variables with a direct conflict but also any subsequent variables with no consistent solution. Look backwards and expand the conflict set.

Conflict-Directed Backjumping Let Xj be the current variable, and let conf(Xj) be its conflict set. If every possible value for Xj fails, backjump to the most recent variable Xi in conf (Xj), and set conf (Xi) conf(Xi) conf(Xj) – {Xi}. Does this stop us from making the same mistake in another branch of the same tree?

Local Search Section 4.3 discussed local search algorithms. Can be quite effective for CSP. Fairly efficient Can be used on-line when a problem changes.