


































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Nau; Class: INTRO ARTIFICIAL INTELLI; Subject: Computer Science; University: University of Maryland; Term: Fall 2008;
Typology: Exams
1 / 42
This page cannot be seen from the preview
Don't miss anything!



































Last update: September 16, 2008
CMSC 421, Chapter 5
♦ CSP examples
♦ Backtracking search for CSPs
♦ Problem structure and problem decomposition
♦ Local search for CSPs
Western Australia
Northern Territory
South Australia
Queensland
New South Wales
Victoria
Variables W A, N T , Q, N SW , V , SA, T Tasmania Domain of each variable is {red, green, blue} Constraints: adjacent regions must have different colors e.g., W A 6 = N T (if the language allows this), or (W A, N T ) ∈ {(red, green), (red, blue), (green, red), (green, blue), (blue, red), (blue, green)}
Western Australia
Northern Territory
South Australia
Queensland
New South Wales
Victoria
Tasmania
Solutions are assignments that satisfy all the constraints, e.g., {W A = red, N T = green, Q = red, N SW = green, V = red, SA = blue, T = green}
Discrete variables finite domains of size d ⇒ O(dn) complete assignments for n variables ♦ e.g., Boolean CSPs, incl. Boolean satisfiability (NP-complete) infinite domains (integers, strings, etc.) ♦ e.g., job scheduling, variables are start/end days for each job ♦ need a constraint language, e.g., StartJob 1 + 5 ≤ StartJob 3 ♦ linear constraints solvable but NP-hard nonlinear constraints undecidable
Continuous variables ♦ e.g., start/end times for Hubble Space Telescope observations ♦ linear constraints solvable using Linear Programming (LP) methods can be done in polynomial time, but very high overhead usually use a low-overhead algorithm with exponential worst-case
Unary constraints involve a single variable, e.g., SA 6 = green
Binary constraints involve pairs of variables e.g., SA 6 = W A
Preferences (soft constraints), e.g., red is better than green often representable by a cost for each variable assignment e.g., cost(red) = 1, cost(green) = 5 → constrained optimization problems
Higher-order constraints involve 3 or more variables, e.g., cryptarithmetic (next slide)
Assignment problems e.g., who teaches what class
Timetabling problems e.g., which class is offered when and where?
Hardware configuration
Spreadsheets
Transportation scheduling
Factory scheduling
Floorplanning (e.g., factory layouts)
Notice that many real-world problems involve real-valued variables
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: choose an unassigned variable v assign a value to v that doesn’t conflict with the other variables ⇒ fail if no legal assignments
♦ Goal test: the current assignment is complete
function Backtracking-Search(csp) returns solution/failure return Recursive-Backtracking({ }, csp)
function Recursive-Backtracking(assignment, csp) returns soln/failure if assignment is complete then return assignment var ← Select-Unassigned-Variable(Variables[csp], assignment, csp) for each value in Order-Domain-Values(var, assignment, csp) do if value is consistent with assignment given Constraints[csp] then add {var = value} to assignment result ← Recursive-Backtracking(assignment, csp) if result 6 = failure then return result remove {var = value} from assignment return failure
Minimum remaining values (MRV) heuristic:
♦ choose the variable with the fewest legal values
a=1a= b=2 b=
a=1^ a=
b=1 (^) b=4 b=1b=2^ b=3 b=
b=1 (^) b=2 b=3 b=
a=1 a=2 (^) a=1a=2 a=1a=
Degree heuristic:
♦ Choose the variable with the most constraints on remaining variables e.g., suppose a doesn’t constrain b, but c does constrain b:
b=
b=
a=1^ a=
b=1 (^) b= b=
b=1 b=3 b= b=
b=
c=1^ c=
b= b=
b=1 (^) b=
⇒ Use this as a tie-breaker among MRV variables