Module-2 and 3
Module-2 and 3
Left Right
Down
Left Right
Down
UP
Left Right
Down
23-01-2025 SELECT VIT- Chennai 9
23-01-2025 SELECT VIT- Chennai 10
23-01-2025 SELECT VIT- Chennai 11
23-01-2025 SELECT VIT- Chennai 12
23-01-2025 SELECT VIT- Chennai 13
23-01-2025 SELECT VIT- Chennai 14
A water jug problem
• Que: You are given two jugs, a 4-liter one and a 3-liter one. Neither has any
measuring markers on it. There is a pump that can be used to fill the jugs with
water. How can you get exactly 2 liters of water into a 4-liter jug.
2 4
Algorithm:
1. Create a variable called NODE-LIST and set it to initial state
2. Until a goal state is found or NODE-LIST is empty do
a. Remove the first element from NODE-LIST and call it E. If NODE-LIST was empty, quit
b. For each way that each rule can match the state described in E do:
i. Apply the rule to generate a new state
ii. If the new state is a goal state, quit and return this state
iii. Otherwise, add the new state to the end of NODE-LIST
•The algorithm uses a heuristic function to determine which path is the most promising.
•The heuristic function takes into account the cost of the current path and the estimated cost of the
remaining paths.
•If the cost of the current path is lower than the estimated cost of the remaining paths, then the current
path is chosen. This process is repeated until the goal is reached.
2) So as per best first search algorithm choose the path with lowest heuristics value , currently C has
lowest value among above node . So we will go from A to C.
•Simple and Easy to Implement: Greedy Best-First Search is a relatively straightforward algorithm,
making it easy to implement.
•Fast and Efficient: Greedy Best-First Search is a very fast algorithm, making it ideal for applications
where speed is essential.
•Low Memory Requirements: Greedy Best-First Search requires only a small amount of memory,
making it suitable for applications with limited memory.
•Flexible: Greedy Best-First Search can be adapted to different types of problems and can be easily
extended to more complex problems.
•Efficiency: If the heuristic function used in Greedy Best-First Search is good to estimate, how close a
node is to the solution, this algorithm can be a very efficient and find a solution quickly, even in large
search spaces.
•Inaccurate Results: Greedy Best-First Search is not always guaranteed to find the optimal solution, as it is only
concerned with finding the most promising path.
•Local Optima: Greedy Best-First Search can get stuck in local optima, meaning that the path chosen may not be
the best possible path.
•Heuristic Function: Greedy Best-First Search requires a heuristic function in order to work, which adds
complexity to the algorithm.
•Lack of Completeness: Greedy Best-First Search is not a complete algorithm, meaning it may not always find a
solution if one is exists. This can happen if the algorithm gets stuck in a cycle or if the search space is a too much
complex.
•Pathfinding: Greedy Best-First Search is used to find the shortest path between two points in a graph. It is
used in many applications such as video games, robotics, and navigation systems.
•Machine Learning: Greedy Best-First Search can be used in machine learning algorithms to find the most
promising path through a search space.
•Optimization: Greedy Best-First Search can be used to optimize the parameters of a system in order to achieve
the desired result.
•Game AI: Greedy Best-First Search can be used in game AI to evaluate potential moves and chose the best
one.
•Navigation: Greedy Best-First Search can be use to navigate to find the shortest path between two locations.
•Natural Language Processing: Greedy Best-First Search can be use in natural language processing tasks such
as language translation or speech recognition to generate the most likely sequence of words.
•Image Processing: Greedy Best-First Search can be use in image processing to segment image into regions of
interest.