CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.

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
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.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
1 Constraint Satisfaction Problems Soup Total Cost < $30 Chicken Dish Vegetable RiceSeafood Pork Dish Appetizer Must be Hot&Sour No Peanuts No Peanuts.
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.
Variables “To be is to be the value of a variable.” - William Quine.
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.
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.
1 Constraint Satisfaction Problems Soup Total Cost < $30 Chicken Dish Vegetable RiceSeafood Pork Dish Appetizer Must be Hot&Sour No Peanuts No Peanuts.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
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
CSE 473: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer.
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.
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
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
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 (Chapter 6)
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Advanced Artificial Intelligence
CSCI 5582 Artificial Intelligence
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Artificial Intelligence
Constraint Satisfaction Problems
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:

CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin

CSCI 5582 Fall 2006 Today 9/14 Constraint Sat Problems Admin/Break Constraint Sat as Iterative Improvement

CSCI 5582 Fall 2006 Search Types Backtracking State-Space Search Optimization-Style Search Constraint Satisfaction Search

CSCI 5582 Fall 2006 Constraint Satisfaction In CSP problems, states are represented as sets of variables, each with values chosen from some domain A goal test consists of satisfying constraints on sets of variable/value combinations A goal state is one that has no constraint violations

CSCI 5582 Fall 2006 Examples Simple puzzles Graph coloring Scheduling problems Any constrained resource problem

CSCI 5582 Fall 2006 N-Queens Place N queens on a chess board such that no queen is under attack from any other queen.

CSCI 5582 Fall Queen Example Assume a 4x4 board Assume one queen per column 4 Variables (Q1, Q2, Q3, Q4) 4 possible values (1,2,3,4) Constraints…

CSCI 5582 Fall 2006 Constraints V(Q i ) ≠ V(Q k ) –Can’t be in the same row |V(Q i ) – V(Q k )| ≠ |i – k| –or the same diagonal

CSCI 5582 Fall 2006 Example: Map-Coloring Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)}

CSCI 5582 Fall 2006 Example: Map-Coloring Solutions are complete and consistent assignments, e.g., WA = red, NT = green,Q = red,NSW = green,V = red,SA = blue,T = green

CSCI 5582 Fall 2006 Constraint graph Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs are constraints

CSCI 5582 Fall 2006 Varieties of constraints Unary constraints involve a single variable, –e.g., SA ≠ green Binary constraints involve pairs of variables, –e.g., SA ≠ WA Higher-order constraints involve 3 or more variables, –e.g., cryptarithmetic column constraints

CSCI 5582 Fall 2006 Approaches to CSPs As a kind of backtracking search –Uninformed or informed As a kind of iterative improvement

CSCI 5582 Fall 2006 CSP as Backtracking (Dumb) Start state has no variables assigned Assign a variable at each step Apply goal test to completed states Where are solutions found? What kind of (dumb) search might be applicable?

CSCI 5582 Fall 2006 Less Dumb What it means to be a goal (or not) can be decomposed What the heck does that mean? –In CSPs a state is a goal state if all of the constraints are satisfied. –A state fails as a goal state if any constraint is violated –So…

CSCI 5582 Fall 2006 Less Dumb Check to see if any constraints are violated as variables are assigned values. This is backward checking since you’re checking to see if the current assignment conflicts with any past assignment

CSCI 5582 Fall 2006 Standard search formulation (incremental) Let's start with the straightforward 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 that does not conflict with current assignment  fail if no legal assignments Goal test: the current assignment is complete 1.This is the same for all CSPs 2.Every solution appears at depth n with n variables  use depth-first search 3.Path is irrelevant, so can also use complete-state formulation

CSCI 5582 Fall 2006 Backtracking search Variable assignments are commutative}, 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 node Depth-first search for CSPs with single-variable assignments is called backtracking search Backtracking search is the basic uninformed algorithm for CSPs Can solve n-queens for n ≈ 25

CSCI 5582 Fall 2006 Backtracking search

CSCI 5582 Fall 2006 Backtracking example

CSCI 5582 Fall 2006 Backtracking example

CSCI 5582 Fall 2006 Backtracking example

CSCI 5582 Fall 2006 Backtracking example

CSCI 5582 Fall 2006 Even Better Add forward checking –When you assign a variable check to see if it still allows future assignments to the remaining variables Using forward checking and backward checking roughly doubles the size of N-queens problems that can be practically solved (from 15 to 30).

CSCI 5582 Fall 2006 Forward checking Idea: –Keep track of remaining legal values for unassigned variables –Terminate search when any variable has no legal values

CSCI 5582 Fall 2006 Forward checking Idea: –Keep track of remaining legal values for unassigned variables –Terminate search when any variable has no legal values

CSCI 5582 Fall 2006 Forward checking Idea: –Keep track of remaining legal values for unassigned variables –Terminate search when any variable has no legal values

CSCI 5582 Fall 2006 Forward checking Idea: –Keep track of remaining legal values for unassigned variables –Terminate search when any variable has no legal values

CSCI 5582 Fall 2006 Constraint propagation Forward checking propagates information from assigned to unassigned variables, but doesn't provide early detection for all failures: At this point all variables have possible values. But NT and SA cannot both be blue! Backtracking should occur here, not at the next step.

CSCI 5582 Fall 2006 Arc consistency Simplest form of propagation makes each arc consistent X  Y is consistent iff For every value x for X there is some allowed value y for Y

CSCI 5582 Fall 2006 Arc Consistency Simplest form of propagation makes each arc consistent X  Y is consistent iff for every value x of X there is some allowed y for Y

CSCI 5582 Fall 2006 Arc consistency Simplest form of propagation makes each arc consistent X  Y is consistent iff for every value x of X there is some allowed y If X loses a value, neighbors of X need to be rechecked

CSCI 5582 Fall 2006 Arc consistency Simplest form of propagation makes each arc consistent X  Y is consistent iff for every value x of X there is some allowed y If X loses a value, neighbors of X need to be rechecked Arc consistency detects failure earlier than forward checking Can be run as a preprocessor or after each assignment

CSCI 5582 Fall 2006 Informed Backtracking CSP Search The previous discussion didn’t use any notion of heuristic. There are two places heuristics can help –Which variable to assign next –Which value to assign to a variable

CSCI 5582 Fall 2006 Minimum Remaining Values The variable with the min remaining values is the most constrained variable:

CSCI 5582 Fall 2006 Degree Heuristic Tie-breaker among most constrained variables (or at the start). Most constraining variable: –choose the variable with the most constraints on remaining variables

CSCI 5582 Fall 2006 Least constraining value Given a variable, choose the least constraining value: –The one that rules out the fewest values in the remaining variables Combining these heuristics makes 1000 N-queen puzzles feasible

CSCI 5582 Fall 2006 Admin/Break Questions?

CSCI 5582 Fall 2006 Iterative Improvement CSPs permit a complete-state framework Sometimes it’s better to look at these problems as optimization problems. Where you want to optimize (minimize) the number of constraints violated (to zero would be good)

CSCI 5582 Fall 2006 How? Randomly assign values to all the variables in the problem (from their domains) Iteratively fix the variables (reassign values) that are conflicted. Continue until there are no conflicts or no progress

CSCI 5582 Fall 2006 Min Conflict Heuristic Randomly choose a variable from among the problematic ones. Reassign its value to be the one that results in the fewest conflicts overall Continue until there are no conflicts

CSCI 5582 Fall 2006 Min Conflict Example States: 4 Queens, 1 per column Operators: Move queen in its column Goal test: No attacks Evaluation metric: Total number of attacks

CSCI 5582 Fall 2006 Min Conflict Performance Amazing factoid: Min Conflict often has astounding performance. For example, it’s been shown to solve arbitrary size (in the millions) N-Queens problems in constant time. This appears to hold for arbitrary CSPs with the caveat…

CSCI 5582 Fall 2006 Min Conflict Performance Except in a certain critical range of the ratio constraints to variables.

CSCI 5582 Fall 2006 Search Review Backtracking search Optimization search Constraint sat search

CSCI 5582 Fall 2006 Next Time On to game playing Read Chapter 6