AI Unit 2 Algorithms
AI Unit 2 Algorithms
Compose
And Op(x) = Op(y)
Using compose
standardize (FOLexp)
subst(theta, FOLexp
kind
name
op
args
isVar
firstArg
restArgs
FOLexp
rprint
# recursive function to build the structure
# e is a list of strings that needs to be parsed into a FOLexp
#that was the easy case, now we have to find the arguments
# and use slices to recursively build the component objects
# get ready to parse the argument list
# skip the final ']'
# here we parse the argument list
# get end pt of next arg
• Uninformed
• Time?
• Space?
• Optimal?
appears
• Complete?
• Time?
• Space?
• Optimal?
admissible
true
never overestimates
optimistic
• Theorem
consistent
• Theorem
• Complete?
• Time?
• Space?
• Optimal?
• h1(S) = ?
• h2(S) = ?
• h1(S) = ?
• h2(S) = ?
www.StudentRockStars.com
www.StudentRockStars.com
www.StudentRockStars.com
Outline
♦ CSP examples
♦ Backtracking search for CSPs
♦ Problem structure and problem decomposition
♦ Local search for CSPs
Chapter 5 2
www.StudentRockStars.com
www.StudentRockStars.com
CSP:
state is defined by variables Xi with values from domain Di
Chapter 5 3
www.StudentRockStars.com
www.StudentRockStars.com
Example: Map-Coloring
Northern
Territory
Western Queensland
Australia
South
Australia
New South Wales
Victoria
Tasmania
Variables W A, NT , Q, NSW , V , SA, T
Domains Di = {red, green, blue}
Constraints: adjacent regions must have different colors
e.g., W A 6= NT (if the language allows this), or
(W A, NT ) ∈ {(red, green), (red, blue), (green, red), (green, blue), . . .}
Chapter 5 4
www.StudentRockStars.com
www.StudentRockStars.com
Northern
Territory
Western Queensland
Australia
South
Australia
New South Wales
Victoria
Tasmania
Chapter 5 5
www.StudentRockStars.com