Constraint Satisfaction Problems vs. Finite State Problems

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Heuristic Search techniques
Constraint Satisfaction Problems Russell and Norvig: Chapter
This lecture topic (two lectures) Chapter 6.1 – 6.4, except
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.
This lecture topic (two lectures) Chapter 6.1 – 6.4, except 6.3.3
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
MBD and CSP Meir Kalech Partially based on slides of Jia You and Brian Williams.
Artificial Intelligence Constraint satisfaction problems Fall 2008 professor: Luigi Ceccaroni.
Constraint Satisfaction problems (CSP)
Constraint Satisfaction Problems. Constraint satisfaction problems (CSPs) Standard search problem: – State is a “black box” – any data structure that.
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Satisfaction Problems
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Constraint Satisfaction Problems
Constraint Satisfaction Problems Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
Constraint Satisfaction Problems
CAP 492 Course Dr. Souham Meshoul 1 CONSTRAINT SATISFACTION PROBLEMS Chapter 5.
Chapter 5 Outline Formal definition of CSP CSP Examples
Constraint Satisfaction Problems
Artificial Intelligence CS482, CS682, MW 1 – 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis,
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
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.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
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
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 Satisfaction Problems Rich and Knight: 3.5 Russell and Norvig: Chapter 3, Section 3.7 Chapter 4, Pages Slides adapted from: robotics.stanford.edu/~latombe/cs121/2003/home.htm.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Constraint Satisfaction Problems
CS 561, Session 8 1 This time: constraint satisfaction - Constraint Satisfaction Problems (CSP) - Backtracking search for CSPs - Local search for CSPs.
CSG3F3/ Desain dan Analisis Algoritma
Constraint Satisfaction Problems (CSPs) Introduction
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Automated Maze Generation and Solving Over Epochs
Constraint Satisfaction Problems (CSPs)
Constraint Satisfaction Problems Lecture # 14, 15 & 16
Constraint Satisfaction Problems (CSPs) Introduction
CS 188: Artificial Intelligence
Computer Science cpsc322, Lecture 14
Maze Implementation, Analysis and Design to find Shortest Paths
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Propagation
Data Structures – Stacks and Queus
Constraint Satisfaction Problems
Artificial Intelligence
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
State-Space Searches.
State-Space Searches.
Constraint Satisfaction Problems
CS 8520: Artificial Intelligence
Constraint Satisfaction Problems
State-Space Searches.
Constraint satisfaction problems
Constraint Satisfaction Problems (CSP)
Presentation transcript:

Constraint Satisfaction Problems vs. Finite State Problems

Finite State Problems (FSP) FSP can be solved by searching in a space of simple states. Finite states are evaluated by domain-specific heuristics (rules) and tested to see whether they were goal states. Finite States have no discernible internal structure. Objective: Examine rules that govern behavior and perform a goal test. The Virtual Pet problem is a Finite State Problem.

Constraint Satisfaction Problems (CSP) complex situations that cannot utilize this finite state application very efficiently. Problem requires a complex internal structure. Constraint Satisfaction Problems contain states and goals that conform to a complex data structured representation. The Maze problem is a Constraint Satisfaction Problem, which refers to a specific area of AI.

Virtual Pet Problem: Simple Data Structure Virtual Pet is a Finite State Problem. Finite states can be represented by primitive values. isEATING = 1 , isHUNGRY = 2, and, isPLAYING = 3. Simplified states could be easily identified them during the game loop using a switch statement.

Maze App: Complex Data Structure - Carving out the pathways - The Maze Game is a Constraint Satisfaction Problem because it contains states and goals that conform to a complex data structured representation. A maze requires a unique search algorithm to carve out a path. Search algorithms for Constraint Satisfaction Problems require the application of conflict heuristics. NOTE: The topic of Constraint Satisfaction appears regularly in Artificial Intelligence research papers and in the specialist journal, Constraints.

Definition of Constraint Satisfaction Problem Formally speaking, a constraint satisfaction problem (or CSP) is a search problem defined by: a set of variables. a set of constraints that restrict the values assigned to the variables.   Each variable has a nonempty domain of possible values. Each constraint involves some subset of the variables and specifies the allowable combinations of values for that subset.

Example Constraint Satisfaction Problem We are tired of living in California and we’re thinking of moving to Australia. Explore a map of Australia showing each territory. RULES: Identify locations by coloring each region a different color. Use either red, green, or blue. Color in such a way that no neighboring regions have the same color.

No neighboring regions have the same color No neighboring regions have the same color. NOTE: Tasmania is not included.

Develop Heuristics (Generic Rules) for CSP Visualize the problem, such as structuring the constraints in the form of graph. Define the variables : WA, N , Q, NSW, V , and SA. The domain of each variable is the set: {red, green, blue}. The nodes of the graph correspond to variables of the problem and the arcs correspond to constraints. Next step: develop generic rules for the structure of the constraints

Why Constraint Rules? – An Overview Once we have chosen {SA = blue}, we can conclude that none of the five neighboring variables can take on the value blue. Without taking advantage of a constraint heuristic, a search would consider 35 = 243 assignments for the five neighboring variables. With a constraint heuristic we never have to consider blue as a value, so we have only 25 assignments to search.

The Map Constraints Since there are nine places where regions border, there are nine constraints. SA != WA SA != NT SA != Q SA != NSW SA != V WA != NT NT != Q Q != NSW; NSW != V

Searching a CSP - Backtracking Backtracking is a list processing search mechanism. Backtracking is commonly used for solving CSPs. The term backtracking is used for a depth-first search that chooses values for one variable at a time and backtracks when a variable has no legal values left to assign. Legal values are governed by constraints.

Backtracking Algorithms Stacks Depth-First Searches

Review of Stacks A Stack is a list with very strict rules placed on its behavior. Elements may be added or removed only from the back of the list. The back of the list is usually referred to as the top of the stack. When an element is added to a stack, it must be pushed onto the back of the list. When an element is removed, it must be popped off the back of the list. Elements are added and removed strictly from the back of the list (the top). The item that is added last will be removed first. A stack is also called a last in, first out (LIFO) data structure. The second book in a stack can be removed only once the book on top of it has been removed.

Stacks and AS3 A stack can be implemented using an AS3 array structure. Stacks begin with zero elements, initialized to an empty state. The top of the stack is the last element in the array. Two array operations are used for accessing elements on a stack: push() Adds an item to the back of the list. pop() Removes an item from the back of the list.

AS3 Code Example for Stacks var stack:Array = new Array(); stack.push(3); stack.push(4); stack.push(5); stack.push(6); stack.push(7); trace(“Top of the stack is “, stack.length – 1);

AS3 Code Example for Stacks var stack:Array = new Array(); stack.push(3); stack.push(4); stack.push(5); stack.push(6); stack.push(7); stack.pop(); stack.pop(); trace(“Top of the stack is “, stack.length – 1);

Carving out a Perfect Maze using Backtracking Carving a maze is a CSP. A “perfect” maze is one in which there is exactly one path between any two given cells. In computer science terms, this is called a minimal spanning tree over a set of cells.

Algorithm Objectives: Building a Maze The maze will contain nine cells arranged in three rows and three columns. The maze contains no circular paths: Every cell is connected to every other cell by exactly one path. Build the maze cell by cell while making sure that no loops exist and that no cell ends up isolated. The backtracker operates as follows Begin with an array of maze cells with all the walls intact. Choose a starting cell. Repeatedly select a random adjacent cell in the maze—one that has been unvisited—and open the wall between the two. Continue to do this until every cell has been “visited” and a wall has been eliminated during the visit.

Step 1: Create a two-dimensional array representing the maze cells. All cell walls are initially intact. Construct an empty stack for backtracking. This will ensure that no loops exist in the path and that no cell ends up isolated.

Step 2: The starting cell is selected. For convenience in this example, the starting cell will be cell number 0. This first cell is marked as visited, and pushed onto the stack. The stack now holds the first cell visited.

Step 3: Choose a random adjacent cell that has not yet been visited. In this case, the constraints tell us the possible cells are 1 and 3. Assume that cell 1 has been randomly selected. The east wall of cell 0 is eliminated. Cell 1 is marked as visited. Cell 1 is pushed onto the stack.

Step 4: The possible adjacent cells to cell 1 are 2 and 4. Assume that cell 4 has been randomly selected. The south wall of cell 1 is eliminated. The north wall of 4 is eliminated. Cell 4 is marked as visited and pushed onto the stack.

Step 5: The possible adjacent cells to cell 1 are 3, 7, and 5. Assume that cell 7 has been randomly selected. The south wall of cell 4 is eliminated. The north wall of 7 is eliminated. Cell 7 is marked as visited and pushed onto the stack.

Step 6: The possible adjacent cells to cell 1 are 6 and 8. Assume that cell 6 has been randomly selected. The west wall of cell 7 is eliminated. The east wall of 6 is eliminated. Cell 6 is marked as visited and pushed onto the stack.

Step 7: Cell 3 is the only possible adjacent cell to visit from cell 6. The south wall of 3 is eliminated. The north wall of cell 6 is eliminated. Cell 3 is marked as visited and pushed onto the stack.

Step 8: There are no valid cells to cell 3 that can be visited Step 8: There are no valid cells to cell 3 that can be visited. Backtrack to find a new cell that has not been visited.

Step 9: After backtracking to cell 7, Cell 8 is the only possible adjacent cell to visit. The east wall of cell 7 is eliminated. The west wall of 8 is eliminated. Cell 8 is marked as visited and pushed onto the stack.

Step 10: Cell 5 is the only possible adjacent cell to visit from cell 8. The south wall of 5 is eliminated. The north wall of cell 8 is eliminated. As shown, cell 5 is marked as visited and pushed onto the stack.

Step 11: Final Step Cell 2 is the only remaining cell to be visited in the algorithm. It is also the only possible adjacent cell to visit from cell 5. The north wall of cell 5 is eliminated. The south wall of Cell 2 eliminated. Cell 2 is marked as visited. All cells have been visited. There is exactly one path between any two cells.