Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.
-
Upload
stewart-singleton -
Category
Documents
-
view
223 -
download
0
Transcript of Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.
![Page 1: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/1.jpg)
Introduction to Artificial Intelligence
Class 1 Planning & Search
Introduction to Artificial Intelligence
Class 1 Planning & Search
Henry Kautz
Winter 2007
![Page 2: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/2.jpg)
Outline of CourseOutline of Course
Heuristic search
Constraint satisfaction
Automated planning
Propositional logic
First-order logic and logic programming
Knowledge engineering
Probabilistic reasoning: directed and undirected graphical models
Learning graphical models
Decision trees and ensemble methods
Neural networks
![Page 3: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/3.jpg)
3
Planning
Input
• Description of initial state of world
• Description of goal state(s)
• Description of available actions– Optional: Cost for each action
Output
• Sequence of actions that converts the initial state into a goal state
• May wish to minimize length or cost of plan
![Page 4: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/4.jpg)
Classical PlanningClassical Planning
• Atomic time• Deterministic actions • Complete knowledge• No numeric reward (just goals)• Only planner changes world
![Page 5: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/5.jpg)
Route PlanningRoute Planning
State = intersection
Operators = block between intersections
Operator cost = length of block
![Page 6: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/6.jpg)
Blocks WorldBlocks World
Control a robot arm that can pick up and stack blocks.
• Arm can hold exactly one block
• Blocks can either be on the table, or on top of exactly one other block
State = configuration of blocks
• { (on-table G), (on B G), (clear B), (holding R) }
Operator = pick up or put down a block
• (put-down R) put on table
• (stack R B) put on another block
![Page 7: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/7.jpg)
State SpaceState Space
pick-up(R)
pick-up(G)
stack(R,B)
put-down(R)
stack(G,R)
Planning = Finding (shortest) paths in state graph
![Page 8: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/8.jpg)
STRIPS RepresentationSTRIPS Representation
(define (domain prodigy-bw)
(:requirements :strips)
(:predicates
(on ?x ?y)
(on-table ?x)
(clear ?x)
(arm-empty)
(holding ?x))
![Page 9: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/9.jpg)
Problem InstanceProblem Instance
(define (problem bw-sussman)
(:domain prodigy-bw)
(:objects A B C)
(:init
(on-table a) (on-table b) (on c a)
(clear b) (clear c) (arm-empty))
(:goal
(and (on a b) (on b c))))
goal may be a partial
description
![Page 10: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/10.jpg)
Operator SchemasOperator Schemas
(:action stack
:parameters (?obj ?under_obj)
:precondition
(and (holding ?obj) (clear ?under_obj))
:effect
(and (not (holding ?obj))
(not (clear ?under_obj))
(clear ?obj)
(arm-empty)
(on ?obj ?under_obj)))
delete effects –
make false
add effects –
make true
![Page 11: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/11.jpg)
Blocks World Blackbox Planner Demo
Blocks World Blackbox Planner Demo
![Page 12: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/12.jpg)
Search AlgorithmsSearch Algorithms
Today: Space-State Search• Depth-First• Breadth-First• Best-First• A*
Next Class:• Local Search• Constraint Satisfaction
![Page 13: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/13.jpg)
A General Search AlgorithmA General Search Algorithm
Search( Start, Goal_test, Criteria )Open = { Start }; Closed = { };repeat
if (empty(Open)) return fail;select Node from Open using Criteria;if (Goal_test(Node)) return Node;for each Child of node do
if (Child not in Closed)Open = Open U { Child };
Closed = Closed U { Node };
Closed list optional
![Page 14: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/14.jpg)
Breadth-First SearchBreadth-First Search
Search( Start, Goal_test, Criteria )Open: fifo_queue;Closed: hash_table;enqueue(Start, Open);repeat
if (empty(Open)) return fail;Node = dequeue(Open);if (Goal_test(Node)) return Node;for each Child of node do
if (not find(Child, Closed))enqueue(Child, Open)
insert(Child, Closed)
Criteria = shortest distance from Start
![Page 15: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/15.jpg)
Depth-First SearchDepth-First Search
Search( Start, Goal_test, Criteria )Open: stack;Closed: hash_table;push(Start, Open);repeat
if (empty(Open)) return fail;Node = pop(Open);if (Goal_test(Node)) return Node;for each Child of node do
if (not find(Child, Closed))push(Child, Open)
insert(Child, Closed)
Criteria = longest distance from Start
![Page 16: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/16.jpg)
Best-First SearchBest-First Search
Search( Start, Goal_test, Criteria )Open: priority_queue;Closed: hash_table;enqueue(Start, Open, heuristic(Start));repeat
if (empty(Open)) return fail;Node = dequeue(Open);if (Goal_test(Node)) return Node;for each Child of node do
if (not find(Child, Closed))enqueue(Child, Open, heuristic(Child))
insert(Child, Closed)
Criteria = shortest heuristic estimate of distance to goal
![Page 17: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/17.jpg)
PropertiesProperties
Depth First• Simple implementation (stack)• Might not terminate• Might find non-optimal solution
Breadth First • Always terminates if solution exists• Finds optimal solutions• Visits many nodes
Best First• Always terminates if heuristic is “reasonable”• Visits many fewer nodes• May find non-optimal solution
![Page 18: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/18.jpg)
Best-First with Manhattan Distance ( x+ y) Heuristic
Best-First with Manhattan Distance ( x+ y) Heuristic
52nd St
51st St
50th St
10th A
ve
9th A
ve
8th A
ve
7th A
ve
6th A
ve
5th A
ve
4th A
ve
3rd A
ve
2nd A
ve
S
G
53nd St
![Page 19: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/19.jpg)
Non-Optimality of Best-FirstNon-Optimality of Best-First
52nd St
51st St
50th St
10th A
ve
9th A
ve
8th A
ve
7th A
ve
6th A
ve
5th A
ve
4th A
ve
3rd A
ve
2nd A
ve
S G
53nd St
![Page 20: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/20.jpg)
A*A*
Criteria: minimize (distance from start) + (estimated distance to
goal)
Implementation: priority queue
f(n) = g(n) + h(n)
f(n) = priority of a nodeg(n) = true distance from starth(n) = heuristic distance to goal
![Page 21: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/21.jpg)
Optimality of A*Optimality of A*
Suppose the estimated distance is always less than or equal to the true distance to the goal
• heuristic is a lower bound
• heuristic is admissible
Then: when the goal is removed from the priority queue, we are guaranteed to have found a shortest path!
![Page 22: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/22.jpg)
Maze Runner DemoMaze Runner Demo
![Page 23: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/23.jpg)
Observations on A*Observations on A*
Perfect heuristic: If h(n) = h*(n) (true distance) for all n, then only the nodes on the optimal solution path will be expanded.
Null heuristic: If h(n) = 0 for all n, then this is an admissible heuristic and A* acts like breath-first search.
Comparing heuristics: If h1(n) h2(n) h*(n) for all non-goal nodes, then h2 is as least as good a heuristic as h1
• Every node expanded by A* using h2 is also expanded by A* using h1
• if h1(n)<h1(n) for some n, then h2 is stronger than h1
Combining heuristics: if h1(n) and h2(n) are admissible, then h3(n) = MAX(h1(n),h2(n)) is admissible
• Why?
![Page 24: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/24.jpg)
Search HeuristicsSearch Heuristics
“Optimistic guess” at distance to a solution
Some heuristics are domain specific
• Manhattan distance for grid-like graphs
• Euclidean distance for general road maps
• Rubik’s Cube– Admissible, but weak: # cubits out of place / 8
– Better:MAX( Sum( Manhattan distance edge cubits
)/4, Sum( Manhattan distance corner cubits )/4 )
![Page 25: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/25.jpg)
Planning HeuristicsPlanning Heuristics
A useful non-admissible heuristic for planning is the number of goals that need to be achieved
• Why not admissible?
Good admissible heuristics for planning can be created by relaxing the operators, e.g.:
• Eliminate preconditions, or
• Eliminate negative preconditions & effects
Use the length of the solution to the relaxed problem as a heuristic for the length of the solution to the original problem
![Page 26: Introduction to Artificial Intelligence Class 1 Planning & Search Henry Kautz Winter 2007.](https://reader035.fdocuments.us/reader035/viewer/2022062301/5697bfd01a28abf838caa5a9/html5/thumbnails/26.jpg)
HomeworkHomework
Shakey the robot has to bring coffee to Prof. Kautz. In order to make the coffee, Shakey will need to gather coffee filters, coffee, and Prof. Kautz's mug and bring them to the coffee maker in the kitchen. The coffee and filters are in the supply room, but it is locked. To unlock the supply room, Shakey will need to get the key from Prof. Kautz's office.
Represent this problem in STRIPS notation
What is the true value of the start state?
What is the heuristic value of the start start, based on rhe relaxed problem with no preconditions on actions?