AI Unit 2 Algorithms
AI Unit 2 Algorithms
AI Unit 2 Algorithms
Using compose
Assignment 4b. Now Due Feb 23, 10am
In one file:
standardize (FOLexp) returns a FOLexp object with the variables
replaced with new variables with unique names.
unify(FOLexp1, FOLexp2, [])
returns None or a substitution, which is a list of variable/term
pairs (2 element lists)
Note: using “Compose” method you must also implement
subst(theta, FOLexp) and apply it correctly.
www.StudentRockStars.com
• Recursive implementation:
• Complete? Yes
•
• Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd)
•
• Space? O(bd) www.StudentRockStars.com
•
• Optimal? Yes, if step cost = 1
www.StudentRockStars.com
Outline
• Heuristics
• Best-first search
• Greedy best-first search
• A* search
• Implementation:
Order the nodes in fringe in decreasing order of desirability
• Optimal? No
A* search
• If h is consistent, we have
f(n') = g(n') + h(n')
= g(n) + c(n,a,n') + h(n')
≥ g(n) + h(n)
= f(n)
• h1(S) = ?
• h2(S) = ?
•
Admissible heuristics
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18