Download Artificial Intelligence Problem-Solving Agent Example of a “toy

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

Collaborative information seeking wikipedia , lookup

Embodied cognitive science wikipedia , lookup

AI winter wikipedia , lookup

Technological singularity 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
Problem-Solving Agent
●
Artificial Intelligence
●
●
–
–
–
–
–
Problem-Solving Search:
Uninformed methods
(chapter 3)
CS 4633/6633 Artificial Intelligence
State-Space Search Problem
●
●
2
7
8
3
6
4
3
6
1
4
7
2
5
8
●
●
●
●
CS 4633/6633 Artificial Intelligence
Search Tree
●
●
●
●
●
Most state spaces are too large to represent explicitly and
do not need to be considered in their entirety to find an
optimal solution
So generate a search tree that represents the part of the
state space that must be considered to solve the problem
Beginning with the initial state as the root of the search
tree, generate new successor states by expanding states
The choice of which state to expand next is called the
search strategy
The set of nodes waiting to be expanded is called the
fringe or frontier
CS 4633/6633 Artificial Intelligence
VLSI layout
Path planning
Robot navigation
Factory scheduling
Gene finding in DNA
CS 4633/6633 Artificial Intelligence
Example of a “toy” problem
5
1
A type of goal-based agent
Uses search to find a sequence of actions that
achieves a goal
Examples of real-world problems
A set of states
A set of operators representing actions that change
one state into another
An initial state and a goal test that can be applied to
any state to determine if it is a goal state
A path cost function (usually the sum of action costs,
which can be state-dependent)
A solution is a sequence of operators that transforms
the initial state into a goal state.
An optimal solution is a minimal cost solution.
CS 4633/6633 Artificial Intelligence
Example of a search tree
2 8 3
1 6 4
7
5
2 8 3
2 8 3
1 6 4
1
7 5
2 8 3
4
7 6 5
2
3
2 8 3
1 6 4
7 5
2 8 3
1 4
1 8 4
1 4
7 6 5
7 6 5
7 6 5
CS 4633/6633 Artificial Intelligence
Problem: Find route from
Louisville to West Point
Pheba
Mayhew
Maben
Louisville
8
Columbus
13
14
B. After expanding
West Point
15
Starkville
12
8
9
Ackerman
10
Sturgis
C. After expanding
Ackerman
25
18
20
Louisville
Crawford
8
Brooksville
Maben
CS 4633/6633 Artificial Intelligence
Breadth-first search
● Uniform-cost search
● Depth-first search
● Depth-limited search
● Iterative deepening search
● Bidirectional search
CS 4633/6633 Artificial Intelligence
Breadth-first search
Brooksville
Ackerman
Sturgis
Starkville
Brooksville
Louisville
CS 4633/6633 Artificial Intelligence
Search strategies
●
Starkville
Louisville
Artesia
7
Ackerman
●
Louisville
21
14
Mathiston
5
A. The initial state
West Point
16
Evaluation of search strategies
Completeness - is the strategy guaranteed
to find a solution when there is one?
● Time complexity - how long does it take to
find a solution?
● Space complexity - how much memory
does it require?
● Optimality - does the strategy find the best
solution when there are many?
●
CS 4633/6633 Artificial Intelligence
Time needed by breadth-first search
All nodes at each depth d are expanded
before any nodes at depth d+1
Entire
≅ bd-1
space
to depth
d-1
Half of
●
Open list is a FIFO queue
CS 4633/6633 Artificial Intelligence
fringe
CS 4633/6633 Artificial Intelligence
= bd /2
Uniform cost search
●
Depth-first search
●
Always expands one of the nodes at the
deepest level of the tree
●
Open list is LIFO stack
Breadth-first search
– always expands the lowest-depth node next
– finds the shallowest goal state.
●
Uniform-cost search
– always expands the lowest-cost node on the
fringe (measured by path cost g(n))
– breadth-first search is uniform cost search with
g(n) = DEPTH(n)
CS 4633/6633 Artificial Intelligence
CS 4633/6633 Artificial Intelligence
Time needed by depth-first search
Memory needed by depth-first search
≅ bm /2
Half
of
entire
space
CS 4633/6633 Artificial Intelligence
CS 4633/6633 Artificial Intelligence
Iterative Deepening Search
Depth-limited search
Attempts to avoid pitfalls of depth-first
search
● Imposes a cutoff on the maximum depth of a
path (parameter l)
●
CS 4633/6633 Artificial Intelligence
Does a breadth-first search at all possible
depths
● Combines benefits of depth-first and
breadth-first search
● Seems very inefficient because some states
are expanded multiple times (but in fact is
not inefficient)
●
CS 4633/6633 Artificial Intelligence
limit = 0
Bidirectional Search
limit = 1
●
limit = 2
●
...
limit = 3
CS 4633/6633 Artificial Intelligence
CS 4633/6633 Artificial Intelligence
Issues with Bidirectional Search
Must define predecessors of a node as well
as successors
● What if there are many goal states?
● Must be able to find out if a node that is
being generated has already been
generated in the other half of the search
● What kind of search do we do in each half?
●
CS 4633/6633 Artificial Intelligence
Time
Depthfirst
Time
bd
Time
bm
bd
Optimal?
bm
Optimal?
Yes
Complete?
No
Complete?
Yes
No
Iterative
Time
Time
bd
bd
bl
Optimal?
No
Complete?
Yes
Complete?
Yes
(if l =d)
CS 4633/6633 Artificial Intelligence
bd/2
Space
Space
Optimal?
Bi-
deepening directional
bl
Space
Space
Space
Depthlimited
Avoiding repeated states
Do not generate any state that was
generated before. Use a hash table (called a
closed list) to store all generated nodes.
● This transforms a search tree into a search
graph.
●
CS 4633/6633 Artificial Intelligence
Comparing search strategies
Breadth-first &
uniform cost
Simultaneously search
– forward from initial state
– backward from goal
– stop when two searches meet in the middle
Can save a lot of time if branching factor about the
same in both directions
Yes
bd/2
Optimal?
Yes
Complete?
Yes
Exercise
Three missionaries and three cannibals find themselves on
one side of a river. They have agreed that they would all
like to get to the other side. But the missionaries are not
sure what else the cannibals have agreed to. So the
missionaries want to manage the trip across the river in
such a way that the number of cannibals who are on either
side of the river is never more than the number of
missionaries on the same side. The only boat available
holds only two people at a time. How can everyone get
across the river without the missionaries risking being
eaten? Formulate this as a state-space search problem.
CS 4633/6633 Artificial Intelligence