AI Mid Answer
AI Mid Answer
1. Develop algorithms for Depth First and Breadth First search algorithms. Write the
advantages and disadvantages of both.
Algorithm:
Advantages:
Disadvantages:
Algorithm:
Advantages:
Disadvantages:
Requires more memory because all nodes at a given level are stored in memory.
Can be slower compared to DFS due to higher space complexity.
Greedy Best-First Search: It evaluates nodes based on a heuristic function (h(n)) that
estimates the cost to reach the goal. The algorithm chooses the node that appears to be
closest to the goal.
A Algorithm:* This algorithm uses a combination of the cost to reach the current node (g(n))
and the heuristic (h(n)) to make decisions. It aims to minimize the total estimated cost (f(n) =
g(n) + h(n)).
Heuristic search is commonly applied in AI problems like pathfinding (e.g., in robotics or games).
Example: In a two-player game, where both players aim to maximize their score, the algorithm
prunes branches that cannot lead to better outcomes for the current player.
5. Explain the Structure of an Intelligent Agent and Describe the Different Types of Agents
Used in Artificial Intelligence. How Do These Agents Perceive and Act in Their Environments?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/4
An Intelligent Agent is an entity that perceives its environment through sensors and acts upon it
through actuators based on the information it gathers.
Structure:
1. Perception: The agent gathers information from the environment using sensors.
2. Reasoning/Decision-Making: Based on the perceptions, the agent makes decisions using
reasoning, algorithms, or AI techniques.
3. Action: The agent takes actions using actuators to affect the environment.
Types of Agents:
Simple Reflex Agent: Operates based on the current perception using predefined rules.
Model-Based Reflex Agent: Maintains a model of the world to handle complex situations.
Goal-Based Agent: Makes decisions based on achieving specific goals.
Utility-Based Agent: Maximizes its performance measure by selecting actions based on a
utility function.
Steps:
Example: For a robot navigating a grid, A* would evaluate the cost of each path (distance and
estimated distance to the goal) and choose the one with the least combined cost.
Example: In a Sudoku puzzle, the variables are the cells, the domains are the numbers (1-9), and the
constraints are that no number can repeat in any row, column, or block.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/4
Definite Clauses: A definite clause is a Horn clause with exactly one positive literal. It is used in
inference systems, like Prolog, to derive conclusions.
Example of Horn Clause: If "A → B ∧ C," it's a Horn clause because it has one positive literal (A) and
two negations (¬B and ¬C).
State Representation:
The state can be represented by a tuple (A, B, C) where A, B, and C represent the rods, and the
discs are stacked in decreasing order on each rod.
Example:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/4