Professional Documents
Culture Documents
Search: The Need For Search Uninformed Search Informed Search Games and Adversarial Search
Search: The Need For Search Uninformed Search Informed Search Games and Adversarial Search
We want:
To automatically solve a problem
We need:
A representation of the problem
Algorithms that use some strategy to solve the problem defined in
that representation
4 Search
And
bankA(mm,cc,b)
bankB(m,c,-)
16 Search
Basic idea:
Exploration of state space by generating successors of already-
explored states
(a.k.a.~expanding states).
Every states is evaluated: is it a goal state?
23 Example: how to go from Arad to
Bucharest?
24 Example: how to go from Arad to
Bucharest?
25 Example: how to go from Arad to
Bucharest?
26
Search broad categories
• Uninformed search (Blind search):
The term means that the strategies have no additional information
about states beyond that provided in the problem definition.
All they can do is generate successors and distinguish a goal state
from a non-goal state.
• Informed search:
Strategies that know whether one non-goal state is “more promising”
than another are called informed search or heuristic
HEURISTIC SEARCH.
27 Search
want to explore
Expanding the state is the process of applying operators on
current state.
All search strategies are distinguished by the order in which
Observations:
Breadth-first has the advantage that it will always find the
Implementation
Order the nodes in increasing order of cost.
42
Best-first search
Heuristic function:
h(n) = estimated cost of the cheapest path from the
state at node n to a goal state.
(Notice that h(n) takes a node as input, but, unlike
g(n), it depends only on the state at that node)
For example, in Romania, one might estimate the
cost of the cheapest path from Arad to Bucharest
via the straight-line distance from Arad to
Bucharest.
44 Best-first search example –with
constrains
Having the following grid and the depicted agent at location (x=6, y=1) and a target
object located at (x=1,y=4). Assume that the agent can just go forward, backward,
upward, downward, using best first search write the content of the search agenda at
each time step until reaching the target showing the selected directions on the grid.
Assume Euclidian distance from the current location to the target location as the
heuristic value.
45
Best-first search example
46
Best-first search example
47
Informed search –A*
• Idea: avoid expanding paths that are already
expensive
• Evaluation function f(n) = g(n) + h(n)
• g(n) = cost so far to reach n
• h(n) = estimated cost from n to goal
• f(n) = estimated total cost of path through n to
goal
• Best First search has f(n)=h(n)
• Uniform Cost search has f(n)=g(n)
48 How to go from Arad to Bucharest
using A* algorithm?
Assume heuristic is the air distance,
specified: Town Air Dist.
Arad 366
Bucharest 0
Craiova 160
Dobreta 242
Eforie 161
Fagaras 176
Giurgiu 77
Hirsova 151
Iasi 226
Lugoj 244
Mehadia 241
Neamt 234
Oradea 380
Pitesti 100
Rimnicu Vilcea 193
Sibiu 253
Timisoara 329
Urziceni 80
Vaslui 199
Zerind 374
49 How to go from Arad to Bucharest
using A* algorithm?
Node
Node Heuristic value
ID
1 446
2 364
3 408
4 264
5 0
6 271
7 402
8 255