0% found this document useful (0 votes)
25 views4 pages

A Algorithm (A-Star) A Dijkstra's Algorithm Greedy Best-First Search

Uploaded by

muddassirakhtar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

A Algorithm (A-Star) A Dijkstra's Algorithm Greedy Best-First Search

Uploaded by

muddassirakhtar3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

A* Algorithm (A-star)

A* is one of the most widely used search algorithms in AI, particularly


for pathfinding and graph traversal problems. It is an extension of the
Dijkstra's Algorithm and Greedy Best-First Search. A* efficiently
finds the shortest path from a start node to a goal node by combining the
features of these two algorithms.

Key Features:

1. Heuristic Function (h(n)): A* uses a heuristic to estimate the cost


from a node to the goal. This function helps guide the algorithm
toward the goal faster.
2. Cost Function (g(n)): This represents the exact cost from the start
node to a particular node nnn.
3. Total Cost Function (f(n)): A combination of both, which is
defined as: f(n)=g(n)+h(n)f(n) = g(n) + h(n)f(n)=g(n)+h(n)
o g(n)g(n)g(n) is the cost to reach node nnn from the start.
o h(n)h(n)h(n) is the estimated cost to reach the goal from node
nnn.
o
o f(n)f(n)f(n) gives the total estimated cost of the path through
nnn.
o

How A* Works:

1. It begins at the start node and calculates the total cost f(n)f(n)f(n)
for neighboring nodes.
2. It keeps exploring the node with the lowest f(n)f(n)f(n) value.
3. Once it reaches the goal node, it has found the shortest path.
4. Nodes are expanded based on both the cost it took to get there and
the estimated future cost to the goal, balancing between
exploration and optimization.

Advantages:
• A* is complete (it will find a solution if one exists).
• A* is optimal (it finds the least-cost path if the heuristic function
h(n)h(n)h(n) is admissible, meaning it never overestimates the true
cost).

Use Cases:

• Pathfinding in video games.


• Robot navigation.
• Network routing and geographical mapping systems.

Example:

In a grid, where each cell represents a position, A* would calculate both


the actual cost of moving to neighboring cells and estimate the
remaining cost to the goal, choosing paths that look most promising.

AO* Algorithm (AND-OR Tree Search)

AO* is used to solve problems that are represented as AND-OR graphs


or trees, where the solution may consist of multiple sub-goals or tasks
that need to be solved together (AND) or by choosing one of several
alternatives (OR). It is suitable for problems involving decision trees
where outcomes may involve multiple simultaneous actions or
dependent sub-goals.

Key Features:

1. AND Nodes: Require all child nodes to be true or solved to satisfy


the parent node.
2. OR Nodes: Require only one child node to be true or solved to
satisfy the parent node.

How AO* Works:


1. It starts at the root node and tries to solve the problem by exploring
nodes.
2. At each node, it selects the best path to follow based on cost.
3. If the node is an AND node, all its child nodes must be solved.
4. If the node is an OR node, only the best child node is expanded.
5. The algorithm continues until it finds a solution that satisfies the
entire problem.
6. AO* performs backtracking and propagates costs upwards through
the tree to decide whether to continue with the current solution or
explore alternatives.

AO* Steps:

1. Initialization: Start at the root node.


2. Node Expansion: At each step, expand the current best node.
3. Labeling: Once a solution to a subproblem is found, label it as
solved.
4. Backtracking: Backtrack to update the solution path.

Advantages:

• Solves complex, hierarchical problems where goals are broken


down into sub-goals.
• Works well for problems where there is a combination of
independent and interdependent decisions.

Use Cases:

• Problem-solving in AI planning.
• Expert systems.
• Hierarchical decision-making problems.
Comparison Between A* and AO*:

• A* is designed for single-goal pathfinding and is very efficient


when there's one start and one goal.
• AO* is suited for multiple goal decision-making problems where
sub-goals can have AND/OR relationships, which is useful in
complex problem domains like hierarchical planning.

Would you like a practical coding example of either algorithm, or


perhaps a visual representation?

4o

You might also like