Artificial Intelligence - Unit 2
Artificial Intelligence - Unit 2
• An AI system is composed of an agent and its environment. The agents act in their
environment. The environment may contain other agents.
• An agent is anything that can perceive its environment through sensors and acts upon
that environment through effectors.
• A human agent has sensory organs such as eyes, ears, nose, tongue and skin parallel to the sensors,
and other organs such as hands, legs, mouth, for effectors.
• A robotic agent replaces cameras and infrared range finders for the sensors, and various motors and
actuators for effectors.
• A software agent has encoded bit strings as its programs and actions.
What is ideal Rational Agent?
• An ideal rational agent is the one, which is capable of doing expected actions to maximize its
performance measure, on the basis of −
• Its percept sequence
• Its built-in knowledge base
• Rationality of an agent depends on the following −
• The performance measures, which determine the degree of success.
• Agent’s Percept Sequence till now.
• The agent’s prior knowledge about the environment.
• The actions that the agent can carry out.
• A rational agent always performs right action, where the right action means the action that
causes the agent to be most successful in the given percept sequence. The problem the agent
solves is characterized by Performance Measure, Environment, Actuators, and Sensors (PEAS).
• Agent’s structure can be viewed as −
• Agent = Architecture + Agent Program
• Architecture = the machinery that an agent executes on.
• Agent Program = an implementation of an agent function.
Vacuum Cleaner World of Agent?
2. Deterministic vs Stochastic
• When a uniqueness in the agent’s current state completely determines the next state of the agent,
the environment is said to be deterministic.
• The stochastic environment is random in nature which is not unique and cannot be completely
determined by the agent.
• Examples:
• Chess – there would be only a few possible moves for a coin at the current state and these moves can
be determined.
• Self-Driving Cars- the actions of a self-driving car are not unique, it varies time to time.
3. Competitive vs Collaborative
• An agent is said to be in a competitive environment when it competes against another agent to
optimize the output.
• The game of chess is competitive as the agents compete with each other to win the game which
is the output.
• An agent is said to be in a collaborative environment when multiple agents cooperate to produce
the desired output.
• When multiple self-driving cars are found on the roads, they cooperate with each other to avoid
collisions and reach their destination which is the output desired.
4. Single-agent vs Multi-agent
• An environment consisting of only one agent is said to be a single-agent environment.
• A person left alone in a maze is an example of the single-agent system.
• An environment involving more than one agent is a multi-agent environment.
• The game of football is multi-agent as it involves 11 players in each team.
5. Dynamic vs Static
• An environment that keeps constantly changing itself when the agent is up with some action is
said to be dynamic.
• A roller coaster ride is dynamic as it is set in motion and the environment keeps changing every
instant.
• An idle environment with no change in its state is called a static environment.
• An empty house is static as there’s no change in the surroundings when an agent enters.
6. Discrete vs Continuous
• If an environment consists of a finite number of actions that can be deliberated in the
environment to obtain the output, it is said to be a discrete environment.
• The game of chess is discrete as it has only a finite number of moves. The number of moves
might vary with every game, but still, it’s finite.
• The environment in which the actions are performed cannot be numbered i.e. is not discrete, is
said to be continuous.
• Self-driving cars are an example of continuous environments as their actions are driving,
parking, etc. which cannot be numbered.
7. Episodic vs Sequential
• In an Episodic task environment, each of the agent’s actions is divided into atomic incidents
or episodes. There is no dependency between current and previous incidents. In each incident,
an agent receives input from the environment and then performs the corresponding action.
• Example: Consider an example of Pick and Place robot, which is used to detect defective
parts from the conveyor belts. Here, every time robot(agent) will make the decision on the
current part i.e. there is no dependency between current and previous decisions.
• In a Sequential environment, the previous decisions can affect all future decisions. The next
action of the agent depends on what action he has taken previously and what action he is
supposed to take in the future.
• Example:
• Checkers- Where the previous move can affect all the following moves.
8. Known vs Unknown
• In a known environment, the output for all probable actions is given. Obviously, in case of
unknown environment, for an agent to make a decision, it has to gain knowledge about how the
environment works.
The Structure of Agents
• Agents are grouped into five classes based on their degree of perceived intelligence and
capability:
• simple reflex agents
• model-based reflex agents
• goal-based agents
• utility-based agents
• learning agents
Simple Reflex Agents
• They choose actions only based on the current percept.
• They are rational only if a correct decision is made only on the basis of current precept.
• Their environment is completely observable.
Condition-Action Rule −
It is a rule that maps a state
(condition) to an action.
Based on IF-THEN Rule.
• They use a model of the world to choose their actions. They maintain an internal state.
• Model − knowledge about “how the things happen in the world”.
• Internal State − It is a representation of unobserved aspects of current state depending on
percept history.
• Model means knowledge from past. So it takes its previous knowledge to take decisions.
• Environment is partially observable.
• First check history, then only perform action…not immediate like reflex model
• Self driving cars may take decision if they see any obstacle, whether to stop or go left or
right.
• Updating the state requires the information about −
• How the world evolves.
• How the agent’s actions affect the world.
Goal Based Agents
• They choose their actions in order to achieve goals. Goal-based approach is more
flexible than reflex agent since the knowledge supporting a decision is explicitly
modeled, thereby allowing for modifications.
• Goal − It is the description of desirable situations.
• It is an expansion of model based agents. The goal is already defined.
• Goal can be achieved by searching and planning.
• For example, if you’re going for trekking, first you need to search the best path or
shortest path and then plan accordingly.
• It sees the past knowledge, then set goals.
• G-Plus is an example of goal based agents, which are robots that delivers products to
customers (Alibaba)
Utility
Based
Agents
Deals with
happy and
unhappy
state of users
• They choose actions based on a preference (utility) for each state not the goal.
• GPS showing shortest path, if user follow it and if any accident on that path, then agents finds that its in
unhappy state, so changes to next shortest path so that users are in happy state.
• Goals are inadequate when −
• There are conflicting goals, out of which only few can be achieved.
• Goals have some uncertainty of being achieved and you need to weigh likelihood of success against the
importance of a goal.
Learning Agents
A learning agent can be divided into four conceptual components:
1. Self-driving Cars: Self-driving cars use a variety of sensors, such as cameras, LiDAR, and radar, to
perceive their surroundings. Learning agents within these cars continuously analyze this data to learn how
to navigate roads, detect obstacles, and make driving decisions. They can improve their driving behavior
over time through reinforcement learning and neural networks.
2. Recommendation Systems: Online platforms like Netflix, Amazon, and YouTube use learning agents to
recommend content to users. These agents learn from users' past behavior, such as the movies they watch
or products they purchase, to make personalized recommendations that improve with more interactions.
3. Game Playing AI: AI agents that can play games like chess, Go, or video games fall under this category.
For instance, AlphaGo, developed by DeepMind, uses deep reinforcement learning to master the game of
Go and defeated world champions. OpenAI's agents like DQN and AlphaStar have also demonstrated high-
level gameplay in various games.
4. Chatbots and Virtual Assistants: Chatbots like Google's Duplex or OpenAI's GPT models are learning
agents that can hold natural language conversations with users. They learn from large datasets of text and
conversations to generate contextually relevant responses.
5. Industrial Automation: In manufacturing and industry, learning agents can optimize processes. For
example, robotic arms can learn how to perform complex tasks by observing human demonstrations or
through reinforcement learning, allowing them to adapt to changing conditions.
6. Healthcare Diagnostics: AI systems in healthcare can act as learning agents to aid in medical diagnosis.
They learn from large datasets of medical images and patient data to improve their accuracy in identifying
diseases, such as detecting tumors in medical images.
PEAS Descriptors of Task Environment
• PEAS is an AI agent representation system that focuses on evaluating the performance of the
environment, sensors, and actuators. We need to be aware of our job environment to create an
agent. The PEAS system aids in defining the task environment. Performance, Environment,
Actuators, and Sensors are abbreviated as PEAS. AI algorithms can be written more
effectively by identifying PEAS.
• Agents are devices that work in the environment to accomplish specific predetermined tasks.
They can be hardware, software, or a mix of the two. An intelligent agent does action
independently and endures for a longer time. To achieve a certain aim, it needs also to be
flexible. Agents interact with their surroundings through actuators and experience it through
sensors. One agent or several agents can be present in an environment.
• PEAS components:
• Performance
• Environment
• Actuators
• Sensors
• Performance − If the agent's performance is being evaluated by an objective function.
Things that we can use to measure an agent's performance.
• Environment − The environment refers to the agent's immediate surroundings at the time
the agent is working in that environment. Depending on the mobility of the agent, it might be
static or dynamic. The needed sensors and behaviors of the Agent will also alter in response
to a slight change in the surroundings.
• Performance −
• scoring goals, defending, speed
• Environment −
• playground, teammates, opponents, ball
• Actuators −
• body, dribbling, tackling, passing the ball, shooting
• Sensors −
• camera, ball sensor, location sensor, other players locator