Constraint satisfaction problems (problémy s obmedzujúcimi podmienkami)

Size: px
Start display at page:

Download "Constraint satisfaction problems (problémy s obmedzujúcimi podmienkami)"

Transcription

1 I2AI: Lecture 04 Constraint satisfaction problems (problémy s obmedzujúcimi podmienkami) Lubica Benuskova Reading: AIMA 3 rd ed. chap. 6 ending with Constraint satisfaction problems (CSP) We w ill examine cases w hen w e can define a structured representation for each state: a set of variables, each of w hich has a value. A CSP problem is solved when each variable has a value that satisfies all the constraints on the variable. CSP algorithms take advantage of the structure of states and use general-purpose rather than problem-specific heuristics to enable the solution of complex problems. The goal is to eliminate large portions of the search space by identifying variable/value combinations that violate the constraints. 2 More about constraints The unary constraint restricts the values of a single variable to certain value(s). A binary constraint relates tw o variables. A binary CSP is one w ith only binary constraints; it can be represented as a constraint graph. A constraint involving an arbitrary number of variables is called a global constraint. One of the most common global constraints is Alldiff (= All values different), w hich says that all of the variables involved in the constraint must have different values. Defining CSP CSP consists of three components, X, D and C: X is a set of variables {X 1,, X n } D is a set of domains, {D 1,, D n }, one for each variable C is a set of constraints that specify allowable (povolené) combinations of values. Each domain D i consists of a set of allowable values {v 1,, v k } for variable X i. Each constraint (obmedzujúca podmienka) C i consists of a pair scope, rel, where scope is a tuple of variables that participate in the constraint and rel is a relation that defines the values that those variables can take on, e.g. (X 1, X 2 ), X 1 X Solving CSP First, w e need to define a state space and the notion of solution. Each state in a CSP is defined by an assignment of values to some or all of the variables, i.e. {X i = v i, X j = v j, } An assignment that does not violate any constraints is called a consistent or legal assignment. A partial assignment is one that assigns values to only some of the variables. A complete assignment is one in w hich every variable is assigned, and a solution to a CSP is a consistent and complete assignment. 5 The task: color each region either red, green, or blue in such a way that no neighboring regions have the same color. Variables: X = {WA, NT, Q, NSW, V, SA, T } The domain for each variable: D i = {red, green, blue} 1

2 Constraint graph If the CSP has only binary constraints, i.e. such that relate tw o variables, w e can represent a problem as a constraint graph. The nodes of the graph correspond to variables of the problem; A link connects any tw o variables that participate in a constraint. Binary constraints: neighboring regions must be of different colors. Since there are 10 places w here regions border, there are nine constraints: C = {SA WA, SA NT, SA Q, SA NSW, SA V, WA NT, NT Q, NSW Q, NSW V, V T} Here w e are using abbreviations; SA WA instead of (SA, WA), SA WA, etc. It is useful to fully enumerate SA WA (and all other constraints) as { (red, green), (red, blue), (green, red), (green, blue), (blue, red), (blue, green)} Why formulate a problem as a CSP? The main reason is that the CSP solving can be faster than statespace searchers because the CSP solving can quickly eliminate large portions of the search space. For example, once w e have chosen {SA = blue} in the Australia coloring problem, w e can conclude that none of the five neighboring variables can take on the value blue. There are many solutions to this problem, such as this complete and consistent assignment of values to variables: { WA = red, NT= green, Q = red, NSW = green, V = red, SA = blue, T = red } Without taking advantage of constraint propagation, a search procedure w ould have to consider 3 5 =243 assignments for the five neighboring variables; w ith constraint propagation w e never have to consider blue as a value, so w e have only 2 5 =32 assignments to look at, a reduction of 87%. 10 Constraint propagation: specific inference in CSP In CSPs there is a specific type of inference called constraint propagation. This type of inference does not require search. Constraint propagation uses the constraints to reduce the number of legal values for a variable, w hich in turn can reduce the legal values for another variable, and so on. The key idea is local consistency. If w e treat each variable as a node (uzol) in a graph and each binary constraint as an arc (hrana), then the process of enforcing local consistency in each part of the graph causes inconsistent values to be eliminated throughout the graph. Let us consider the node consistency and arc consistency. 11 Node consistency A single variable (corresponding to a node in the CSP graph) is nodeconsistent if all the values in the variable s domain satisfy the variable s unary constraints. Uzol X i je uzlovo konzistentný (node consistent) ak pre každú hodnotu v i v doméne danej premennej D i sú splnené unárne podmienky. We say that a netw ork is node-consistent if every variable in the netw ork is node-consistent. It is alw ays possible to eliminate all the unary constraints in a CSP by running node consistency. Uzlovú nekonzistentnosť eliminujeme odstránením tých hodnôt z domény, ktoré ju vytvárajú. 12 2

3 Arc consistency A variable in a CSP is arc-consistent if every value in its domain satisfies the variable s binary constraints. Arc consistency: example For example, consider the constraint Y = X 2 w here the domain of both X and Y is the set {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. Thus, X i is arc-consistent w ith respect to another variable X j if for every value v i in the current domain D i there is some value in the domain D j that satisfies the binary constraint on the arc (X i, X j ). Hrana (X i, X j ) je hranovo konzistentná (arc consistent) ak pre každú hodnotu v i z domény D i premennej X i existuje nejaká hodnota v j z domény D j taká, že priradenia X i = v i a X j = v j sú dovolené danou binárnou podmienkou. Ak to tak nie je, vymažeme tie hodnoty z domény D i ku ktorým niet korešpondujúcich hodnôt v doméne D j We can w rite this constraint explicitly as (X, Y), { (0, 0), (1, 1), (2, 4), (3, 9) To make X arc-consistent w ith respect to Y, w e must reduce X s domain to {0, 1, 2, 3}. If w e also make Y arc-consistent w ith respect to X, then Y s domain becomes {0, 1, 4, 9} and the w hole CSP is arc-consistent. A netw ork is arc-consistent if every variable is arc consistent w ith every 13 other variable. 14 AC-3 algorithm (Mackworth, 1977) To make every variable arc-consistent, the AC-3 algorithm maintains a queue of arcs to consider. In fact, the order of consideration is not important, so the data structure is really a set, but tradition calls it a queue. Initially, the queue contains all the arcs in the CSP. AC-3 then pops off an arbitrary arc (X i, X j ) from the queue and makes X i is arcconsistent w ith respect to variable X j, see function REVISE: AC-3 algorithm continuation If this leaves D i revised (makes the domain smaller), then w e add to the queue all arcs (X k, X i ) w here X k is a neighbor of X i. If D i is revised dow n to nothing, then w e know the w hole CSP has no consistent solution, and AC-3 returns failure. Otherw ise, w e keep checking, trying to remove values from the domains of variables until no more arcs are in the queue Search in CSP: commutativity Many CSPs cannot be solved using just the inference by constraint satisfaction; thus w e must search for a solution. We use the crucial property common to all CSPs: commutativity. CSPs are commutative because w hen assigning values to variables, w e reach the same partial assignment regardless of their order. Backtracking search in CSP The term backtracking search is used for a depth-first search that chooses values for one variable at a time and backtracks w hen a variable has no legal values left to assign. Backracking je v podstate prehľadávanie do hĺbky, ktoré v každom čase priradí hodnotu len jednej premennej. Algoritmus sa vracia ak už neexistuje legálna hodnota na priradenie. In fact, w e need only consider a single variable at each node in the search tree. For example, at the root node of a search tree for coloring the map of Australia, w e might make a choice betw een SA=red, SA=green, and SA=blue, but w e w ould never choose (SA=red and WA=blue)

4 Algoritmus backtrackingu (BT) 1. Najprv je mapa Austrálie prázdna (počiatočný stav). 2. Urobíme si poradie premenných (napr. Q, NSW, V, T, SA, WA, NT). 3. Hodnoty sa priraďujú premenným postupne, takto: 4. Priradíme všetky možné hodnoty prvej premennej, t.j priradíme tri farby (red, green, blue) Q teritóriu. 5. Vezmeme prvý nerozvinutý uzol ako v depth first search a priradíme druhej premennej NSW zvyšné farby, blue a green. 6. Opakujeme 5 pre ďalšiu premennú až kým nedospejeme k správnemu priradeniu, alebo k porušeniu obmedzujúcej podmienky. 7. Ak nájdené riešenie porušuje obmedzujúce podmienky, BT algoritmus sa vráti k poslednej priradenej hodnote, ktorá má inú alternatívu, a pokračuje odtiaľ. Backtracking search in CSP: example Let us consider static ordering of variables: Q, NSW, V, T, SA, WA, NT Here is a scheme of the search tree: Backtrac ki ng Conflict for SA Solution 20 Backtracking search in CSP: example Ordering of variables and values Part of the search tree for the Australia map-coloring problem w ith another order of variables is: WA, NT, Q, SA, NSW, V, T Chosen ordering of variables and value assignment affects the speed of finding the solution. (In the w orst case, the BT can lead to a cycle or failure.) Thus w e use several heuristics to make the BT more efficient. These are: 1. Minimum-remaining-value (MRV) heuristic for optimizing the order of variables; (heuristika minima ostávajúcich hodnôt) 2. Degree heuristic for choosing the first variable; (hranová heuristika) Least-constraining-value heuristic to decide on the order, in w hich to examine the values of a variable. 22 MRV heuristic: example MRV heuristic The intuitive idea choosing the variable w ith the few est legal values as the next variable to assign values is called the minimum remaining-values (MRV) heuristic. The order of variables is: WA, NT, Q, SA, NSW, V, T. E.g, after the assignments for WA=red and NT =green, next it makes sense to assign SA=blue rather than assigning Q. Thus, w e w ill change the order to: WA, NT, SA, Q, NSW, V, T. Then, the solution is found faster. 23 It also has been called the most constrained variable or fail-first heuristic, the latter because it picks a variable that is most likely to cause a failure soon, thereby pruning the search tree. If some variable X has no legal values left, the MRV heuristic w ill select X and failure w ill be detected immediately avoiding pointless searches through other variables. The MRV heuristic usually performs much better than a random or static ordering, sometimes by a factor of 1,000 or more. 24 4

5 Degree heuristic (degree = number of constraints) The least-constraining-value heuristic: example The MRV heuristic may not help at all in choosing the first variable in Australia task, initially every region is initially equal DH reduces the branching factor on future choices by selecting the variable that is involved in the largest number of constraints on other unassigned variables. In SA is the variable w ith the highest degree, 5; the other variables have degree 3 25 The order of variables is: WA, NT, Q, SA, NSW, V, T. E.g, after the assignments for WA=red and NT =green, the next is Q. Blue w ould be a bad choice for Q, because it eliminates the last legal value left for SA, thus w e choose Q = red. 26 The least-constraining-value heuristic The least-constraining-value heuristic prefers the value that rules out the smallest number of choices for the neighboring variables in the constraint graph. Forward checking AC-3 and other algorithms for inference based on constraint propagation can infer reductions in the domain of variables either w ithout or before and / or during the search. In general, the heuristic is trying to leave the maximum flexibility for subsequent variable assignments. One of the simplest forms of search combined with constraint propagation is the so-called forward checking. In other w ords, the variable selection is fail-first, but value selection is the fail-last value. Therefore, it makes sense to look for the most likely value first. In other w ords for the value w hich is the least restricting 27 Whenever a variable X i is assigned a value, the forw ard-checking process establishes arc consistency for it, that is If X i is arc-consistent w ith respect to another variable X j then for every value v i in the current domain D i there is some value in the domain D j that satisfies the binary constraint on the arc (X i, X j ). 28 Forward checking For each to be assigned variable X j that is connected to X j by a constraint, delete from X j s domain D j any value that is inconsistent w ith the value chosen for X i. (remember there is no backtracking) The problem w ith forw ard checking is that it makes the current variable arc-consistent, but doesn t look ahead and make all the other variables arc-consistent. Thus, although forw ard checking detects many inconsistencies, it does not detect all of them, thus this is not the algorithm of the first choice. 29 Summary Many important real-w orld problems can be described as CSPs. Constraint propagation is the main tool in CSP inference. Backtracking search, a form of depth-first search, is commonly used for solving CSPs. The minimum-remaining-values and degree heuristics are domainindependent methods for deciding w hich variable to choose next in a backtracking search, w hile the least-constraining-value heuristic to decide on the order, in w hich to examine the values of a variable. Inference (by constraint propagation) can be interw oven w ith search in the forward checking. 30 5

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Constraint Satisfaction Problems A constraint satisfaction problem consists of three components, X, D, and C: X is a set of variables, {X 1,..., X n }. D is a

More information

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

Lecture 18. Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Lecture 18 Questions? Monday, February 20 CS 430 Artificial Intelligence - Lecture 18 1 Outline Chapter 6 - Constraint Satisfaction Problems Path Consistency & Global Constraints Sudoku Example Backtracking

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems CE417: Introduction to Artificial Intelligence Sharif University of Technology Spring 2013 Soleymani Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition,

More information

Constraint Satisfaction Problems Part 2

Constraint Satisfaction Problems Part 2 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

More information

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

CS 771 Artificial Intelligence. Constraint Satisfaction Problem CS 771 Artificial Intelligence Constraint Satisfaction Problem Constraint Satisfaction Problems So far we have seen a problem can be solved by searching in space of states These states can be evaluated

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Robert Platt Northeastern University Some images and slides are used from: 1. AIMA What is a CSP? The space of all search problems states and actions are atomic goals are

More information

Artificial Intelligence

Artificial Intelligence Contents Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller What

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller SA-1 Contents

More information

Week 8: Constraint Satisfaction Problems

Week 8: Constraint Satisfaction Problems COMP3411/ 9414/ 9814: Artificial Intelligence Week 8: Constraint Satisfaction Problems [Russell & Norvig: 6.1,6.2,6.3,6.4,4.1] COMP3411/9414/9814 18s1 Constraint Satisfaction Problems 1 Outline Constraint

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems In which we see how treating states as more than just little black boxes leads to the invention of a range of powerful new search methods and a deeper understanding of

More information

Artificial Intelligence Constraint Satisfaction Problems

Artificial Intelligence Constraint Satisfaction Problems Artificial Intelligence Constraint Satisfaction Problems Recall Search problems: Find the sequence of actions that leads to the goal. Sequence of actions means a path in the search space. Paths come with

More information

ARTIFICIAL INTELLIGENCE (CS 370D)

ARTIFICIAL INTELLIGENCE (CS 370D) Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-6) CONSTRAINT SATISFACTION PROBLEMS Outline What is a CSP CSP applications Backtracking search

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. S. Russell and P. Norvig. Artificial Intelligence:

More information

Solving Problems by Searching: Constraint Satisfaction Problems

Solving Problems by Searching: Constraint Satisfaction Problems Course 16 :198 :520 : Introduction To Artificial Intelligence Lecture 6 Solving Problems by Searching: Constraint Satisfaction Problems Abdeslam Boularias Wednesday, October 19, 2016 1 / 1 Outline We consider

More information

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

Constraint Satisfaction Problems. slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Constraint Satisfaction Problems slides from: Padhraic Smyth, Bryan Low, S. Russell and P. Norvig, Jean-Claude Latombe Standard search problems: State is a black box : arbitrary data structure Goal test

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 5. Constraint Satisfaction Problems CSPs as Search Problems, Solving CSPs, Problem Structure Wolfram Burgard, Bernhard Nebel, and Martin Riedmiller Albert-Ludwigs-Universität

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Section 1 3 Constraint Satisfaction 1 Outline Constraint Satisfaction Problems (CSP) Backtracking search for CSPs Local search for CSPs Constraint Satisfaction

More information

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

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 30 January, 2018 DIT411/TIN175, Artificial Intelligence Chapter 7: Constraint satisfaction problems CHAPTER 7: CONSTRAINT SATISFACTION PROBLEMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 30 January, 2018 1 TABLE

More information

Constraint Satisfaction. AI Slides (5e) c Lin

Constraint Satisfaction. AI Slides (5e) c Lin Constraint Satisfaction 4 AI Slides (5e) c Lin Zuoquan@PKU 2003-2018 4 1 4 Constraint Satisfaction 4.1 Constraint satisfaction problems 4.2 Backtracking search 4.3 Constraint propagation 4.4 Local search

More information

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

Constraint Satisfaction. CS 486/686: Introduction to Artificial Intelligence Constraint Satisfaction CS 486/686: Introduction to Artificial Intelligence 1 Outline What are Constraint Satisfaction Problems (CSPs)? Standard Search and CSPs Improvements Backtracking Backtracking +

More information

CS 4100/5100: Foundations of AI

CS 4100/5100: Foundations of AI CS 4100/5100: Foundations of AI Constraint satisfaction problems 1 Instructor: Rob Platt r.platt@neu.edu College of Computer and information Science Northeastern University September 5, 2013 1 These notes

More information

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

10/11/2017. Constraint Satisfaction Problems II. Review: CSP Representations. Heuristic 1: Most constrained variable //7 Review: Constraint Satisfaction Problems Constraint Satisfaction Problems II AIMA: Chapter 6 A CSP consists of: Finite set of X, X,, X n Nonempty domain of possible values for each variable D, D, D

More information

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

Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Thursday: Chapter 8 Constraint t Satisfaction Problems Reading: Chapter 6 (3 rd ed.); Chapter 5 (2 nd ed.) For next week: Tuesday: Chapter 7 Thursday: Chapter 8 Outline What is a CSP Backtracking for CSP Local search for

More information

Chapter 6 Constraint Satisfaction Problems

Chapter 6 Constraint Satisfaction Problems Chapter 6 Constraint Satisfaction Problems CS5811 - Artificial Intelligence Nilufer Onder Department of Computer Science Michigan Technological University Outline CSP problem definition Backtracking search

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Revised by Hankui Zhuo, March 14, 2018 Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search

More information

Lecture 6: Constraint Satisfaction Problems (CSPs)

Lecture 6: Constraint Satisfaction Problems (CSPs) Lecture 6: Constraint Satisfaction Problems (CSPs) CS 580 (001) - Spring 2018 Amarda Shehu Department of Computer Science George Mason University, Fairfax, VA, USA February 28, 2018 Amarda Shehu (580)

More information

CS 343: Artificial Intelligence

CS 343: Artificial Intelligence CS 343: Artificial Intelligence Constraint Satisfaction Problems Prof. Scott Niekum The University of Texas at Austin [These slides are based on those of Dan Klein and Pieter Abbeel for CS188 Intro to

More information

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

What is Search For? CS 188: Artificial Intelligence. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems What is Search For? Assumptions about the world: a single agent, deterministic actions, fully observed state, discrete state space Planning:

More information

Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems (CSPs) 1 Hal Daumé III (me@hal3.name) Constraint Satisfaction Problems (CSPs) Hal Daumé III Computer Science University of Maryland me@hal3.name CS 421: Introduction to Artificial Intelligence 7 Feb 2012 Many

More information

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems. Chapter 6 Constraint Satisfaction Problems Chapter 6 Office hours Office hours for Assignment 1 (ASB9810 in CSIL): Sep 29th(Fri) 12:00 to 13:30 Oct 3rd(Tue) 11:30 to 13:00 Late homework policy You get four late

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 Announcements Project 1: Search is due next week Written 1: Search and CSPs out soon Piazza: check it out if you haven t CS 188: Artificial Intelligence Fall 2011 Lecture 4: Constraint Satisfaction 9/6/2011

More information

CS W4701 Artificial Intelligence

CS W4701 Artificial Intelligence CS W4701 Artificial Intelligence Fall 2013 Chapter 6: Constraint Satisfaction Problems Jonathan Voris (based on slides by Sal Stolfo) Assignment 3 Go Encircling Game Ancient Chinese game Dates back At

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

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

Constraint Satisfaction Problems. A Quick Overview (based on AIMA book slides) Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides) Constraint satisfaction problems What is a CSP? Finite set of variables V, V 2,, V n Nonempty domain of possible values for

More information

CSE 473: Artificial Intelligence

CSE 473: Artificial Intelligence CSE 473: Artificial Intelligence Constraint Satisfaction Luke Zettlemoyer Multiple slides adapted from Dan Klein, Stuart Russell or Andrew Moore What is Search For? Models of the world: single agent, deterministic

More information

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

CS 188: Artificial Intelligence. What is Search For? Constraint Satisfaction Problems. Constraint Satisfaction Problems CS 188: Artificial Intelligence Constraint Satisfaction Problems Constraint Satisfaction Problems N variables domain D constraints x 1 x 2 Instructor: Marco Alvarez University of Rhode Island (These slides

More information

Constraint Satisfaction

Constraint Satisfaction Constraint Satisfaction Philipp Koehn 1 October 2015 Outline 1 Constraint satisfaction problems (CSP) examples Backtracking search for CSPs Problem structure and problem decomposition Local search for

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Last update: February 25, 2010 Constraint Satisfaction Problems CMSC 421, Chapter 5 CMSC 421, Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local

More information

Announcements. CS 188: Artificial Intelligence Fall 2010

Announcements. CS 188: Artificial Intelligence Fall 2010 Announcements Project 1: Search is due Monday Looking for partners? After class or newsgroup Written 1: Search and CSPs out soon Newsgroup: check it out CS 188: Artificial Intelligence Fall 2010 Lecture

More information

General Methods and Search Algorithms

General Methods and Search Algorithms DM811 HEURISTICS AND LOCAL SEARCH ALGORITHMS FOR COMBINATORIAL OPTIMZATION Lecture 3 General Methods and Search Algorithms Marco Chiarandini 2 Methods and Algorithms A Method is a general framework for

More information

AI Fundamentals: Constraints Satisfaction Problems. Maria Simi

AI Fundamentals: Constraints Satisfaction Problems. Maria Simi AI Fundamentals: Constraints Satisfaction Problems Maria Simi Constraints satisfaction LESSON 3 SEARCHING FOR SOLUTIONS Searching for solutions Most problems cannot be solved by constraint propagation

More information

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

Announcements. Homework 1: Search. Project 1: Search. Midterm date and time has been set: Announcements Homework 1: Search Has been released! Due Monday, 2/1, at 11:59pm. On edx online, instant grading, submit as often as you like. Project 1: Search Has been released! Due Friday 2/5 at 5pm.

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

Outline. Best-first search

Outline. Best-first search Outline Best-first search Greedy best-first search A* search Heuristics Local search algorithms Hill-climbing search Beam search Simulated annealing search Genetic algorithms Constraint Satisfaction Problems

More information

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

Constraint satisfaction problems. CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop Constraint satisfaction problems CS171, Winter 2018 Introduction to Artificial Intelligence Prof. Richard Lathrop Constraint Satisfaction Problems What is a CSP? Finite set of variables, X 1, X 2,, X n

More information

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

Lars Schmidt-Thieme, Information Systems and Machine Learning Lab (ISMLL), University of Hildesheim, Germany, Course on Artificial Intelligence, Course on Artificial Intelligence, winter term 2012/2013 0/35 Artificial Intelligence Artificial Intelligence 3. Constraint Satisfaction Problems Lars Schmidt-Thieme Information Systems and Machine Learning

More information

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

Moving to a different formalism... SEND + MORE MONEY Moving to a different formalism... SEND + MORE -------- MONEY Consider search space for cryptarithmetic. DFS (depth-first search) Is this (DFS) how humans tackle the problem? Human problem solving appears

More information

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

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.) Some slides adapted from Richard Lathrop, USC/ISI, CS 7 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always replies

More information

Discussion Section Week 1

Discussion Section Week 1 Discussion Section Week 1 Intro Course Project Information Constraint Satisfaction Problems Sudoku Backtracking Search Example Heuristics for guiding Search Example Intro Teaching Assistant Junkyu Lee

More information

CS 188: Artificial Intelligence Fall 2008

CS 188: Artificial Intelligence Fall 2008 CS 188: Artificial Intelligence Fall 2008 Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 1 Announcements Grading questions:

More information

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

Announcements. CS 188: Artificial Intelligence Fall Large Scale: Problems with A* What is Search For? Example: N-Queens CS 188: Artificial Intelligence Fall 2008 Announcements Grading questions: don t panic, talk to us Newsgroup: check it out Lecture 4: CSPs 9/9/2008 Dan Klein UC Berkeley Many slides over the course adapted

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Chapter 5 Chapter 5 1 Outline CSP examples Backtracking search for CSPs Problem structure and problem decomposition Local search for CSPs Chapter 5 2 Constraint satisfaction

More information

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

Announcements. Homework 4. Project 3. Due tonight at 11:59pm. Due 3/8 at 4:00pm Announcements Homework 4 Due tonight at 11:59pm Project 3 Due 3/8 at 4:00pm CS 188: Artificial Intelligence Constraint Satisfaction Problems Instructor: Stuart Russell & Sergey Levine, University of California,

More information

CONSTRAINT SATISFACTION

CONSTRAINT SATISFACTION 9// CONSRAI ISFACION oday Reading AIMA Chapter 6 Goals Constraint satisfaction problems (CSPs) ypes of CSPs Inference Search + Inference 9// 8-queens problem How would you go about deciding where to put

More information

Constraint satisfaction search. Combinatorial optimization search.

Constraint satisfaction search. Combinatorial optimization search. CS 1571 Introduction to AI Lecture 8 Constraint satisfaction search. Combinatorial optimization search. Milos Hauskrecht milos@cs.pitt.edu 539 Sennott Square Constraint satisfaction problem (CSP) Objective:

More information

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search This lecture topic (two lectures) Chapter 6.1 6.4, except 6.3.3 Next lecture topic (two lectures) Chapter 7.1 7.5 (Please read

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Constraint satisfaction problems Backtracking algorithms for CSP Heuristics Local search for CSP Problem structure and difficulty of solving Search Problems The formalism

More information

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

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 6 February, 2018 DIT411/TIN175, Artificial Intelligence Chapters 5, 7: Search part IV, and CSP, part II CHAPTERS 5, 7: SEARCH PART IV, AND CSP, PART II DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 6 February,

More information

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

Constraints. CSC 411: AI Fall NC State University 1 / 53. Constraints CSC 411: AI Fall 2013 NC State University 1 / 53 Constraint satisfaction problems (CSPs) Standard search: state is a black box that supports goal testing, application of an evaluation function, production

More information

CS 188: Artificial Intelligence Fall 2011

CS 188: Artificial Intelligence Fall 2011 CS 188: Artificial Intelligence Fall 2011 Lecture 5: CSPs II 9/8/2011 Dan Klein UC Berkeley Multiple slides over the course adapted from either Stuart Russell or Andrew Moore 1 Today Efficient Solution

More information

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

What is Search For? CSE 473: Artificial Intelligence. Example: N-Queens. Example: N-Queens. Example: Map-Coloring 4/7/17 CSE 473: Artificial Intelligence Constraint Satisfaction Dieter Fox What is Search For? Models of the world: single agent, deterministic actions, fully observed state, discrete state space Planning: sequences

More information

Spezielle Themen der Künstlichen Intelligenz

Spezielle Themen der Künstlichen Intelligenz Spezielle Themen der Künstlichen Intelligenz 2. Termin: Constraint Satisfaction Dr. Stefan Kopp Center of Excellence Cognitive Interaction Technology AG A Recall: Best-first search Best-first search =

More information

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

Australia Western Australia Western Territory Northern Territory Northern Australia South Australia South Tasmania Queensland Tasmania Victoria Constraint Satisfaction Problems Chapter 5 Example: Map-Coloring Western Northern Territory South Queensland New South Wales Tasmania Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red,green,blue} Constraints:

More information

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

CMU-Q Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro CMU-Q 15-381 Lecture 7: Searching in solution space Constraint Satisfaction Problems (CSPs) Teacher: Gianni A. Di Caro AI PLANNING APPROACHES SO FAR Goal: Find the (best) sequence of actions that take

More information

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition

Today. Introduction to Artificial Intelligence COMP 3501 / COMP Lecture 5. Constraint Satisfaction Problems (CSP) CSP Definition Today COMP 3501 / COMP 4704-4 Lecture 5 Finish up 2-player games Discuss homework Constraint Satisfaction Problems Prof. JGH 318 Constraint Satisfaction Problems (CSP) CSP s are our first work on factored

More information

Lecture 9 Arc Consistency

Lecture 9 Arc Consistency Computer Science CPSC 322 Lecture 9 Arc Consistency (4.5, 4.6) Slide 1 Lecture Overview Recap of Lecture 8 Arc Consistency for CSP Domain Splitting 2 Problem Type Static Sequential Constraint Satisfaction

More information

CS 188: Artificial Intelligence. Recap: Search

CS 188: Artificial Intelligence. Recap: Search CS 188: Artificial Intelligence Lecture 4 and 5: Constraint Satisfaction Problems (CSPs) Pieter Abbeel UC Berkeley Many slides from Dan Klein Recap: Search Search problem: States (configurations of the

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Tuomas Sandholm Carnegie Mellon University Computer Science Department [Read Chapter 6 of Russell & Norvig] Constraint satisfaction problems (CSPs) Standard search problem:

More information

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

Comments about assign 1. Quick search recap. Constraint Satisfaction Problems (CSPs) Search uninformed BFS, DFS, IDS. Adversarial search Constraint Satisfaction Problems (CSPs) CS5 David Kauchak Fall 00 http://www.xkcd.com/78/ Some material borrowed from: Sara Owsley Sood and others Comments about assign Grading actually out of 60 check

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems Soup Must be Hot&Sour Appetizer Pork Dish Total Cost < $30 Chicken Dish Vegetable No Peanuts No Peanuts Not Both Spicy Seafood Rice Constraint Network Not Chow Mein 1 Formal

More information

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

Space of Search Strategies. CSE 573: Artificial Intelligence. Constraint Satisfaction. Recap: Search Problem. Example: Map-Coloring 11/30/2012 /0/0 CSE 57: Artificial Intelligence Constraint Satisfaction Daniel Weld Slides adapted from Dan Klein, Stuart Russell, Andrew Moore & Luke Zettlemoyer Space of Search Strategies Blind Search DFS, BFS,

More information

Set 5: Constraint Satisfaction Problems

Set 5: Constraint Satisfaction Problems Set 5: Constraint Satisfaction Problems ICS 271 Fall 2014 Kalev Kask ICS-271:Notes 5: 1 The constraint network model Outline Variables, domains, constraints, constraint graph, solutions Examples: graph-coloring,

More information

CONSTRAINT SATISFACTION

CONSTRAINT SATISFACTION CONSRAI ISFACION oday Reading AIMA Read Chapter 6.1-6.3, Skim 6.4-6.5 Goals Constraint satisfaction problems (CSPs) ypes of CSPs Inference (Search + Inference) 1 8-queens problem How would you go about

More information

Constraint satisfaction search

Constraint satisfaction search CS 70 Foundations of AI Lecture 6 Constraint satisfaction search Milos Hauskrecht milos@cs.pitt.edu 539 Sennott Square Search problem A search problem: Search space (or state space): a set of objects among

More information

CS 4100 // artificial intelligence

CS 4100 // artificial intelligence CS 4100 // artificial intelligence instructor: byron wallace Constraint Satisfaction Problems Attribution: many of these slides are modified versions of those distributed with the UC Berkeley CS188 materials

More information

Arc Consistency and Domain Splitting in CSPs

Arc Consistency and Domain Splitting in CSPs Arc Consistency and Domain Splitting in CSPs CPSC 322 CSP 3 Textbook Poole and Mackworth: 4.5 and 4.6 Lecturer: Alan Mackworth October 3, 2012 Lecture Overview Solving Constraint Satisfaction Problems

More information

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

Announcements. CS 188: Artificial Intelligence Spring Today. A* Review. Consistency. A* Graph Search Gone Wrong CS 88: Artificial Intelligence Spring 2009 Lecture 4: Constraint Satisfaction /29/2009 John DeNero UC Berkeley Slides adapted from Dan Klein, Stuart Russell or Andrew Moore Announcements The Python tutorial

More information

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

Announcements. Reminder: CSPs. Today. Example: N-Queens. Example: Map-Coloring. Introduction to Artificial Intelligence Introduction to Artificial Intelligence 22.0472-001 Fall 2009 Lecture 5: Constraint Satisfaction Problems II Announcements Assignment due on Monday 11.59pm Email search.py and searchagent.py to me Next

More information

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

Announcements. CS 188: Artificial Intelligence Fall Reminder: CSPs. Today. Example: 3-SAT. Example: Boolean Satisfiability. CS 188: Artificial Intelligence Fall 2008 Lecture 5: CSPs II 9/11/2008 Announcements Assignments: DUE W1: NOW P1: Due 9/12 at 11:59pm Assignments: UP W2: Up now P2: Up by weekend Dan Klein UC Berkeley

More information

CS 188: Artificial Intelligence Fall 2008

CS 188: Artificial Intelligence Fall 2008 CS 188: Artificial Intelligence Fall 2008 Lecture 5: CSPs II 9/11/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 1 Assignments: DUE Announcements

More information

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence CS 188: Artificial Intelligence CSPs II + Local Search Prof. Scott Niekum The University of Texas at Austin [These slides based on those of Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley.

More information

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

Material. Thought Question. Outline For Today. Example: Map-Coloring EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 6, 4/20/2005 University of Washington, Department of Electrical Engineering Spring 2005 Instructor: Professor Jeff A. Bilmes Material Read all of chapter

More information

Mathematical Programming Formulations, Constraint Programming

Mathematical Programming Formulations, Constraint Programming Outline DM87 SCHEDULING, TIMETABLING AND ROUTING Lecture 3 Mathematical Programming Formulations, Constraint Programming 1. Special Purpose Algorithms 2. Constraint Programming Marco Chiarandini DM87 Scheduling,

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2010 Lecture 4: A* wrap-up + Constraint Satisfaction 1/28/2010 Pieter Abbeel UC Berkeley Many slides from Dan Klein Announcements Project 0 (Python tutorial) is due

More information

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

Example: Map-Coloring. Constraint Satisfaction Problems Western Australia. Example: Map-Coloring contd. Outline. Constraint graph Example: Map-Coloring Constraint Satisfaction Problems Western Northern erritory ueensland Chapter 5 South New South Wales asmania Variables, N,,, V, SA, Domains D i = {red,green,blue} Constraints: adjacent

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2006 Lecture 4: CSPs 9/7/2006 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore Announcements Reminder: Project

More information

6.034 Quiz 1, Spring 2004 Solutions

6.034 Quiz 1, Spring 2004 Solutions 6.034 Quiz 1, Spring 2004 Solutions Open Book, Open Notes 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical

More information

Constraint Satisfaction Problems (CSP)

Constraint Satisfaction Problems (CSP) Constraint Satisfaction Problems (CSP) (Where we postpone making difficult decisions until they become easy to make) R&N: Chap. 5 1 What we will try to do... Search techniques make choices in an often

More information

Set 5: Constraint Satisfaction Problems Chapter 6 R&N

Set 5: Constraint Satisfaction Problems Chapter 6 R&N Set 5: Constraint Satisfaction Problems Chapter 6 R&N ICS 271 Fall 2017 Kalev Kask ICS-271:Notes 5: 1 The constraint network model Outline Variables, domains, constraints, constraint graph, solutions Examples:

More information

Module 4. Constraint satisfaction problems. Version 2 CSE IIT, Kharagpur

Module 4. Constraint satisfaction problems. Version 2 CSE IIT, Kharagpur Module 4 Constraint satisfaction problems Lesson 10 Constraint satisfaction problems - II 4.5 Variable and Value Ordering A search algorithm for constraint satisfaction requires the order in which variables

More information

Constraint Satisfaction Problems (Backtracking Search)

Constraint Satisfaction Problems (Backtracking Search) CSC8:"Introducon"to"Arficial"Intelligence" Constraint Satisfaction Problems (Backtracking Search) Chapter 6 6.: Formalism 6.: Constraint Propagation 6.: Backtracking Search for CSP 6. is about local search

More information

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence CS 188: Artificial Intelligence Constraint Satisfaction Problems II Instructors: Dan Klein and Pieter Abbeel University of California, Berkeley [These slides were created by Dan Klein and Pieter Abbeel

More information

A fuzzy constraint assigns every possible tuple in a relation a membership degree. The function

A fuzzy constraint assigns every possible tuple in a relation a membership degree. The function Scribe Notes: 2/13/2013 Presenter: Tony Schnider Scribe: Nate Stender Topic: Soft Constraints (Ch. 9 of CP handbook) Soft Constraints Motivation Soft constraints are used: 1. When we seek to find the best

More information

1 Tree Search (12 points)

1 Tree Search (12 points) 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical order when no other order is specified by the search,

More information

Constraint Satisfaction Problems

Constraint Satisfaction Problems Constraint Satisfaction Problems [These slides were created by Dan Klein and Pieter Abbeel for CS188 Intro to AI at UC Berkeley. All CS188 materials are available at http://ai.berkeley.edu.] What is Search

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Constraint Satisfaction Problems Marc Toussaint University of Stuttgart Winter 2015/16 (slides based on Stuart Russell s AI course) Inference The core topic of the following lectures

More information

Game theory (Ch. 17.5)

Game theory (Ch. 17.5) Game theory (Ch. 17.5) Announcements Writing 2 due Sunday Repeated games In repeated games, things are complicated For example, in the basic PD, there is no benefit to lying However, if you play this game

More information

Backtracking Search (CSPs)

Backtracking Search (CSPs) CSC384: Intro to Artificial Intelligence Backtracking Search (CSPs STATE REPRESENTATION: Factored representation of state ALGORITHMS: general purpose for particular types of constraints (versus problem

More information

Set 5: Constraint Satisfaction Problems

Set 5: Constraint Satisfaction Problems Set 5: Constraint Satisfaction Problems ICS 271 Fall 2013 Kalev Kask ICS-271:Notes 5: 1 The constraint network model Outline Variables, domains, constraints, constraint graph, solutions Examples: graph-coloring,

More information

Example: Map coloring

Example: Map coloring Today s s lecture Local Search Lecture 7: Search - 6 Heuristic Repair CSP and 3-SAT Solving CSPs using Systematic Search. Victor Lesser CMPSCI 683 Fall 2004 The relationship between problem structure and

More information