4_Informed Searching
4_Informed Searching
Email: [email protected]
ODS 2001 ODS 2001
Fully
Observable
• Static Environment
yes
Deterministic
yes
Sequential
yes no
Discrete no
yes Discrete
no • A search strategy is defined by picking the
Planning, Control,
yes
Vector Search: Continuous Function
order of node expansion
Optimization
heuristic
search
cybernetics Constraint
Satisfaction
• Which nodes to check first?
ODS 2001 ODS 2001
1
15/11/2024
• Simon and Newell, Human Problem Solving, • Idea: use an evaluation function f(n) for each node
– estimate of "desirability"
1972. Expand most desirable unexpanded node
• Thinking out loud: experts have strong opinions
like “this looks promising”, “no way this is going • Implementation:
to work”. Order the nodes in frontier in decreasing order of desirability
• Evaluation function
– f(n) = h(n) (heuristic)
– = estimate of cost from n to goal
2
15/11/2024
http://aispace.org/search/
3
15/11/2024
• Complete? No – can get stuck in loops, • Idea: avoid expanding paths that are already
– e.g. as Oradea as goal expensive.
• Iasi Neamt Iasi Neamt • Very important!
• Time? O(bm), but a good heuristic can give
dramatic improvement
• Evaluation function f(n) = g(n) + h(n)
• Space? O(bm) -- keeps all nodes in memory
• g(n) = cost so far to reach n
• Optimal? No
• h(n) = estimated cost from n to goal
•
• f(n) = estimated total cost of path through n to
goal
ODS 2001 ODS 2001
4
15/11/2024
http://aispace.org/search/
5
15/11/2024
• A heuristic h(n) is admissible if for every node n, • Suppose some suboptimal goal path G2 has been generated and is in the
frontier. Let n be an unexpanded node in the frontier such that n is on a
h(n) ≤ h*(n), where h*(n) is the true cost to reach the goal shortest path to an optimal goal G.
state from n. •
• An admissible heuristic never overestimates the cost to
reach the goal, i.e., it is optimistic.
6
15/11/2024
Optimality of A* Properties of A*
• h1(S) = ?
• h2(S) = ? • h1(S) = ? 8
• • h2(S) = ? 3+1+2+2+2+3+3+2 = 18
7
15/11/2024
• Choosing a good heuristic is crucial for the efficiency and accuracy of the A* algorithm. The
heuristic function h(n) should estimate the cost from a node n to the goal. A well-designed
• If h2(n) ≥ h1(n) for all n (both admissible) then h2 dominates h1 . heuristic can significantly speed up the search process by guiding the algorithm towards the
• h2 is better for search goal more directly.
•
• Here are some principles and methods to help decide on a good heuristic:
• Typical search costs (average number of nodes expanded): • 1. Admissibility (Underestimation)
•
• A heuristic is admissible if it never overestimates the cost to reach the goal. This
• d=12 IDS = 3,644,035 nodes ensures that A* will find the optimal path.
A*(h1) = 227 nodes • Example: In a grid-based pathfinding problem, the Euclidean distance or Manhattan
A*(h2) = 73 nodes
• d=24 IDS = too many nodes distance can be used as an admissible heuristic:
A*(h1) = 39,135 nodes
A*(h2) = 1,641 nodes Euclidean Distance is useful if diagonal movement is allowed.
• Manhattan Distance is useful if only horizontal and vertical movements
are allowed
• 3. Domain-Specific Knowledge
• 2. Consistency (Monotonicity) • The design of the heuristic depends on the nature of the
•Consistency ensures that A* will not revisit nodes and makes the algorithm problem. Understanding the problem domain can help
more efficient. create more accurate heuristics.
•If a heuristic is consistent, it is also admissible, but not all admissible
heuristics are consistent. • For example:
– Navigation problems: Use straight-line (Euclidean) distance,
Manhattan distance, or great-circle distance (for spherical
surfaces like Earth).
– Puzzle problems (like 8-puzzle): Use the number of misplaced
tiles or the sum of the distances of each tile from its goal position
(Manhattan distance).
ODS 2001 ODS 2001
8
15/11/2024
9
15/11/2024
Relaxed problems
Summary
ODS 2001
10