




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: Assignment; Class: Intro Artificial Intelligence; Subject: Computer Science; University: George Mason University; Term: Unknown 1989;
Typology: Assignments
1 / 8
This page cannot be seen from the preview
Don't miss anything!





Chapter 3, Section 7 and Chapter 4, Section 4.
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 1
Standard search problem: state is a “black box”—any old data structure that supports goal test, eval, successor
CSP: state is defined by variables Vi with values from domain Di
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
Assume one queen in each column. Which row does each one go in?
Variables Q 1 , Q 2 , Q 3 , Q 4
Domains Di = { 1 , 2 , 3 , 4 }
Constraints Q (^) i 6 = Q (^) j (cannot be in same row) |Q (^) i − Q (^) j| 6 = |i − j| (or same diagonal) 1
Translate each constraint into set of allowable values for its variables
E.g., values for (Q 1 , Q 2 ) are (1, 3) (1, 4) (2, 4) (3, 1) (4, 1) (4, 2)
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 3
Binary CSP: each constraint relates at most two variables
Constraint graph: nodes are variables, arcs show constraints
Let’s start with the straightforward, dumb approach, then fix it
States are defined by the values assigned so far
Initial state: all variables unassigned
Operators: assign a value to an unassigned variable
Goal test: all variables assigned, no constraints violated
Notice that this is the same for all CSPs!
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 7
CSP state keeps track of which variables have values so far Each variable has a domain and a current value
datatype CSP-State components: Unassigned, a list of variables not yet assigned Assigned, a list of variables that have values datatype CSP-Var components: Name, for i/o purposes Domain, a list of possible values Value, current value (if any)
Constraints can be represented explicitly as sets of allowable values, or implicitly by a function that tests for satisfaction of the constraint
UNASSIGNED ASSIGNED
C1 C2 C
UNASSIGNED ASSIGNED
C2 C C1 = RED
UNASSIGNED ASSIGNED
UNASSIGNED ASSIGNED
C1 C C2 = BLUE
C1 C C3 = GREEN
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 9
Max. depth of space m = ?? n (number of variables)
Depth of solution state d = ?? n (all vars assigned)
Search algorithm to use?? depth-first
This can be improved dramatically by noting the following:
More intelligent decisions on which value to choose for each variable which variable to assign next
Given C 1 = Red, C 2 = Green, choose C 3 = ?? . Given C 1 = Red, C 2 = Green, what next?? .
C 1 C 2 C 3
C 5 C 6 C 4
Can solve n-queens for n ≈ 1000
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 13
More intelligent decisions on which value to choose for each variable which variable to assign next
Given C 1 = Red, C 2 = Green, choose C 3 = ?? C 3 = Green: least-constraining-value Given C 1 = Red, C 2 = Green, what next?? C 5 : most-constrained-variable
C 1 C 2 C 3
C 5 C 6 C 4
Can solve n-queens for n ≈ 1000
Hill-climbing, simulated annealing typically work with “complete” states, i.e., all variables assigned
To apply to CSPs: allow states with unsatisfied constraints operators reassign variable values
Variable selection: randomly select any conflicted variable
min-conflicts heuristic: choose value that violates the fewest constraints i.e., hillclimb with h(n) = total number of violated constraints
CS 580, Jana Kosecka, Chapter 3, Section 7 and Chapter 4, Section 4.4 15
CSPs are a special kind of problem: states defined by values of a fixed set of variables goal test defined by constraints on variable values
Backtracking = depth-first search with
Forward checking prevents assignments that guarantee later failure
Variable ordering and value selection heuristics help significantly