Announcements. CS 188: Artificial Intelligence Fall 2010

Similar documents
CS 188: Artificial Intelligence Fall 2011

CSE 473: Artificial Intelligence

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

CS 343: Artificial Intelligence

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

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

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

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

CS 188: Artificial Intelligence Fall 2008

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

Constraint Satisfaction Problems

Constraint Satisfaction Problems (CSPs)

CS 4100 // artificial intelligence

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

CS 188: Artificial Intelligence. Recap: Search

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

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

CS 188: Artificial Intelligence Spring Announcements

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

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

CS 188: Artificial Intelligence Spring Announcements

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

Constraint Satisfaction Problems

CS 188: Artificial Intelligence Fall 2011

Constraint Satisfaction

Constraint Satisfaction Problems. Chapter 6

Constraint Satisfaction Problems

Constraint Satisfaction Problems

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

Lecture 6: Constraint Satisfaction Problems (CSPs)

Constraint Satisfaction Problems

CS W4701 Artificial Intelligence

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

Chapter 6 Constraint Satisfaction Problems

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

CS 188: Artificial Intelligence Fall 2008

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

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

Constraint Satisfaction. AI Slides (5e) c Lin

Constraint Satisfaction Problems

Artificial Intelligence

Constraint Satisfaction Problems Part 2

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

Artificial Intelligence Constraint Satisfaction Problems

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

Outline. Best-first search

Constraint Satisfaction Problems

Constraint Satisfaction Problems

Week 8: Constraint Satisfaction Problems

CS 188: Artificial Intelligence Spring Today

Constraint Satisfaction Problems

CS 188: Artificial Intelligence

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

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

CS 771 Artificial Intelligence. Constraint Satisfaction Problem

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

CS 188: Artificial Intelligence

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

Iterative improvement algorithms. Today. Example: Travelling Salesperson Problem. Example: n-queens

Constraint Satisfaction Problems

Constraint Satisfaction Problems (CSPs) Introduction and Backtracking Search

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

ARTIFICIAL INTELLIGENCE (CS 370D)

Constraint Satisfaction Problems

CONSTRAINT SATISFACTION

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

Constraint Satisfaction Problems

Announcements. CS 188: Artificial Intelligence Spring Production Scheduling. Today. Backtracking Search Review. Production Scheduling

Constraint Satisfaction Problems

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

CS 188: Artificial Intelligence

CSE 573: Artificial Intelligence

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

Outline. Best-first search

Spezielle Themen der Künstlichen Intelligenz

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

Constraint Satisfaction Problems. Chapter 6

Foundations of Artificial Intelligence

CS 188: Artificial Intelligence. Recap Search I

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

Map Colouring. Constraint Satisfaction. Map Colouring. Constraint Satisfaction

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

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

Artificial Intelligence

Artificial Intelligence

CS 4100/5100: Foundations of AI

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

Example: Map coloring

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

CONSTRAINT SATISFACTION

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

CONSTRAINT SATISFACTION

Discussion Section Week 1

CS 343: Artificial Intelligence

Mathematical Programming Formulations, Constraint Programming

General Methods and Search Algorithms

Constraint Satisfaction Problems

Today. Informed Search. Graph Search. Heuristics Greedy Search A* Search

K-Consistency. CS 188: Artificial Intelligence. K-Consistency. Strong K-Consistency. Constraint Satisfaction Problems II

Constraint Satisfaction Problems (CSP)

Transcription:

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 4: Constraint Satisfaction 9/7/2010 Dan Klein UC Berkeley Multiple slides adapted from Stuart Russell or Andrew Moore 1

Today Search Conclusion Constraint Satisfaction Problems A* Review A* uses both backward costs g and forward estimate h: f(n) = g(n) + h(n) A* tree search is optimal with admissible heuristics (optimistic future cost estimates) Heuristic design is key: relaxed problems can help 2

A* Graph Search Gone Wrong State space graph Search tree S h=2 A 1 h=4 1 B h=1 2 1 h=1 C 3 G S (0+2) A (1+4) B (1+1) C (2+1) C (3+1) G (5+0) G (6+0) h=0 Consistency A h=4 1 C h=1 Definition: cost(a to C) + h(c) h(a) Consequences: G 3 The f value along a path never decreases Non-decreasing f means you re optimal to every state (not just goals) A* graph search is optimal 3

What is Search For? Models of the world: single agents, deterministic actions, fully observed state, discrete state space Planning: sequences of actions The path to the goal is the important thing Paths have various costs, depths Heuristics to guide, fringe to keep backups Identification: assignments to variables The goal itself is important, not the path All paths at the same depth (for some formulations) CSPs are specialized for identification problems 7 Constraint Satisfaction Problems Standard search problems: State is a black box : arbitrary data structure Goal test: any function over states Successor function can be anything Constraint satisfaction problems (CSPs): A special subset of search problems State is defined by variables X i with values from a domain D (sometimes D depends on i) Goal test is a set of constraints specifying allowable combinations of values for subsets of variables Simple example of a formal representation language Allows useful general-purpose algorithms with more power than standard search algorithms 8 4

Example: Map-Coloring Variables: Domain: Constraints: adjacent regions must have different colors Solutions are assignments satisfying all constraints, e.g.: 9 Example: N-Queens Formulation 1: Variables: Domains: Constraints 10 5

Formulation 2: Variables: Example: N-Queens Domains: Implicit: -or- Explicit: Constraints: Constraint Graphs Binary CSP: each constraint relates (at most) two variables Binary constraint graph: nodes are variables, arcs show constraints General-purpose CSP algorithms use the graph structure to speed up search. E.g., Tasmania is an independent subproblem! [demo: n-queens] 6

Example: Cryptarithmetic Variables (circles): Domains: Constraints (boxes): 13 Example: Sudoku Variables: Each (open) square Domains: {1,2,,9} Constraints: 9-way alldiff for each column 9-way alldiff for each row 9-way alldiff for each region 7

Example: The Waltz Algorithm The Waltz algorithm is for interpreting line drawings of solid polyhedra An early example of a computation posed as a CSP Look at all intersections Adjacent intersections impose constraints on each other? 15 Varieties of CSPs Discrete Variables Finite domains Size d means O(d n ) complete assignments E.g., Boolean CSPs, including Boolean satisfiability (NP-complete) Infinite domains (integers, strings, etc.) E.g., job scheduling, variables are start/end times for each job Linear constraints solvable, nonlinear undecidable Continuous variables E.g., start/end times for Hubble Telescope observations Linear constraints solvable in polynomial time by LP methods (see cs170 for a bit of this theory) 16 8

Varieties of Constraints Varieties of Constraints Unary constraints involve a single variable (equiv. to shrinking domains): Binary constraints involve pairs of variables: Higher-order constraints involve 3 or more variables: e.g., cryptarithmetic column constraints Preferences (soft constraints): E.g., red is better than green Often representable by a cost for each variable assignment Gives constrained optimization problems (We ll ignore these until we get to Bayes nets) 17 Real-World CSPs Assignment problems: e.g., who teaches what class Timetabling problems: e.g., which class is offered when and where? Hardware configuration Transportation scheduling Factory scheduling Floorplanning Fault diagnosis lots more! Many real-world problems involve real-valued variables 18 9

Standard Search Formulation Standard search formulation of CSPs (incremental) Let's start with the straightforward, dumb approach, then fix it States are defined by the values assigned so far Initial state: the empty assignment, {} Successor function: assign a value to an unassigned variable Goal test: the current assignment is complete and satisfies all constraints Simplest CSP ever: two bits, constrained to be equal 19 What would BFS do? Search Methods What would DFS do? What problems does this approach have? [demo: dfs] 10

Backtracking Search Idea 1: Only consider a single variable at each point Variable assignments are commutative, so fix ordering I.e., [WA = red then NT = green] same as [NT = green then WA = red] Only need to consider assignments to a single variable at each step How many leaves are there? Idea 2: Only allow legal assignments at each point I.e. consider only values which do not conflict previous assignments Might have to do some computation to figure out whether a value is ok Incremental goal test Depth-first search for CSPs with these two improvements is called backtracking search (useless name, really) [DEMO] Backtracking search is the basic uninformed algorithm for CSPs Can solve n-queens for n 25 21 Backtracking Search Backtracking = DFS + var-ordering + fail-on-violation What are the choice points? [demo: backtracking] 11

Backtracking Example 23 Improving Backtracking General-purpose ideas give huge gains in speed Ordering: Which variable should be assigned next? In what order should its values be tried? Filtering: Can we detect inevitable failure early? Structure: Can we exploit the problem structure? 24 12

Minimum Remaining Values Minimum remaining values (MRV): Choose the variable with the fewest legal values Why min rather than max? Also called most constrained variable Fail-fast ordering 25 Least Constraining Value Given a choice of variable: Choose the least constraining value The one that rules out the fewest values in the remaining variables Note that it may take some computation to determine this! Why least rather than most? Combining these heuristics makes 1000 queens feasible 27 13

Filtering: Forward Checking Idea: Keep track of remaining legal values for unassigned variables (using immediate constraints) Idea: Terminate when any variable has no legal values WA NT SA Q NSW V 28 [demo: forward checking animation] Filtering: Constraint Propagation WA NT SA Q NSW V 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! Why didn t we detect this yet? Constraint propagation propagates from constraint to constraint 29 14

Consistency of An Arc An arc X Y is consistent iff for every x in the tail there is some y in the head which could be assigned without violating a constraint WA NT SA Q NSW V Delete from tail! Forward checking = Enforcing consistency of each arc pointing to the new assignment 30 Arc Consistency of a CSP NT WA SA A simple form of propagation makes sure all arcs are consistent: Q NSW V Delete from tail! If X loses a value, neighbors of X need to be rechecked! Arc consistency detects failure earlier than forward checking What s the downside of enforcing arc consistency? Can be run as a preprocessor or after each assignment 31 15

Arc Consistency Runtime: O(n 2 d 3 ), can be reduced to O(n 2 d 2 ) but detecting all possible future problems is NP-hard why? [DEMO] Limitations of Arc Consistency After running arc consistency: Can have one solution left Can have multiple solutions left Can have no solutions left (and not know it) What went wrong here? 33 16