Artificial Intelligence: by Ms. Nida E Rub
Artificial Intelligence: by Ms. Nida E Rub
• DFS will be implemented from our start node A and its children B, C, D, and E.
• Then from E, it moves to F, similarly backtracks the path, and explores the unexplored
branch where node G is present.
• It then retraces the path and explores the child of C, i.e., node H, and then we finally
reach our goal by applying DLS Algorithm.
• Suppose we have further successors of node F but only the nodes till limit 2 will be
explored as we have limited the depth and have reached the goal state.
Autonomous Vehicles (Path Planning):
Constrained Pathfinding:
In autonomous vehicle systems like drones or self-driving
cars, DLS is useful when limiting how far the vehicle plans a
path ahead.
For example, DLS can ensure that the search for a navigation
path doesn’t extend beyond a certain number of turns or
distance, helping the vehicle respond efficiently to dynamic
environments.
4. DEPTH LIMITED SEARCH
Before moving into bidirectional search, let’s first understand a few terms.
Forward Search: Looking in front of the end from the start.
Backward Search: Looking from end to the start backward.
We must traverse the tree from the start node and the goal node, and wherever they
meet, the path from the start node to the goal through the intersection is the
optimal solution.
The Bidirectional Algorithm is applicable when generating predecessors is easy in
both forward and backward directions, and there exist only 1 or fewer goal states.
EXAMPLE
EXAMPLE
Do BFS from both directions.
• Similar to BFS, at
every point explore
the next level of
nodes till you find an
intersecting node.
CONCLUSION
Uninformed search methods have access only to the problem definition. The basic algorithms are as
follows:
– Breadth-first search expands the shallowest nodes first; it is complete, optimal for unit step costs,
but has exponential space complexity.
– Uniform-cost search expands the node with lowest path cost, g(n), and is optimal for general step
costs.
– Depth-first search expands the deepest unexpanded node first. It is neither complete nor optimal,
but has linear space complexity.
--Depth-limited search adds a depth bound.
– Iterative deepening search calls depth-first search with increasing depth limits until a goal is
found. It is complete, optimal for unit step costs, has time complexity comparable to breadth-first
search, and has linear space complexity.
– Bidirectional search can enormously reduce time complexity, but it is not always applicable and
may require too much space.
INFORMED SEARCH STRATEGIES
CHAPTER 3
INFORMED SEARCH AND EXPLORATION
• In BFS and DFS, when we are at a node, we can consider any of the adjacent as next
node.
• So both BFS and DFS blindly explore paths without considering any cost function.
• The idea of Best First Search is to use an evaluation function to decide which
adjacent is most promising and then explore.
GREEDY BEST FIRST SEARCH
• Best-first search allows us to take the advantages of both algorithms.
• With the help of best-first search, at each step, we can choose the most promising node.
• In the best first search algorithm, we expand the node which is closest to the goal
node and the closest cost is estimated by heuristic function, i.e.
A C B
• Remove A from PriorityQueue and process unvisited neighbors of A to PriorityQueue.
C B E D
• Remove C from PriorityQueue and process unvisited neighbors of C to PriorityQueue.
B H E D
• Remove B from PriorityQueue and process unvisited neighbors of B to PriorityQueue.
H E D F G
• Remove H from PriorityQueue. Since our goal "I" is a neighbor of H, we return.
RECALL ROMANIA MAP EXAMPLE
What’s a proper heuristic that measures cheapest path from current node to goal node?
2. A* SEARCH
It is a searching algorithm that is used to find the shortest path
between an initial and a final point.
A* was initially designed as a graph traversal problem, to help
build a robot that can find its own course.
It searches for shorter paths first, thus making it an optimal and
complete algorithm.
An optimal algorithm will find the least cost outcome for a
problem, while a complete algorithm finds all the possible
outcomes of a problem.
2. A* SEARCH
the node, and h(n), the cost to get from the node to
the goal:
f(n) = g(n) + h(n) (estimated cost of cheapest solution through n).
❑ A reasonable strategy: try node with the lowest g(n) +
h(n) value!
❑ Provided heuristic meets some basic conditions, A* is
f(n)=g(n)+h(n)
EXERCISE