Constraint Satisfaction Problems Part 2

Similar documents
Constraint Satisfaction Problems

ARTIFICIAL INTELLIGENCE (CS 370D)

Constraint Satisfaction Problems

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable

CS 188: Artificial Intelligence Fall 2011

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides)

Constraint Satisfaction

CS W4701 Artificial Intelligence

Constraint Satisfaction Problems (CSPs)

CS 343: Artificial Intelligence

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018

Lecture 6: Constraint Satisfaction Problems (CSPs)

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria

Announcements. CS 188: Artificial Intelligence Fall 2010

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems

CSE 473: Artificial Intelligence

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set:

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm

CS 188: Artificial Intelligence Fall 2008

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens

Week 8: Constraint Satisfaction Problems

Constraint Satisfaction Problems. Chapter 6

Chapter 6 Constraint Satisfaction Problems

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence,

Constraint Satisfaction. AI Slides (5e) c Lin

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1

CS 188: Artificial Intelligence Fall 2011

CS 4100 // artificial intelligence

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph

Artificial Intelligence Constraint Satisfaction Problems

Foundations of Artificial Intelligence

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17

Constraint Satisfaction Problems

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Constraint Satisfaction Problems

Constraint Satisfaction Problems. Chapter 6

Outline. Best-first search

Artificial Intelligence

Artificial Intelligence

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012

Constraint Satisfaction Problems

Announcements. CS 188: Artificial Intelligence Spring Today. Example: Map-Coloring. Example: Cryptarithmetic.

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8

CS 188: Artificial Intelligence. Recap: Search

Artificial Intelligence

Announcements. Reminder: CSPs. Today. Example: N-Queens. Example: Map-Coloring. Introduction to Artificial Intelligence

Outline. Best-first search

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability.

CS 188: Artificial Intelligence Fall 2008

What is Search For? CS 188: Ar)ficial Intelligence. Constraint Sa)sfac)on Problems Sep 14, 2015

Constraint Satisfaction Problems

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop

Discussion Section Week 1

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence

Recap: Search Problem. CSE 473: Artificial Intelligence. Space of Search Strategies. Constraint Satisfaction. Example: N-Queens 4/9/2012

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong

CS 188: Artificial Intelligence Spring Announcements

Constraint Satisfaction Problems

CONSTRAINT SATISFACTION

Spezielle Themen der Künstlichen Intelligenz

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe

Constraints. CSC 411: AI Fall NC State University 1 / 53. Constraints

CS 188: Artificial Intelligence Spring Announcements

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

Solving Problems by Searching: Constraint Satisfaction Problems

CS 4100/5100: Foundations of AI

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Constraint Satisfaction

Lecture 9 Arc Consistency

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search

Moving to a different formalism... SEND + MORE MONEY

Constraint satisfaction search. Combinatorial optimization search.

CONSTRAINT SATISFACTION

General Methods and Search Algorithms

Admin. Quick search recap. Constraint Satisfaction Problems (CSPs)! Intro Example: 8-Queens. Where should I put the queens in columns 3 and 4?

CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro

Arc Consistency and Domain Splitting in CSPs

Constraint Satisfaction Problems

CONSTRAINT SATISFACTION

Constraint satisfaction search

What is Search For? CS 188: Artificial Intelligence. Example: Map Coloring. Example: N-Queens. Example: N-Queens. Constraint Satisfaction Problems

CS 188: Artificial Intelligence

Constraint Satisfaction Problems

CS 188: Artificial Intelligence

Local Search and Constraint Reasoning. CS 510 Lecture 3 October 6, 2009

Review I" CMPSCI 383 December 6, 2011!

AI Fundamentals: Constraints Satisfaction Problems. Maria Simi

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 6 February, 2018

Game theory (Ch. 17.5)

CS 188: Artificial Intelligence. Recap Search I

Constraint Satisfaction Problems Chapter 3, Section 7 and Chapter 4, Section 4.4 AIMA Slides cstuart Russell and Peter Norvig, 1998 Chapter 3, Section

Example: Map coloring

Constraint Satisfaction Problems (CSP)

Foundations of Artificial Intelligence

Transcription:

Constraint Satisfaction Problems Part 2 Deepak Kumar October 2017 CSP Formulation (as a special case of search) State is defined by n variables x 1, x 2,, x n Variables can take on values from a domain set (One for each variable) D 1, D 2,, D n Goal test is a set of constraints specifying allowable combinations of values of variables (subsets) This allows general purpose algorithms without resorting to domain specific heuristics. 2 1

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 {(red, green), (red, blue), (green, red), (green, blue), (blue, red), (blue, green)} 3 Example: Map-Coloring Solutions are complete and consistent assignments {WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green} 4 2

Constraint Graph Representation of CSP Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs are constraints 5 Start with a basic search algorithm Initial State: Empty assignment Successor Function: Goal Test: assign a value to an unassigned variable current assignment complete & consistent? 6 3

Backtracking Search {} Choose WA {WA = red} {WA = green} {WA = blue} {NT = red}. {T = blue} n*d (7*3=21) {WA = red NT = green} Choose Q Choose NT {WA = red NT = red Q = red}. 1. Pick one variable at a time. 2. Check constraints as you go. (incremental goal testing) (n-1)*d (6*3=18). n! d n (6! 3 7 ) 7 Backtracking Search Algorithm 8 4

Backtracking Search Algorithm Can we detect inevitable failure? Which variable to pick next? Which value to assign next? These are general purpose heuristics. 9 Improving Backtracking Search Ordering Variables & Values Which variable to pick next? MRV- Most constrained variable (one with fewest remaining values) Which value to assign next? Least constraining value first 10 5

Most constrained variable Most constrained variable: choose the variable with the fewest legal values a.k.a. minimum remaining values (MRV) heuristic 11 Least constraining value Given a variable, choose the least constraining value: the one that rules out the fewest values in the remaining variables 12 6

Improving Backtracking Search Ordering Which variable to pick next? MRV- Most constrained variable (one with fewest remaining values) Which value to assign next? Least constraining value first Filtering Constraint propagation Forward Checking Arc Consistency 13 Forward checking Idea Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values 14 7

Backtracking Search w/ Forward Checking inferences FC(csp, var, assignment) if inferences # failure add inferences to current assignment 15 Constraint propagation 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! Constraint propagation repeatedly enforces constraints locally 16 8

Constraint Graph Representation of CSP Binary CSP: each constraint relates two variables Constraint graph: nodes are variables, arcs are constraints 17 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 w/o violating any constraints 18 9

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 w/o violating any constraints 1. Check V and NSW OK 19 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 w/o violating any constraints 1. Check V and NSW OK 2. Check SA and NSW OK 20 10

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 w/o violating any constraints 1. Check V and NSW OK 2. Check SA and NSW OK 3. Check NSW and SA R is OK, B is not 21 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 w/o violating any constraints If X loses a value, neighbors of X need to be rechecked 1. Check V and NSW OK 2. Check SA and NSW OK 3. Check NSW and SA R is OK, B is not 4. Check V and NSW R is not OK, delete 22 11

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 w/o violating any constraints 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 1. Check V and NSW OK 2. Check SA and NSW OK 3. Check NSW and SA R is OK, B is not 4. Check V and NSW R is not OK, delete 5. Check SA and NT Failure! 23 Arc consistency algorithm AC-3 Time complexity: O(cd 3 ) c is the # of constraints, d is the size of largest domain 24 12

Improving Backtracking Search Ordering Which variable to pick next? Most constrained variable (one with fewest remaining values) Which value to assign next? Least constraining value first Filtering Forward Checking Arc Consistency (AC-3 algorithm) 25 Summary CSPs are a special kind of search problem: states defined by values of a fixed set of variables goal test defined by constraints on variable values Backtracking = depth-first search with one variable assigned per node Variable ordering and value selection heuristics help significantly Forward checking prevents assignments that guarantee later failure Constraint propagation (e.g., arc consistency) does additional work to constrain values and detect inconsistencies 26 13