Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Artificial Intelligence Lecture 6: Constraint Satisfaction Problems (CSP) - Prof. Derek Ha, Assignments of Computer Science

A lecture note from csci 533: artificial intelligence course at texas a&m university - commerce, fall 2007. The lecture covers constraint satisfaction problems (csps), their formal representation, varieties, and search methods such as backtracking search and constraint propagation. The document also discusses the concept of constraint graphs and their role in solving csps.

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-bqo
koofers-user-bqo 🇺🇸

10 documents

1 / 42

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSci 533: Artificial Intelligence
Fall 2007
Lecture 6: CSP
10/04/2007
Derek Harter – Texas A&M University - Commerce
Many slides over the course adapted from Srini Narayanan,
Dan Klein, Stuart Russell or Andrew Moore
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a

Partial preview of the text

Download Artificial Intelligence Lecture 6: Constraint Satisfaction Problems (CSP) - Prof. Derek Ha and more Assignments Computer Science in PDF only on Docsity!

CSci 533: Artificial Intelligence

Fall 2007

Lecture 6: CSP

Derek Harter – Texas A&M University - Commerce Many slides over the course adapted from Srini Narayanan, Dan Klein, Stuart Russell or Andrew Moore

Announcements

Assignment 2 is up

Today

 CSP

 Formulation

 Propagation

 Applications

Constraint Satisfaction Problems

 Standard search problems:

 (^) State is a “black box”: any old data structure  (^) Goal test: any function over states  (^) Successors: any map from states to sets of states

 Constraint satisfaction problems (CSPs):

 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

Example: Map-Coloring

 Solutions are complete and consistent

assignments, e.g., WA = red, NT = green,Q =

red,NSW = green,V = red,SA = blue,T = green

Constraint Graphs

 Binary CSP: each constraint

relates (at most) two variables

 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!

Varieties 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  (^) Need a constraint language , e.g., StartJob 1 + 5 < StartJob 3  (^) 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)

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)

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

 fail if no legal assignment

 Goal test: the current assignment is complete and

satisfies all constraints

Search Methods

 What does DFS do?

 What’s the obvious problem here?

 What’s the slightly-less-obvious problem?

Backtracking Search

 Idea 1: Only consider a single variable at each point:

 (^) Variable assignments are commutative  (^) 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

 Depth-first search for CSPs with these two improvements is called

backtracking search

 Backtracking search is the basic uninformed algorithm for CSPs

 Can solve n-queens for n ≈ 25

Backtracking Search

 What are the choice points?

Improving Backtracking

 General-purpose ideas can give huge gains in

speed:

 Which variable should be assigned next?

 In what order should its values be tried?

 Can we detect inevitable failure early?

 Can we take advantage of problem structure?

Minimum Remaining Values

 Minimum remaining values (MRV):

 Choose the variable with the fewest legal values

 Why min rather than max?

 Called most constrained variable

 “Fail-fast” ordering