DOC PREVIEW
Berkeley COMPSCI 188 - CSPs (6PP)

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Announcements Project 1: Search is due next week Written 1: Search and CSPs out soon Piazza: check it out if you haven’tCS 188: Artificial IntelligenceFall 2011Lecture 4: Constraint Satisfaction9/6/2011Dan Klein – UC BerkeleyMultiple slides adapted from Stuart Russell or Andrew Moore 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 problems3Constraint 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 Xiwith 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 algorithms4Example: Map-Coloring Variables: Domain: Constraints: adjacent regions must have different colors Solutions are assignments satisfying all constraints, e.g.:5Example: N-Queens Formulation 1: Variables: Domains: Constraints62Example: N-Queens Formulation 2: Variables: Domains: Constraints:Implicit:Explicit:-or-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]Example: Cryptarithmetic Variables (circles): Domains: Constraints (boxes):9Example: Sudoku Variables: Each (open) square Domains: {1,2,…,9} Constraints:9-way alldiff for each row9-way alldiff for each column9-way alldiff for each region(or can have a bunch of pairwise inequality constraints)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?11Varieties of CSPs Discrete Variables Finite domains Size d means O(dn) 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)123Varieties 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)13Real-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…14Standard Search Formulation Standard search formulation of CSPs (incremental) Let's start with the straightforward, dumb approach, then fix it States defined by the values assigned so far (partial assignments) 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 15Search Methods What would BFS do? What would DFS do? What problems does this approach have?[demo: dfs]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 ≈ 2517Backtracking Search Backtracking = DFS + var-ordering + fail-on-violation What are the choice points?[demo: backtracking]4Backtracking Example19Improving 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?20Ordering: 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” ordering21Ordering: 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 feasible23Filtering: Forward Checking Idea: Keep track of remaining legal values for unassigned variables (using immediate constraints) Idea: Terminate when any variable has no legal valuesWASANTQNSWV24[demo:


View Full Document

Berkeley COMPSCI 188 - CSPs (6PP)

Documents in this Course
CSP

CSP

42 pages

Metrics

Metrics

4 pages

HMMs II

HMMs II

19 pages

NLP

NLP

23 pages

Midterm

Midterm

9 pages

Agents

Agents

8 pages

Lecture 4

Lecture 4

53 pages

CSPs

CSPs

16 pages

Midterm

Midterm

6 pages

MDPs

MDPs

20 pages

mdps

mdps

2 pages

Games II

Games II

18 pages

Load more
Download CSPs (6PP)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CSPs (6PP) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CSPs (6PP) 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?