0% found this document useful (0 votes)
20 views10 pages

Ai 2

art

Uploaded by

ranjitdey1803
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)
20 views10 pages

Ai 2

art

Uploaded by

ranjitdey1803
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/ 10

B.

Tech (DS) in CSE & 5th Semester


Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25

Study Material
Artificial Intelligence
(PEC-CSD501B)

Table of Contents
Uninformed Search Strategies:
• Formulation of real world problems,
• Breadth First Search, Depth First Search, Depth Limited
Search,
• Iterative Deepening Depth First Search, Bidirectional
Search,
• Comparison of Uninformed search Strategies,
• Searching with partial information, Sensor-less
problems, Contingency problems.
Informed Search Strategies:
• Generate& test, Hill Climbing,
• Best First Search, A* and AO* Algorithm,
• Constraint satisfaction, Game playing: Minimax Search,
• Alpha-Beta Cutoffs, Waiting for Quiescence.

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
Uninformed and Informed Search Strategies

1. Uninformed Search Strategies

Uninformed search strategies, also called "blind search," refer to algorithms that
do not have any additional information about the distance from the current
state to the goal state. They rely solely on the problem's structure to explore the
search space.

Formulation of Real-World Problems

• Problem Formulation: This involves defining the problem in terms of


states, operators (actions), initial state, goal state, and path cost. The
solution is a sequence of actions that transforms the initial state into the
goal state.
o Example: In a maze-solving problem, the states represent the
agent's positions, the operators are movements (up, down, left,
right), the initial state is the starting point, and the goal state is the
exit of the maze.

Breadth-First Search (BFS)

• Description: Explores all nodes at the present depth before moving on to


nodes at the next depth level. It uses a queue to keep track of the frontier.
• Characteristics:
o Complete (will find a solution if one exists).
o Guarantees the shortest path solution.
o Space and time complexity: O(b^d) (where b is the branching factor
and d is the depth of the shallowest goal).
• Usage: Suitable for problems where the solution is close to the root.

Depth-First Search (DFS)

• Description: Explores as far as possible along each branch before


backtracking. It uses a stack (often implicitly with recursion) to manage
the search.
• Characteristics:

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
oNot guaranteed to find the shortest path.
o Space complexity: O(bm) (where m is the maximum depth).
o Time complexity: O(b^m) (can be problematic for large search
spaces).
• Usage: Suitable for deep search problems where space is limited.

Depth-Limited Search (DLS)

• Description: DFS with a predetermined limit on the depth. It cuts off the
search once the depth limit is reached.
• Characteristics:
o Completeness depends on the depth limit.
o Avoids infinite loops by limiting recursion depth.
o Space complexity: O(bl).
o Time complexity: O(b^l) (where l is the depth limit).
• Usage: Useful in cases where the search space is infinite or very large.

Iterative Deepening Depth-First Search (IDDFS)

• Description: A combination of DFS and BFS. It performs DFS up to a certain


depth limit and gradually increases the limit.
• Characteristics:
o Complete and optimal.
o Time complexity: O(b^d).
o Space complexity: O(bd).
• Usage: Suitable for large, unknown search spaces when memory is a
constraint.

Bidirectional Search

• Description: Simultaneously performs two searches: one forward from


the initial state and one backward from the goal state, hoping they meet
in the middle.
• Characteristics:
o Time complexity: O(b^d/2) (this provides a significant reduction in
complexity).
o Space complexity: O(b^d/2).

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
• Usage: Most effective when both the start and goal states are well
defined.

Comparison of Uninformed Search Strategies

• BFS: Guarantees the shortest solution but can be memory-intensive.


• DFS: Memory efficient but may get stuck in deep or infinite branches.
• DLS: Adds depth limitation to DFS to avoid infinite loops.
• IDDFS: Combines DFS's low memory usage with BFS’s completeness and
optimality.
• Bidirectional: Faster than BFS/DFS in optimal cases, but can be
challenging to implement in complex problem spaces.

Searching with Partial Information

• When the agent does not have complete knowledge about the state
space, the search strategies must work with partial or no information.

Sensor-less Problems

• These problems occur when the agent has no direct perception of the
state it is in. The agent must rely on a model of the environment to make
decisions.
o Example: Solving a maze with no visibility of the surroundings.

Contingency Problems

• These involve uncertainty, where the outcome of actions is unpredictable,


and the agent needs to plan for different possible scenarios.
o Example: A robot vacuum that doesn’t know where the furniture is
located and must plan for multiple contingencies.

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
2. Informed Search Strategies

Informed search strategies use problem-specific knowledge, such as heuristics,


to guide the search toward the goal more efficiently than uninformed methods.

Generate & Test

• Description: The simplest form of search where the system generates


potential solutions and tests each one to see if it meets the goal condition.
• Usage: Suitable when no complex reasoning is needed.

Hill Climbing

• Description: An iterative algorithm that starts with an arbitrary solution


and makes small changes to improve it based on a heuristic.
o Variants:
▪ Simple Hill Climbing: Only evaluates the neighbouring state.
▪ Steepest-Ascent Hill Climbing: Examines all neighbours and
moves to the one with the highest improvement.
o Problem: Can get stuck in local maxima, plateaus, or ridges.
• Usage: Suitable for optimization problems with smooth search spaces.

Best-First Search

• Description: Explores the most promising node according to a heuristic


evaluation function. The open list is sorted by this heuristic.
o Evaluation Function: f(n)=g(n)+h(n), where g(n) is the cost from the
start node to n, and h(n) is the estimated cost from n to the goal.
• Usage: Common in navigation and pathfinding problems.

A Algorithm*

• Description: A popular informed search strategy that combines the cost


to reach the node and the heuristic (best guess) of the remaining cost.
o Evaluation Function: Same as Best-First Search f(n)=g(n)+h(n).
o Optimality: A* is optimal if the heuristic h(n) is admissible (never
overestimates the cost).

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
• Usage: Widely used for pathfinding in AI, such as in game development or
robotics.

AO Algorithm*

• Description: A graph-based algorithm for solving problems that can be


represented as AND-OR graphs, where nodes can be solved by one of
several alternative paths.
• Usage: Typically used in decision trees where multiple ways to solve a
problem exist.

Constraint Satisfaction

• Description: Solving problems by identifying a set of constraints and


finding a state that satisfies all of them.
o Examples: Scheduling, puzzles like Sudoku, and resource allocation.

Game Playing: Minimax Search

• Description: A decision-making algorithm for two-player zero-sum games,


where one player tries to maximize the score while the other tries to
minimize it.
o Minimax: Players alternate turns, with each minimizing the
opponent's potential gain.
o Tree Search: Evaluates game states and computes the best possible
move by building a search tree.

Alpha-Beta Cutoffs

• Description: An optimization of the Minimax algorithm that prunes


branches of the search tree that cannot influence the final decision,
reducing the number of nodes evaluated.
• Usage: Essential in making Minimax practical for real-time strategy
games.

3. Game Playing: Advanced Concepts

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
Game playing strategies, particularly for two-player adversarial games, rely on
informed search techniques. These strategies aim to evaluate and predict the
opponent's moves to make optimal decisions. Here, we extend the concepts of
game search and introduce techniques that improve efficiency and accuracy.

Minimax Search

• Description: As mentioned earlier, Minimax is a recursive algorithm used


in two-player zero-sum games like chess or tic-tac-toe. The game tree is
explored, with one player maximizing the score and the other minimizing
it.
• Working:
1. Maximizing Player (MAX): Tries to maximize the score by selecting
the move with the highest value.
2. Minimizing Player (MIN): Tries to minimize the score by selecting
the move with the lowest value.
3. End Game Nodes (Terminal States): The leaf nodes of the tree
represent final game outcomes with a certain utility value (win,
lose, or draw).
• Time Complexity: O(b^m), where b is the branching factor and m is the
depth of the search tree.
• Problem: As the depth of the game tree grows, evaluating all nodes
becomes impractical due to exponential time complexity.

Alpha-Beta Pruning

• Description: Alpha-Beta Pruning is an optimization of the Minimax


algorithm that reduces the number of nodes evaluated in the search tree,
allowing it to handle deeper searches more efficiently.
o Alpha: The best value that the maximizing player (MAX) can
guarantee.
o Beta: The best value that the minimizing player (MIN) can
guarantee.
o Pruning: When Alpha is greater than or equal to Beta, further
exploration of that node is unnecessary as it won’t affect the final
decision.

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
• Key Advantage: Alpha-Beta Pruning reduces the number of nodes
explored by cutting off branches that don't influence the outcome. In the
best case, it cuts down the time complexity from O(b^m) to O(b^(m/2)),
effectively doubling the search depth.
• Usage: Highly effective in complex games like chess and Go, where the
game tree is vast.

Notes:

• Description: In certain situations, evaluating a game state can be


misleading if it's volatile (for example, in chess, after a capture or a check).
Quiescence search waits until the game state becomes stable (quiescent)
before evaluating the position.
• Purpose: Avoids making decisions in highly dynamic situations that could
lead to incorrect evaluations. It extends the search until the position is
"quiet" enough to be accurately evaluated.
• Example: In chess, a move may involve a series of forced captures.
Waiting for quiescence ensures that all exchanges have been made before
evaluating the position, preventing the program from missing critical
tactics.

Heuristic Evaluation Functions

• Description: In many cases, especially with deep game trees, it's not
feasible to search all the way to the terminal states. Heuristic evaluation
functions estimate the utility of non-terminal states (states in the middle
of the game).
o Heuristic Design: Heuristics are domain-specific and must be
carefully crafted to provide accurate estimates of the value of a
position.
o Examples:
▪ In chess, a simple heuristic may assign values to pieces (e.g.,
queen = 9, rook = 5, knight = 3), but more complex heuristics
consider factors like piece mobility, control of the centre, and
king safety.

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
• Usage: Heuristics are critical in time-constrained environments such as
real-time strategy games, where it's impossible to fully explore the game
tree.

Game-Playing Algorithms Summary

4. Constraint Satisfaction Problems (CSP)

A Constraint Satisfaction Problem (CSP) is a mathematical problem defined by


a set of objects whose state must satisfy a number of constraints or limitations.
CSPs are often used in scheduling, puzzles, and resource allocation.

Key Components of CSP

1. Variables: These are the unknowns we want to assign values to.


o Example: In Sudoku, each cell is a variable.
2. Domains: The set of possible values that each variable can take.
o Example: In Sudoku, each cell can take values from 1 to 9.
3. Constraints: Rules that restrict the values variables can take. A solution is
found when all variables are assigned values in such a way that no
constraints are violated.
o Example: In Sudoku, no two cells in the same row, column, or 3x3
subgrid can have the same value.

Common Techniques in CSPs

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS
B.Tech (DS) in CSE & 5th Semester
Artificial Intelligence (PEC-CSD501B)
Academic Session: 2024 – 25
• Backtracking Search: A depth-first search algorithm that tries to assign
values to variables while checking constraints.
• Constraint Propagation: Reduces the search space by deducing variable
values based on the constraints.
• Heuristic Methods: Methods like Minimum Remaining Values (MRV) or
Least Constraining Value (LCV) are used to choose which variable or value
to assign next to reduce the branching factor.

Applications of CSP

• Scheduling: Allocating resources over time, such as assigning time slots to


classes.
• Puzzle Solving: Problems like Sudoku, n-queens, or crossword puzzles.
• Resource Allocation: Assigning jobs to machines or allocating tasks to
workers.

4. Summary of Search Strategies

Ms. Shramana Ghosh


Assistant Professor, CSE-CSDS

You might also like