Download Search Strategies

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Artificial intelligence in video games wikipedia , lookup

AI winter wikipedia , lookup

Technological singularity wikipedia , lookup

Embodied cognitive science wikipedia , lookup

Philosophy of artificial intelligence wikipedia , lookup

History of artificial intelligence wikipedia , lookup

Ethics of artificial intelligence wikipedia , lookup

Intelligence explosion wikipedia , lookup

Existential risk from artificial general intelligence wikipedia , lookup

Transcript
Class Overview
Introduction to Artificial Intelligence
COMP 3501 / COMP 4704-4
Lecture 2
Prof. Nathan Sturtevant
JGH 318
Nathan Sturtevant
Problem Solving Agents
Problem Solving Agents: Assumptions
• Requires a goal
• Assume world is:
• Requires actions
• Observable
• What actions?
• Discrete
• Requires state representation
• Known
• How should state be represented?
Nathan Sturtevant
Introduction to Artificial Intelligence
• Deterministic
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Problem Solving Agents: Approach
Sample Domains
• General approach is called “search”
• Vacuum world
• Input: environment, start state, goal state
• Sliding-tile puzzle
• Env.: states, actions, transitions, costs, goal test
• Output: sequence of actions
• 8-queen puzzle
• Path planning
• Actions are executed after planning
• Percepts are ignored when executing plan
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Vacuum world
Vacuum world
• States:
• States: All combinations of agent & dirt locations [8]
• Initial state:
• Initial state: Any state
• Actions:
• Actions: Left / Right / Suck
• Transitions:
• Transitions: Left / Right put you in Left / Right cell
• Suck removes dirt
• Goal test:
• Goal test: No dirt
• Action Cost:
• Action Cost: 1 for all actions
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
rld
,vacuum
start in #5. world
Solution??
1
#5. Solution??
Solution??
nn #5.
2
2
n??
2
3
4
2
1
5
4
4
7
7
• Transitions:
8
7
7
8
8
• Initial state:
6
6
6
• States:
6 • Actions:
5
4
8
Sliding Tile Puzzle
4
5
5
5
8
3
2
6
3
7
2
2
3
3
6
6
6
2
11
4
4
4
1
8
8
• Goal test:
• Action Cost:
8
Nathan Sturtevant
Path planning
Path planning variations
• States:
• Traveling sales problem
• Initial state:
• Rectangle packing
• Actions:
• Transitions:
Chapter 3
Chapter 3
Chapter 3
Chapter 3
8
Introduction to Artificial Intelligence
• Robot
Chapter navigation
3
8
8
Chapter 3
8
8
Chapter 3
Chapter 3
• 8Multi-agent planning
8
8
• Goal test:
• Action Cost:
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Search Terminology
General Best-First Search
• Search tree: implicit/explicit set of searched states
• Open list: set of states considered next for expansion
• Node: single state in tree
• Also called “search frontier”
• Multiple nodes may represent the same state
• Expansion: generating the neighbors of a state
• Children: new neighbors of a state
• States are ordered by some priority of “best”
• Closed list: set of states which have been expanded
• Not all algorithms maintain a closed list
• Parent: state from which neighbors were generated
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Algorithm Performance Measures
• Completeness:
• Will we always find a solution when one exists?
• Optimality:
• Will we find the shortest possible solution?
• Time complexity:
• How long will it take to find a solution?
• Space complexity:
• How much storage is required?
Nathan Sturtevant
Introduction to Artificial Intelligence
Uninformed search strategies
Introduction to Artificial Intelligence
Breadth-first search
• Special case of best-first search
• Best is by minimum depth
• Can be implemented by a FIFO queue
Nathan Sturtevant
Introduction to Artificial Intelligence
Breadth-first search
Depth-first search
• Complete?
• Special case of best-first search
• Best is by maximum depth
• Optimal?
• Time complexity?
• Can be implemented by a LIFO queue
• Space complexity?
• Implications of space complexity?
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Depth-first search
• Complete?
• Optimal?
• Time complexity?
• Space complexity?
• Implications for infinite graphs?
Nathan Sturtevant
Depth-first iterative deepening
• Iterated depth-first search
• Iteratively perform depth-first search
• Each iteration has a depth bound
• Gradually increase depth bound until a solution is
found
Nathan Sturtevant
Introduction to Artificial Intelligence
Introduction to Artificial Intelligence
Depth-first search
Uniform-cost (Dijkstra) search
• Complete?
• Special case of best-first search
• Best is by minimum cost
• Optimal?
• Time complexity?
• Priority queue needed to sort nodes by cost
• g-cost is the cost from the start to current state
• Space complexity?
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Uniform-cost search
• Complete?
2
• Optimal?
• Time complexity?
2
• Space complexity?
2
Nathan Sturtevant
Introduction to Artificial Intelligence
Uninformed vs. informed search
Heuristic function
• Previous approaches were goal agnostic
• A heuristic estimates the cost to the goal from a state
• Given the same start state the search is identical
• Incorporate information about the goal into the search
• h(s) or h(s, g)
• We are interested in admissible heuristics
• Where h*(s) is a perfect heuristic
• For an admissible heuristic h(s) ! h*(s) for all s.
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Heuristic function
• Sometimes assume a heuristic is consistent
• Obeys the triangle inequality
• |h(a) - h(b)| ! c(a, b)
• For undirected graphs
3
Nathan Sturtevant
1
Informed search strategies
g
7
Introduction to Artificial Intelligence
Introduction to Artificial Intelligence
Greedy best-first search (Pure heuristic search)
• Special case of best-first search
• Best is by minimum heuristic value
• Priority queue needed to sort nodes by cost
• h-cost is the cost from the start to current state
Assume heuristic is
distance from leaves
Nathan Sturtevant
Introduction to Artificial Intelligence
Greedy best-first search
S
• Complete?
• Optimal?
• Time complexity?
• Space complexity?
G
Nathan Sturtevant
Introduction to Artificial Intelligence
A* Search
S
• Special case of best-first search
• Best is by f-cost, where f(s) = g(s)+h(s)
• Estimates total path cost through a node to the goal
G
• If heuristic is consistent, f-costs will be monotonically
non-decreasing
Nathan Sturtevant
Introduction to Artificial Intelligence
A* search
Iterative-Deepening A*
• Complete?
• Perform depth-first iterative deepening on f-costs
instead of g-costs
• Optimal?
• How do we update the bounds?
• Time complexity?
• How do we get our initial bound?
• Space complexity?
• Can we do better than A*?
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
S
G
Assume heuristic is
distance from leaves
Uniform Cost Search
IDA*
• Complete?
• Optimal?
• Time complexity?
• Space complexity?
Nathan Sturtevant
Introduction to Artificial Intelligence
Greedy Best-First Search
Regular A*
Weighted A* [f = g+10·h]
A* with better heuristic
Where do heuristics come from?
Heuristics for pathfinding & tsp
• Exact solution to relaxed version of original problem
• Pathfinding
• Normally constrained to move on grid/graph
• Relax the constraints in the original problem to make it
easier to solve
• Use solution as heuristic in original problem
• Cannot move through obstacles
• Relax by allowing straight-line movement
• Traveling Salesman Problem
• Must visit all cities in a tour
• Relax by visiting all cities in minimum spanning tree
Nathan Sturtevant
Introduction to Artificial Intelligence
Nathan Sturtevant
Introduction to Artificial Intelligence
Optimized A*
Heuristics for sliding-tile puzzle
• What heuristic would you use for the sliding-tile puzzle?
• Manhattan distance
• Domain abstraction for pattern databases
• See Figure 3.30
Nathan Sturtevant
Introduction to Artificial Intelligence
A*: Break ties towards lower g-costs
Homework: Problem 3.14
A*: Straight-line heuristic