0% found this document useful (0 votes)
32 views24 pages

Greedy Search

The document discusses Greedy Search, an informed search algorithm that utilizes heuristic functions to evaluate and select nodes based on their proximity to the goal. It outlines the algorithm's execution process, real-life applications, advantages, and disadvantages, emphasizing its efficiency and simplicity in making local optimal choices. While Greedy Search can quickly find solutions, it may not always yield the best results due to its focus on immediate benefits and potential local optima.

Uploaded by

khinsisthway36
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)
32 views24 pages

Greedy Search

The document discusses Greedy Search, an informed search algorithm that utilizes heuristic functions to evaluate and select nodes based on their proximity to the goal. It outlines the algorithm's execution process, real-life applications, advantages, and disadvantages, emphasizing its efficiency and simplicity in making local optimal choices. While Greedy Search can quickly find solutions, it may not always yield the best results due to its focus on immediate benefits and potential local optima.

Uploaded by

khinsisthway36
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/ 24

Greedy

Search
Section - B , Sem 5 , Group 1

CST- 5105 , Artificial Intelligence

24 / 12 / 2024

Page 01
Table of Content
My Team
About the algorithm
How do the Algorithms execute
Where these Algorithms are applied
Advantages and Disadvantages
Conclusion

Page 02
Our Team

Cho May Moe Yin Myat Noe Oo Khin Sis Thway


ThaNaTa - 1996 ThaNaTa - 1969 ThaNaTa - 1979

Page 03
Our Team

Myo Hay Mann Naing Myat Myat Tun Aye Myat Nyein
ThaNaTa - 2002 ThaNaTa - 1971 ThaNaTa - 1970

Page 04
What is Heuristic Function?

A heuristic function is used to estimate the proximity of a node to the goal in


a search algorithm.

It helps guide the algorithm by evaluating nodes based on their estimated


distance to the goal, thus simplifying the search process by focusing on
nodes that are closer to the target.

For example, in pathfinding, the heuristic could measure the straight-line


distance to the target, which gives a good idea of which direction to go.

Page 05
Greedy Search?
A greedy search is an informed search algorithm that uses a heuristic
function to decide which node to explore next.

The algorithm evaluates nodes based on the heuristic value, h(s), and selects
the node that appears closet to the goal.

Evaluation function is f(s) = h(s)

The primary purpose of Greedy Search is to quickly find a solution by always


expanding the node with the smallest heuristic value, focusing on immediate
proximity to the goal.

Page 06
In Choosing A Job
Imagine you are evaluating two job offers to maximize career growth.
• Goal: Achieve the best career growth.
• Heuristic h(s) : Growth potential of each job (e.g., skill development opportunities).
• Job A: Offers a slightly higher salary but fewer opportunities for skill growth.
• Job B: Provides lower pay but significant opportunities for skill-building and networking.

Greedy Search evaluates f(s) = h(s) for both jobs and selects Job B because it has higher
growth potential (smaller heuristic value).

However, this approach may overlook long-term benefits from Job A, as it does not consider
the overall cost or impact.

Page 07
How do the 2024

Algorithm Execute

Initialize a tree with the root node being the start node in
the open list.

If the open list is empty, return a failure, otherwise, add the


current node to the closed list.

Go to the node with the lowest h(x) value from the open list
for exploration.

If a child node (neighboring node) is the target, return a


success. Otherwise, if the node has not been in either the
open or closed list, add it to the open list for exploration.

Page 08
Consider finding the path from P to S in the following graph: 2024

Page 09
2024

In this example, the cost is measured strictly using the heuristic


value. In other words, how close it is to the target.

Page 10
2024
C has the lowest cost of 6. Therefore, the search will continue like so:

Page 11
U has the lowest cost compared to M and R, so the search will
2024
continue by exploring U. Finally, S has a heuristic value of 0 since that
is the target node:

Page 12
The total cost for the path (P -> C -> U -> S) evaluates to 11. The potential problem with
2024
a greedy best-first search is revealed by the path
(P -> R -> E -> S) having a cost of 10, which is lower than (P -> C -> U -> S). Greedy best-
first search ignored this path because it does not consider the edge weights.

Page 13
2024

Real-life
Applications Of
Greedy Algorithm

Page 14
Score collection
game
-A player collects score on a grid, and the objective is to maximize the total
score collected in a fixed number of moves.
Starting point-the top-left corner (5)
Rules-Move to adjacent cells (right, left, up, or down)
Fixed number of moves-4

Greedy Algorithm Optimal Solution

5 1 15 5 1 15
2 10 0 2 10 0
3 6 2 3 6 2

5-->2-->10-->6-->3(score=26) 5-->1-->15-->0-->10(score=31)

Other games -Treasure Hunt Grid,Fruit Collection Game,Gold Miner Grid,Chess,etec...


Page 15
How Greedy Algorithms Work in Games

1. Local Optimization:
At each decision point, the algorithm selects the action that maximizes the immediate
payoff or benefit.
No effort is made to plan for the future or consider the opponent's potential responses.

2. No Lookahead:
Ignores the long-term consequences of decisions. They base decisions only on the
current state.

3. Applications:
The greedy algorithm is efficient and effective for quick decision-making in simple cases.
So,they are often used in simple games or as a baseline strategy for comparison.

Page 16
For pathfinding, such as in GPS navigation
systems;

Pathfinding and Helps to find a route from a start point to a


destination by choosing the next move that
Navigation seems best based on a heuristic value.

GPS System Another potential use of greedy algorithms in


GPS systems is in traffic optimization.

GPS systems can use real-time data about traffic


conditions (e.g., speed, congestion) to make
decisions about the best routes.

Page 17
Resource Allocation (e.g., Task Scheduling)

Greedy algorithms are used in scheduling tasks, especially in scenarios like job
scheduling or task allocation to machines in cloud computing.

Task Scheduling In cloud computing


can be used to Tasks might be assigned to
schedule jobs based processors or machines,
on criteria like a greedy algorithm could
earliest deadline first, prioritize tasks with the smallest
shortest job first, or execution time or the highest
highest priority. priority
making the schedule more
efficient in real time

Page 18
How Greedy Algorithms Work in NLP

Parsing and Syntax Analysis


Example: Determining the grammatical structure of a sentence.
Syntax parsers (e.g., probabilistic context-free grammars) use heuristics to search for
the most likely parse tree.
Beam Search is often applied to limit the number of parse trees under consideration,
focusing on the most promising ones.

Steps
1. Tokenization:
2. Applying Grammar Rules:
3. Building a Parse Tree:
4. Validation:

Page 19
How Greedy Algorithms Work in NLP

Page 20
2024

Advantages of
Greedy Search

Simple and Easy to Fast and Efficient: Low Memory Flexible: Efficiency:
Implement: Requirements:
can be adapted to how close a node is
requires only a
a relatively a very fast algorithm, different types of to the solution, this
small amount of
straightforward ideal for applications problems algorithm can be a
memory, easily extended to
algorithm where speed is very efficient
suitable for more complex find a solution
making it easy essential.
applications with problems. quickly, even in
to implement.
limited memory. large search spaces.

Page 21
2024

Disadvantage of
Greedy Search

Inaccurate Results: Local Optima: Heuristic Function: Lack of


Completeness:
not always guaranteed to can get stuck in local requires a heuristic is not a complete algorithm
find the optimal solution optima, meaning that function in order to work, meaning it may not always
as it is only concerned with the path chosen may not which adds complexity to find a solution if one is exists.
finding the most promising be the best possible path. the algorithm. if the algorithm gets stuck in
path. a cycle or if the search space
is a too much complex.

Page 22
2024

Conclusion
Greedy search algorithms are efficient
and simple, making locally optimal
choices to solve problems quickly

While not always guaranteeing the best


solution, they are powerful tools in AI for
tasks like pathfinding and optimization.

Page 23
Thank
You.
Any Question ?

Page 24

You might also like