0% found this document useful (0 votes)
6 views85 pages

Module-2 and 3

The document discusses problem-solving in artificial intelligence, covering concepts such as problem representation, state space, and various solving approaches including search algorithms and heuristics. It highlights the importance of defining and analyzing problems, as well as the components of problem-solving agents. Additionally, it explores specific algorithms like Greedy Best-First Search and A* search, along with their advantages, disadvantages, and applications.

Uploaded by

rishi11710
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)
6 views85 pages

Module-2 and 3

The document discusses problem-solving in artificial intelligence, covering concepts such as problem representation, state space, and various solving approaches including search algorithms and heuristics. It highlights the importance of defining and analyzing problems, as well as the components of problem-solving agents. Additionally, it explores specific algorithms like Greedy Best-First Search and A* search, along with their advantages, disadvantages, and applications.

Uploaded by

rishi11710
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/ 85

Problem Solving

Problem representation: Problem space, state space, problem


reduction; Case study: Tic - Tac - Toe problem; Solving Approaches:
Search algorithms, Heuristics (informed search), Evolutionary
computation

23-01-2025 SELECT VIT- Chennai 1


Problem representation: Problem space, state space, problem reduction
•Initial State:
The starting point of the problem.
Example: The starting position of pieces on a chessboard.
•Goal State:
The desired final state that represents the solution to the problem.
Example: Reaching checkmate in chess or finding the shortest path in a GPS system.
•Intermediate States:
These are the states between the initial state and the goal state that result from applying various actions.
Example: Intermediate moves in a maze-solving problem.
•Actions or Operators:
The steps or transformations that allow the AI to move from one state to another.
Example: Moving a piece in chess or taking a step in a maze.
•State Space:
The set of all possible states that can be reached from the initial state, given the available actions.
Example: In a Rubik's cube, the state space is the set of all possible cube configurations.
•Path:
A sequence of states and actions leading from the initial state to the goal state.

23-01-2025 SELECT VIT- Chennai 2


23-01-2025 SELECT VIT- Chennai 3
To build a system to solve a particular problem, we need four things.

1. Define the problem precisely.

2. Analyze the problem precisely.

3. Isolate and represent task knowledge.

4. Choose the best problem solving technique.

23-01-2025 SELECT VIT- Chennai 4


Representation of State Space Search
• SS: (S, A, Action(S), Result(S, a), cost(S, a))
➢ S: All Possible states.
➢ A: Set of all possible actions.
➢ Action(S): Fun - Which action is possible for current state.
➢ Result(S, a): State reached by performing action 'a' on state 's’.
➢ Cost(S, a): Costing

23-01-2025 SELECT VIT- Chennai 5


Problem Solving
Initial state:8*8 matrix ·
Operators: Legal moves defined by a set of rules.
• Goal state: Any position on board in which the opponent does not have legal move and his king is under
attack.

Move pawns from While pawns at square(file e,


square (file e, rank2) to rank2) AND square (file e,
|square(file e, rank4) rank3) is empty AND square(file
e, rank4) is empty
23-01-2025 SELECT VIT- Chennai 6
23-01-2025 SELECT VIT- Chennai 7
UP

Left Right

Down

23-01-2025 SELECT VIT- Chennai 8


UP

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.

23-01-2025 SELECT VIT- Chennai 15


23-01-2025 SELECT VIT- Chennai 16
23-01-2025 SELECT VIT- Chennai 17
23-01-2025 SELECT VIT- Chennai 18
23-01-2025 SELECT VIT- Chennai 19
23-01-2025 SELECT VIT- Chennai 20
23-01-2025 SELECT VIT- Chennai 21
Case study: Tic - Tac - Toe problem

23-01-2025 SELECT VIT- Chennai 22


23-01-2025 SELECT VIT- Chennai 23
23-01-2025 SELECT VIT- Chennai 24
23-01-2025 SELECT VIT- Chennai 26
Positive Difference Condition (15 - (sum of two squares) > 0):
Difference Greater Than 9 Condition (15 - (sum of two squares) <= 9):
23-01-2025 SELECT VIT- Chennai 27
1 3

2 4

23-01-2025 SELECT VIT- Chennai 28


4

23-01-2025 SELECT VIT- Chennai 29


23-01-2025 SELECT VIT- Chennai 30
23-01-2025 SELECT VIT- Chennai 31
Search Techniques-3

Problem solving agents; Searching for Solutions; Uninformed Search


Strategies: Breadth first search, depth first search, depth limited search,
bidirectional search; Informed search strategies: Greedy best-first search,
A* search, AO* search; Memory bounded heuristic search; Optimization
problems: Hill climbing search, simulated annealing search, local beam
search

23-01-2025 SELECT VIT- Chennai 32


Problem solving agents:
A problem-solving agent is an intelligent agent in AI designed to achieve a specific goal by
systematically exploring and solving problems in its environment. It operates by taking actions to
transition between states, starting from an initial state and working towards a goal state using a
defined problem-solving strategy.
Components of Problem-Solving Agents
1.Problem Formulation:
The agent must represent the problem in terms of:
1. States: Initial, intermediate, and goal states.
2. Actions: Operators that transition between states.
3. Goal Test: A function to check if the current state is the goal state.
4. Path Cost: A measure to evaluate the efficiency of a solution.
2.Search Strategy:
Determines how the agent explores the problem space:
1. Uninformed Search: Blind exploration (e.g., Breadth-First Search, Depth-First Search).
2. Informed Search: Uses heuristics to guide the search (e.g., A*, Greedy Search).
3.Solution:
The output of the search, typically a sequence of actions to achieve the goal.
23-01-2025 SELECT VIT- Chennai 33
Advantages of Problem-Solving Agents
1.Efficiency:
Solve problems faster using systematic approaches.
2.Adaptability:
Can work in diverse environments (static, dynamic, deterministic, or uncertain).
3.Reusability:
Problem-solving algorithms can be applied to multiple domains.
4.Rational Decision-Making:
Make informed choices based on problem space and goals.
Challenges in Problem-Solving Agents
1.Scalability:
For large problem spaces, the computational cost can become prohibitive.
2.Uncertainty:
In partially observable environments, the agent must handle incomplete information.
3.Complexity:
Complex problems may require sophisticated algorithms and heuristics.
4.Dynamic Environments:
Constantly changing environments make precomputed solutions less effective.

23-01-2025 SELECT VIT- Chennai 34


Solving Approaches

23-01-2025 SELECT VIT- Chennai 35


Breadth first search

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

23-01-2025 SELECT VIT- Chennai 36


Breadth first search

23-01-2025 SELECT VIT- Chennai 37


Breadth first search

23-01-2025 SELECT VIT- Chennai 38


23-01-2025 SELECT VIT- Chennai 39
23-01-2025 SELECT VIT- Chennai 40
23-01-2025 SELECT VIT- Chennai 41
23-01-2025 SELECT VIT- Chennai 42
23-01-2025 SELECT VIT- Chennai 43
23-01-2025 SELECT VIT- Chennai 44
Depth first search

23-01-2025 SELECT VIT- Chennai 45


23-01-2025 SELECT VIT- Chennai 46
23-01-2025 SELECT VIT- Chennai 47
23-01-2025 SELECT VIT- Chennai 48
23-01-2025 SELECT VIT- Chennai 49
23-01-2025 SELECT VIT- Chennai 50
23-01-2025 SELECT VIT- Chennai 51
Depth limited search
Depth First Search Algorithm

23-01-2025 SELECT VIT- Chennai 52


23-01-2025 SELECT VIT- Chennai 53
23-01-2025 SELECT VIT- Chennai 54
23-01-2025 SELECT VIT- Chennai 55
23-01-2025 SELECT VIT- Chennai 56
23-01-2025 SELECT VIT- Chennai 57
Depth Limited DFS Search Algorithm

23-01-2025 SELECT VIT- Chennai 58


Bidirectional Search

23-01-2025 SELECT VIT- Chennai 59


Informed search strategies: Greedy best-first search
• Greedy Best-First Search is an AI search algorithm that attempts to find the most promising path from
a given starting point to a goal. It prioritizes paths that appear to be the most promising, regardless of
whether or not they are actually the shortest path. The algorithm works by evaluating the cost of each
possible path and then expanding the path with the lowest cost. This process is repeated until the goal is
reached.
•Greedy Best-First Search works by evaluating the cost of each possible path and then expanding the path
with the lowest cost. This process is repeated until the goal is reached.

•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.

23-01-2025 SELECT VIT- Chennai 60


1) We are starting from A , so from A there are direct path to node B( with heuristics value of 32 ) ,
from A to C ( with heuristics value of 25 ) and from A to D( with heuristics value of 35 ) .

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.

23-01-2025 SELECT VIT- Chennai 61


3) Now from C we have direct paths as C to F( with heuristics value of 17 ) and C to E( with heuristics value
of 19) , so we will go from C to F.

23-01-2025 SELECT VIT- Chennai 62


4) Now from F we have direct path to go to the goal node G ( with heuristics value of 0 ) , so we will go
from F to G.

23-01-2025 SELECT VIT- Chennai 63


5) So now the goal node G has been reached and the path we will follow is A->C->F->G

23-01-2025 SELECT VIT- Chennai 64


Advantages of Greedy Best-First Search:

•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.

23-01-2025 SELECT VIT- Chennai 65


Disadvantages of Greedy Best-First Search:

•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.

23-01-2025 SELECT VIT- Chennai 66


Applications of Greedy Best-First Search:

•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.

23-01-2025 SELECT VIT- Chennai 67


A* search

23-01-2025 SELECT VIT- Chennai 68


Find the path to reach from S to G using A* search.

23-01-2025 SELECT VIT- Chennai 69


23-01-2025 SELECT VIT- Chennai 70
23-01-2025 SELECT VIT- Chennai 71
AO* search

23-01-2025 SELECT VIT- Chennai 77


23-01-2025 SELECT VIT- Chennai 78
Optimization problems: Hill climbing search

23-01-2025 SELECT VIT- Chennai 79


23-01-2025 SELECT VIT- Chennai 80
Optimization problems: simulated annealing search

23-01-2025 SELECT VIT- Chennai 81


23-01-2025 SELECT VIT- Chennai 82
23-01-2025 SELECT VIT- Chennai 83
Optimization problems: local beam search

23-01-2025 SELECT VIT- Chennai 84


23-01-2025 SELECT VIT- Chennai 85
23-01-2025 SELECT VIT- Chennai 86

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy