Constraint satisfaction problems

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: CSP Introduction and Backtracking Search
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)
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?
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
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.
CSPs Tamara Berg CS 560 Artificial Intelligence Many slides throughout the course adapted from Svetlana Lazebnik, Dan Klein, Stuart Russell, Andrew Moore,
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.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
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.
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
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.
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.
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
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 (Chapter 6)
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Advanced Artificial Intelligence
CS 188: Artificial Intelligence
Constraint Satisfaction Problems
Constraint Satisfaction Problems
CS 188: Artificial Intelligence Spring 2006
Constraint Satisfaction Problems
Artificial Intelligence
Constraint Satisfaction Problems
CSP Warm-up Assign Red, Green, or Blue
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Constraint satisfaction problems Lirong Xia Spring, 2017

Project 1 You can use Windows Read the instruction carefully, make sure you understand the goal search for “YOUR CODE HERE” Ask and answer questions on Piazza we may give bonus score to insightful answers Please be careful about spoilers State (in the search graph) vs. node (in the search tree) add node in the search tree to fringe add state to the visited sets

Today’s schedule Constraint satisfaction problems Algorithms backtracking search filtering forward checking constraint propagation

Constraint Satisfaction Problems Standard search problems: State is a “black box”: arbitrary data structure Goal test: any function over states Successor function can be anything Constraint satisfaction problems (CSPs): A special subset of search problems State is defined by variables Xi with values from a domain D (sometimes D depends on i ) Goal test is a set of constraints specifying allowable combinations of values for subsets of variables Allows useful general-purpose algorithms with more power than standard search algorithms

Example: Map-Coloring Variables: WA, NT, Q, NSW, V, SA, T Domains: Constraints: adjacent regions must have different colors Solutions are assignments satisfying all constraints, e.g.:

Example: N-Queens Formulation 1: Variables: Domains: Constraints

Example: N-Queens Formulation 2: Variables: Domains: Constraints Q1 Q2 Implicit: -or- Explicit:

Constraint Graphs: Goal test Binary CSP: each constraint relates (at most) two variables Binary constraint graph: nodes are variables, arcs show constraints General-purpose CSP algorithms use the graph structure to speed up search. E.g., Tasmania is an independent subproblem!

Example: Cryptarithmetic Variables (circles): Domains: Constraints (boxes):

Example: Sudoku Variables: Each (open) square Domains: Constraints:

Varieties of CSPs Discrete Variables: Continuous variables: Finite domains Size d means O(dn) complete assignments E.g., Boolean CSPs, including Boolean satisfiability (NP- complete) Infinite domains (integers, strings, etc.) Linear constraints solvable Continuous variables: Linear constraints solvable in polynomial time by LP methods

Varieties of Constraints Variables of Constraints Unary constraints involve a single variable (equiv. to shrinking domains): Binary constraints involve pairs of variables: Higher-order constraints involve 3 or more variables: e.g., cryptarithmetic column constraints Preferences (soft constraints): E.g., red is better than green Often representable by a cost for each variable assignment Gives constrained optimization problems

Standard Search Formulation Standard search formulation of CSPs (incremental) Let’s start with the straightforward, dumb approach, then fix it States are defined by the values assigned so far Initial state; the empty assignment, Successor function: assign a value to an unassigned variable Goal test: the current assignment is complete and satisfies all constraint

Search Methods What would BFS do? What would DFS do? Is BFS better or DFS better? Can we use A*?

Early detection of non-Goal

Backtracking Search Idea 1: only consider a single variable at each point Variable assignments are commutative, so fix ordering I.e., [WA = red then NT = green] same as [NT = green then WA = red] Only need to consider assignments to a single variable at each step Idea 2: only allow legal assignments at each point “Incremental goal test” DFS for CSPs with these two improvements is called backtracking search Backtracking search is the basic uninformed algorithm for CSPs Can solve n-queens for

Backtracking Example

Improving Backtracking Ordering: Which variable should be assigned next? In what order should its values be tried? Filtering: Can we detect inevitable failure early?

Minimum Remaining Values Minimum remaining values (MRV): Choose the variable with the fewest legal values Why min rather than max? Also called “most constrained variable” “Fail-fast” ordering

Example For every variable, keep track of which values are still possible Q X Q X Q done! (no real branching needed!) only one possibility for last column; might as well fill in now only one left for other two columns

Choosing a value Given a choice of variable: Choose the least constraining value The one that rules out the fewest values in the remaining variables May take some computation to determine this! Why least rather than most? value 1 for SA value 0 for SA

Filtering: Forward Checking Idea: keep track of remaining values for unassigned variables (using immediate constraints) Idea: terminate when any variable has no legal values

Filtering: Constraint Propagating Forward checking propagates information from assigned to unassigned variables, but doesn’t provide early detection for all failures: NT and SA cannot both be blue! Why didn’t we detect this yet? step 1 step 2 step 1 step 2

Consistency of An Arc An arc is consistent iff for every x in the tail there is some y in the head which could be assigned without violating a constraint Forward checking = Enforcing consistency of each arc pointing to the new assignment Delete from tail!

Arc Consistency of a CSP A simple form of propagation makes sure all arcs are consistent: If V loses a value, neighbors of V need to be rechecked! Arc consistency detects failure earlier than forward checking Can be run as a preprocessor or after each assignment Might be time-consuming Delete from tail! X X X