Lecture 7 Constraint Satisfaction Problems

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Constraint Satisfaction Problems (Chapter 6). What is search for? Assumptions: single agent, deterministic, fully observable, discrete environment Search.
Constraint Satisfaction Problems
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.
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?
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction and the Davis-Putnam-Logeman-Loveland Procedure Henry Kautz.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Constraint Satisfaction Problems
CS460 Fall 2013 Lecture 4 Constraint Satisfaction Problems.
Problem Spaces & Search CSE 473. © Daniel S. Weld Topics Agents & Environments Problem Spaces Search & Constraint Satisfaction Knowledge Repr’n.
Constraint Satisfaction
Constraint Satisfaction Problems
Constraint Satisfaction Problems
Constraint Satisfaction Problems
1 Constraint Satisfaction Problems Slides by Prof WELLING.
CS 484 – Artificial Intelligence1 Announcements Homework 2 due today Lab 1 due Thursday, 9/20 Homework 3 has been posted Autumn – Current Event Tuesday.
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.
1 CSE 4705 Artificial Intelligence Jinbo Bi Department of Computer Science & Engineering
Searching by Constraint CMSC Artificial Intelligence January 24, 2008.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
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.
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
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 Propagation Artificial Intelligence CMSC January 22, 2002.
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.
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)
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Class #7 – Thursday, September 23
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
ECE 448, Lecture 7: Constraint Satisfaction Problems
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction
CSE 473 Artificial Intelligence Oren Etzioni
Instructor: Vincent Conitzer
Advanced Artificial Intelligence
CS 188: Artificial Intelligence
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Satisfaction Problems
Constraint Propagation
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
Chapter 5. Advanced Search
Constraint Satisfaction
CS 188: Artificial Intelligence Fall 2007
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Lecture 7 Constraint Satisfaction Problems CSE 573 Artificial Intelligence I Henry Kautz Fall 2001

But first… Why is driving to Spokane like playing Backgammon? States = cities Start state = starting city Goal state test = is state the destination city? Operators = move to an adjacent city; cost = distance Output: a shortest path from start state to goal state SUPPOSE WE REVERSE START AND GOAL STATES?

Backtracking Constraint Satisfaction Algorithms Roadmap Tree Search (guessing) BFS DFS Iterative Deepening Bidirectional Best-first search A* Game tree Davis-Putnam (logic) Cutset conditioning (probability) Inference (simplifying) Forward Checking Path Consistency (Waltz labeling, temporal algebra) Resolution “Bucket Algorithm” Iterative improvement (wandering) Hillclimbing (gradient descent) Walksat & Simulated annealing Genetic algorithms Monte-Carlo Methods Backtracking Constraint Satisfaction Algorithms Today we are going to start talking about a inference method

Map Coloring We want to color map with 3 (RED, BLUE, GREEN) colors using DFS. Suppose we color Spain RED, then try France, RED, and so on for every country. Eventually we reach a leaf, apply the test for a goal state, and start backing up. What’s wrong? But how to make the COMPUTER notice that? Must make constraint that no adjacent states same color DECLARATIVE so that computer can reason about it. ALSO: if Spain RED, France BLUE, France MUST BE GREEN! Want to INFER this fact!

CSP V is a set of variables v1, v2, …, vn D is a set of finite domains D1, D2, …, Dn C is a set of constraints C1, C2, …, Cm Each constraint specifies a restriction over joint values of a subset of the varibles E.g.: v1 is Spain, v2 is France, v3 is Germany, … Di = { Red, Blue, Green} for all i For each adjacent vi, vj there is a constraint Ck (vi,vj) in { (R,G), (R,B), (G,R), (G,B), (B,R), (B,G) } Important special case: Discrete Binary CSP

Variations Find a solution that satisfies all constraints Find all solutions Find a “tightest form” for each constraint (v1,v2) in { (R,G), (R,B), (G,R), (G,B), (B,R), (B,G) }  (v1,v2) in { (R,G), (R,B), (B,G) } Find a solution that minimizes some additional objective function Note: in general path length to solution is not important!

Exploiting CSP Structure Interleave inference and search At each internal node: Select unassigned variable Select a value in domain Backtracking: try another value Branching factor? How to best select a variable? At each node: Propagate Constraints Branching factor is number of possible values for the chosen variable. Thus: to minimize branching factor, choose a variable with the smallest domain! MOST constrained variable heuristic! We will see other good reasons for this!

Running Example: 4 Queens Variables: Constraints: Q VARIABLES: one for each COLUMN, which ROW that queen appears in Q1 in { 1, 2, 3, 4 } Q2 in { 1, 2, 3, 4 } CONSTRAINTS: Non-attacking relationship SEE NEXT SLIDE

Running Example: 4 Queens Variables: Q1 in {1,2,3,4} Q2 in {1,2,3,4} Q3 in {1,2,3,4} Constraints: Q1 Q2 1 3 4 2 VARIABLES: one for each COLUMN, which ROW that queen appears in Q1 in { 1, 2, 3, 4 } Q2 in { 1, 2, 3, 4 } CONSTRAINTS: Non-attacking relationship

Constraint Checking Q Q x x Q Q x Q x Q x allows us to backtrack early 6 GUESSES

Forward Checking x Q x Q Q x Q x When a variable is set, immediately remove inconsistent values from the domains of all other variables A kind of LOOKAHEAD Need to keep track of CURRENT domains 4 GUESSES

Arc Consistency Only one guess! x Q x Q x Q x Q Q3=3 inconsistent with Q4 in {2,3,4} Q2=1 and Q2=2 inconsistent with Q3 in {1} ARC CONSISTENCY – reducing domain for one variable may reduce domains for others! So, ITERATE forward checking! Only ONE guess – FIRST square! Only one guess!

Huffman-Clowes Labeling                                 Huffman-Clowes Labeling + - + + + + +

Waltz’s Filtering: Arc-Consistency Lines: variables Conjunctions: constraints Initially Di = {+,-, ,  ) Repeat until no changes: Choose edge (variable) Delete labels on edge not consistent with both endpoints

No labeling!                                                        

Path Consistency Path consistency (3-consistency): Check every triple of variables More expensive! k-consistency: n-consistency: backtrack-free search

Variable and Value Selection Select variable with smallest domain Which values to try first? Why different? Tie breaking? Recall why: first reason is to minimize branching factor. Second reason is that if domain is small, are MORE LIKELY to cause more PROPAGATION, and SET OTHER VARIABLES. Called the MOST CONSTRAINED VARIABLE heuristic. Try value first that is MOST LIKELY to actually appear in a solution. BEST CASE: no backtracking! How to guess which value? One that causes the LEAST TIGHTENING of the domains of OTHER variables. LEAST CONSTRAINED VALUE heuristic. Why OPPOSITE? Because you MUST eventually satisfy EVERY clause, so MIGHT AS WELL start with one that is HARDEST to satisfy. BUT you do not need to use every VALUE: so might as well try to AVOID considering UNLIKELY value! Tie breaking: DETERMINISTIC or RANDOMIZED. Which better? DETERMINISTIC more easily becomes STUCK; Should break ties RANDOMLY. We will see how we can further LEVERAGE randomness. FOR WEB VERSION: copy this slide, WITH ANSWERS filled in.

Variable and Value Selection Select variable with smallest domain Minimize branching factor Most likely to propagate: most constrained variable heuristic Which values to try first? Most likely value for solution Least propagation! Least constrained variable Why different? Every constraint must be eventually satisfied Not every value must be assigned to a variable! Tie breaking? In general randomized tie breaking best – less likely to get stuck on same bad pattern of choices Recall why: first reason is to minimize branching factor. Second reason is that if domain is small, are MORE LIKELY to cause more PROPAGATION, and SET OTHER VARIABLES. Called the MOST CONSTRAINED VARIABLE heuristic. Try value first that is MOST LIKELY to actually appear in a solution. BEST CASE: no backtracking! How to guess which value? One that causes the LEAST TIGHTENING of the domains of OTHER variables. LEAST CONSTRAINED VALUE heuristic. Why OPPOSITE? Because you MUST eventually satisfy EVERY clause, so MIGHT AS WELL start with one that is HARDEST to satisfy. BUT you do not need to use every VALUE: so might as well try to AVOID considering UNLIKELY value! Tie breaking: DETERMINISTIC or RANDOMIZED. Which better? DETERMINISTIC more easily becomes STUCK; Should break ties RANDOMLY. We will see how we can further LEVERAGE randomness. FOR WEB VERSION: copy this slide, WITH ANSWERS filled in.

N-queens Demo Board size 15 Delay 6 Deterministic vs. Randomized tie breaking

Inference in CSP’s: So Far… Constraint checking against partial assignments Forward checking: each time a variable is instantiated, remove other inconsistent values Keep track of current domains of vars Arc consistency: Iterate forward checking until no more changes For each pair (Vi,Vj): for every value d in the current domain of Vi there is some value y in the domain of Vj such that Vi=x and Vj=y is permitted by the binary constraint between Vi and Vj Variable / value selection

Coming Up Leveraging randomized tie-breaking Satisfiability Boolean (0/1) variables Non-binary constraints Iterative Repair and Problem Hardness