Document Sample

Computer Science CPSC 322 Lecture 12 Constraint Satisfaction Problems (4.1-4.4) Oct 4, 2010 Announcements • Assignment due on Friday • Remember to USE HANDIN! • Check the Discussion Board: some of your questions may have already been answered there Slide 2 Lecture Overview • Recap of Lecture 11 • Intro to CSP - Variables/Features - Constraints • Algorithms Slide 3 Recap: Search Wrap Up Selection Complete Optimal Time Space DFS LIFO N N O(bm) O(mb) BFS FIFO Y Y O(bm) O(bm) IDS LIFO Y Y O(bm) O(mb) LCFS min cost Y ** Y ** O(bm) O(bm) Best min h N N O(bm) O(bm) First A* min f Y** Y** O(bm) O(bm) B&B LIFO + pruning N Y O(bm) O(mb) IDA* LIFO Y Y O(bm) O(mb) MBA* min f Y** Y** O(bm) O(bm) ** Needs conditions Standard Search VS. CSP • To learn about search we have used it as the reasoning strategy for a simple goal-driven agent. • Standard search problem: An agent can solve a problem by searching in a space of states • State is a “black box” : any arbitrary data structure that supports three problem-specific routines – goal test: goal(state), – heuristic evaluation function: h(state) – finding successor nodes: neighbors(state) • In the next few weeks, we’ll see more specialized versions of search for three problem categories in deterministic settings Course Overview Representation Environment Reasoning Deterministic Stochastic Technique Problem Type Arc Consistency We’ll start Constraint Vars + Satisfaction ConstraintsSearch from CPS Static Belief Nets Query Logics Variable Search Elimination Decision Nets Sequential STRIPS Variable Planning Elimination Search Markov Processes Value Iteration Standard Search vs. Specific R&R systems Constraint Satisfaction (Problems): • State • Successor function • Goal test • Solution Planning : • State • Successor function • Goal test • Solution Inference • State • Successor function • Goal test • Solution CPSC 322, Lecture 11 Slide 7 Constraint Satisfaction Problems (CSP) • In a CSP – state is defined by variables/features Vi with values from domain Di – goal test is a set of constraints specifying (1) allowable combinations of values for subsets of variables (hard constraints) (2) preferences over values of variables (soft constraints) Constraint Satisfaction Problems (CSP) • Allow useful general-purpose algorithms with more power than standard search algorithms • They exploit the multi-dimensional nature of the problem and the structure provided by the goal set of constraints, *not* black box. Lecture Overview • Recap of Lecture 11 • Intro to CSP - Variables/Features - Constraints • Algorithms Slide 10 Dimensions of Representational Complexity (from lecture 2) • Reasoning tasks (Constraint Satisfaction / Logic&Probabilistic Inference / Planning) • Deterministic versus stochastic domains Some other important dimensions of complexity: • Explicit state or features or relations Explicit state or features or relations • Flat or hierarchical representation • Knowledge given versus knowledge learned from experience • Goals versus complex preferences • Single-agent vs. multi-agent Explicit State vs Features (lect. 2) How do we model the environment? • You can enumerate the states of the world. • As we have done in the standard search so far, or • A state can be described in terms of features/variable • Often it is more natural and concise to describe states in terms of assignments of values to features (variables). • 30 binary features (also called propositions) can represent 230=1,073,741,824 states Variables/Features and Possible Worlds • Variables / features • we denote variables using capital letters • each variable V has a domain dom(V) of possible values • Variables can be of several main kinds: • Boolean: |dom(V)| = 2 • Finite: the domain contains a finite number of values • Infinite but Discrete: the domain is countably infinite • Continuous: e.g., real numbers between 0 and 1 • Possible world: a complete assignment of values to a set of variables This is equivalent to a state for the time being, but the term “possible world” is introduced for consistency with later topics, when we will need the distinction between these two terms Example (lecture 2) Mars Explorer Example Weather {S, C} Temperature [-40, 40] Longitude [0, 359] Latitude [0, 179] One possible world (state) {S, -30, 320, 210} Number of possible (mutually exclusive) worlds (states) 2 x 81 x 360 x 180 Examples: Crossword Puzzle • variables are words that have to be filled in • places where words can go e.g. (1 across, 3 down) • domains are valid English words of required length • possible worlds: all ways of assigning words • Number of English words? • Number of words of length k ? • So, how many possible worlds? Lecture Overview • Recap of Lecture 11 • Intro to CSP - Variables/Features - Constraints • Algorithms Slide 16 Constraints • Constraints are restrictions on the values that one or more variables can take • Unary constraint: restriction involving a single variable • k-ary constraint: restriction involving the domains of k different variables • we'll mainly talk about binary constraints • Constraints can be specified by • giving a function that returns true when given values for each variable which satisfies the constraint • giving a list of valid domain values for each variable participating in the constraint • E.g. if we have domain variables X1 and X2, both with domain {a, b}, we can specify the constaint “X1 and X2 must have different values as • X1 ≠ X2 or [(a, b) (b, a)] Slide 17 Examples • Crossword Puzzle: • variables are words that have to be filled in • domains are valid English words • constraints: words have the same letters at points where they intersect Slide 18 Example: Map-Coloring • Map Coloring Problem • variable: regions on the map • domains: possible colors • possible worlds: color assignments for each region • how many possible worlds? Slide 19 Example: Map-Coloring Variables WA, NT, Q, NSW, V, SA, T Domains Di = {red,green,blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, Or (WA,NT) in Example CSP (1) • The delivery robot needs to schedule 5 activities, A,B,C,D, E • Each activity happens at either time 1, 2, 3, 4 • Constraints – B cannot start at 3, C cannot start at 2 (unary constraints) – A cannot start at the same time as B, and B cannot start as the same time as C or D (binary constraints) – C must start before D, E must start before any other activity (binary constraints) – A must start as the same time as D (binary constraints) Example: scheduling activities Example 2 • Eight Queen problem: place 8 queens on a chessboard so that no queen can attack the others • Constraints: No queens can be in the same row, column or diagonal Example 2: 8 queens • Variables: V1 ,.. Vn. Vi = Row occupied by the ith queen in the ith column • D Vi = {1,2,3,4,5,6,7,8} • We can specify the constraints by enumerating explicitly, for each pair of columns, what positions are allowed. Ex: Constr(V1 , V2) = {(1,3), (1,4),..(1,8)(2,4)(2,5)…(8,6)} Constraint Satisfaction Problems Definition (Constraint Satisfaction Problem) A constraint satisfaction problem consists of • a set of variables • a domain for each variable • a set of constraints Definition (model / solution) A model of a CSP is an assignment of values to variables that satisfies all of the constraints. Example: Map-Coloring Models / Solutions are complete and consistent assignments, e.g., WA = red, NT = green, Q = red, NSW = green, V = red,SA = blue, T = green Slide 27 Constraint Satisfaction Problem: Variants We may want to solve the following problems using a CSP • determine whether or not a model exists • find a model • find all of the models • count the number of models • find the best model given some model quality • this is now an optimization problem • determine whether some properties of the variables hold in all models Solving FCSPs The finite constraint satisfaction problem is NP-hard. (exponential in the size of the variables’ domains) We can: • Try to find algorithms that work well on typical cases even though the worst case may be exponential • Try to find efficient approximation algorithms Next Class • Recap of Lecture 11 • Intro to CSP - Variables/Features - Constraints • Algorithms Slide 30 Learning Goals for today’s class • Define possible worlds in term of variables and their domains. • Compute number of possible worlds on real examples • Specify constraints to represent real world problems differentiating between: • Unary and k-ary constraints • List vs. function format. Verify whether a possible world satisfies a set of constraints (i.e., whether it is a model, a solution) CPSC 322, Lecture 4 Slide 31

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 5 |

posted: | 4/26/2011 |

language: | English |

pages: | 30 |

OTHER DOCS BY gjjur4356

How are you planning on using Docstoc?
BUSINESS
PERSONAL

Feel free to Contact Us with any questions you might have.