Lecture Intelligent Agents

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

Artificial Intelligence

Dr. Gaurav Srivastav


BCAI-501
Agents and Environments

• Agents include humans, robots, softbots, thermostats, etc.

• The agent function maps from percept histories to actions:

f : P∗ → A

• The agent program runs on the physical architecture to produce f


Vacuum Cleaner World

• Percepts: location and contents, e.g., [A, Dirty]

• Actions: Left, Right, Suck, NoOp


Vacuum Cleaner Agent
Table Function
Percept sequence Action Input: location, status
[A, Clean] Right Output: action
[A, Dirty] Suck 1: if status = Dirty then
[B, Clean] Left 2: return Suck
[B, Dirty] Suck 3: end if
[A, Clean], [A, Clean] Right 4: if location = A then
[A, Clean], [A, Dirty] Suck 5: return Right
. . 6: end if
7: if location = B then
8: return Left
9: end if

• What is the right function?

• Can it be implemented in a small agent program?


Rationality
• Fixed performance measure evaluates the environment sequence
– one point per square cleaned up in time T ?
– one point per clean square per time step, minus one per move?
– penalize for > k dirty squares?

• A rational agent chooses whichever action maximizes the expected value of the
performance measure given the percept sequence to date

• Rational /= omniscient
→ percepts may not supply all relevant information

• Rational /= clairvoyant
→ action outcomes may not be as expected

• Hence, rational /= successful

• Rational =⇒ exploration, learning, autonomy


Intelligent Agent
Intelligent Agent
• Definition:

An intelligent agent perceives its environment via sensors and acts


rationally upon that environment with its effectors.

• A discrete agent receives percepts one at a time, and maps this percept
sequence to a sequence of discrete actions.

• Properties
– autonomous
– reactive to the environment
– pro-active (goal-directed)
– interacts with other agents via the environment
Sensors/Percepts and Effectors/Actions

• For example: humans


– Sensors: Eyes (vision), ears (hearing), skin (touch), tongue (gustation), nose
(olfaction), neuromuscular system (proprioception)
– Percepts:
∗ At the lowest level: electrical signals from these sensors
∗ After preprocessing: objects in the visual field (location, textures, colors, ...),
auditory streams (pitch, loudness, direction), ...
– Effectors: limbs, digits, eyes, tongue, ...
– Actions: lift a finger, turn left, walk, run, carry an object, ...

• Percepts and actions need to be carefully defined,


possibly at different levels of abstraction
Example: Self-Driving Car

• Percepts: Video, sonar, speedometer, odometer, engine sensors, keyboard input,


microphone, GPS, ...

• Actions: Steer, accelerate, brake, horn, speak/display, ...

• Goals: Maintain safety, reach destination, maximize profits (fuel, tire


wear), obey laws, provide passenger comfort, ...

• Environment: U.S. urban streets, freeways, traffic, pedestrians,


weather, customers, ...
• Different aspects of driving may require different types of agent programs
Rationality
• An ideal rational agent should, for each possible percept sequence, do
whatever actions will maximize its expected performance measure based
on
– percept sequence
– built-in and acquired knowledge

• Rationality includes information gathering, not ”rational


ignorance” (If you don’t know something, find out!)

• Need a performance measure to say how well a task has been


achieved

• Types of performance measures


– false alarm (false positive) rate
– false dismissal (false negative) rate
– speed
– resources required
– impact on environment
Autonomy

• A system is autonomous to the extent that its own behavior is


determined by its own experience

• Therefore, a system is not autonomous if it is guided by its designer


according to a priori decisions

• To survive, agents must have


– enough built-in knowledge to survive
– ability to learn
Agent types
Table-Driven Agents
• Table lookup of percept-action pairs mapping from every possible perceived state
to the optimal action for that state

• Problems
– too big to generate and to store (Chess has about 10120 states, for example)
– no knowledge of non-perceptual parts of the current state
– not adaptive to changes in the environment; requires entire table to be updated if
changes occur
– looping: can’t make actions conditional on previous actions/states
• Table-driven agents

use a percept sequence/action table in memory to find the next action. They are implemented by a
(large) lookup table.
Example:
•Scenario: A simple vacuum cleaner robot.
•Lookup Table:
•Percept Sequence: [Dirty, Left] → Action: Suck
•Percept Sequence: [Clean, Left] → Action: Move Right
•Percept Sequence: [Clean, Right] → Action: Move Left
•Percept Sequence: [Dirty, Right] → Action: Suck
•The robot looks up the current state of the room and the robot’s location in the table and takes the
appropriate action.
Simple Reflex Agents

• Rule-based reasoning to map from percepts to optimal action;


each rule handles a collection of perceived states

• Problems
– still usually too big to generate and to store
– still no knowledge of non-perceptual parts of state
– still not adaptive to changes in the environment;
requires collection of rules to be updated if changes occur
– still can’t make actions conditional on previous state
• Simple reflex agents
are based on condition-action rules, implemented with an appropriate production system.
They are stateless devices which do not have memory of past world states.

Example
• Scenario: Traffic light controller.
• Condition-Action Rules:
• Condition: Traffic light is green, car is in the intersection → Action: Let car pass
• Condition: Traffic light is red, car is approaching → Action: Stop car
• The traffic light controller decides actions purely based on the current state of the light and car’s
position, without any memory of past states.
Agents with Memory

• Encode ”internal state” of world to remember past contained in earlier percepts

• Needed because sensors do not usually give the entire state of the world at each input,
so perception of the environment is captured over time.

• ”State” is used to encode different ”world states” that generate the same
immediate percept

• Requires ability to represent change in the world; one possibility is to represent just the
latest state, but then can’t reason about hypothetical courses of action

• Example: Rodney Brooks’s Subsumption Architecture


Agents with memory : have internal state, which is used to keep track of past states of the world.

Example
•Scenario: Self-driving car.
•Internal State: Previous speed, direction, and nearby obstacles.
•Behavior: The car keeps track of its own speed and the surrounding traffic. If a car in front slows down,
the agent compares the current state with previous states and decides whether to slow down or change
lanes.
•This agent requires memory to safely navigate the environment.
• Agents with goals

are agents that, in addition to state information, have goal information that describes desirable
situations. Agents of this kind take future events into consideration.
Example
•Scenario: Chess-playing agent.
•Goal: Checkmate the opponent.
•Behavior: The chess agent evaluates moves by predicting how they will bring it closer to checkmating
the opponent. It doesn’t just react to the current board but works toward achieving its goal in future steps.
•The agent makes moves that not only counter immediate threats but also advance towards the goal of
winning the game.
• Utility-based agents

base their decisions on classic axiomatic utility theory in order to act rationally.
Example:
Scenario: Investment advisor agent.
Utility: Maximize the return on investment while minimizing risk.
Behavior: The agent evaluates multiple investment options, assigning a utility score to each (based on
factors like risk, return, and market conditions) and then recommends the option with the highest expected
utility.
The agent balances different goals (e.g., high returns vs. low risk) to make rational decisions.
Architecture of Table-Driven/Reflex Agent
Architecture of Agent with Memory
Environment
Properties of Environments
• Accessible/Inaccessible.
– if an agent’s sensors give it access to the complete state of the environment needed
to choose an action, the environment is accessible.
– such environments are convenient, since the agent is freed from the task of keeping
track of the changes in the environment.

• Deterministic/Nondeterministic
– an environment is deterministic if the next state of the environment is
completely determined by the current state of the environment and the action of the
agent.
– in an accessible and deterministic environment, the agent need not deal with
uncertainty.

• Episodic/Sequential
– an episodic environment means that subsequent episodes do not depend on what
actions occurred in previous episodes.
– such environments do not require the agent to plan ahead.
Properties of Environments
• Static/Dynamic
– a static environment does not change while the agent is thinking.
– the passage of time as an agent deliberates is irrelevant.
– the agent doesn’t need to observe the world during deliberation.

• Discrete/Continuous
– if the number of distinct percepts and actions is limited, the environment is discrete,
otherwise it is continuous.

• With/Without intelligent adversaries


– if the environment contains intelligent, adversarial agents, the agent needs to be
concerned about strategic, game-theoretic aspects of the environment
– most engineering environments don’t have rational adversaries, whereas most social
and economic systems get their complexity from the interactions of (more or less)
rational agents.
Characteristics of intelligent agent
1. Autonomy
An intelligent agent operates independently without human intervention once it's deployed. It can make
decisions and take actions based on its own experiences and observations of the environment.
Example: A self-driving car adjusts its speed and direction autonomously based on traffic conditions and
road signs.
Characteristics of intelligent agent
2.Reactivity
An intelligent agent can perceive its environment and respond to changes in real time. It can quickly
adapt to new or unexpected inputs from the environment.
Example: A robot that avoids obstacles in its path by sensing objects and reacting to avoid collisions.
Characteristics of intelligent agent
3.Proactiveness (Goal-Oriented Behavior)
Intelligent agents don’t just react; they also have goals or objectives they aim to achieve. They take
initiative and perform actions to accomplish those goals, even when no immediate stimuli are present.
Example: A chess-playing AI aims to win the game, proactively planning several moves ahead to achieve
that goal.
Characteristics of intelligent agent
4. Adaptivity (Learning Capability)
An intelligent agent can learn from past experiences and adapt its behavior over time. This allows it to
improve its performance and become more efficient at achieving its goals.
Example: A recommendation system that refines its suggestions based on user preferences and
interactions.
Characteristics of intelligent agent
5. Social Ability (Communication)
Some intelligent agents have the ability to communicate and collaborate with other agents or humans.
They can exchange information, negotiate, and work together to achieve their goals.
Example: Multi-agent systems where agents collaborate to solve complex problems like resource
allocation or scheduling.
Characteristics of intelligent agent
6.Rationality
An intelligent agent acts rationally by making decisions that maximize its expected performance with
respect to its goals. It takes the best possible action based on its knowledge and percepts.
Example: A financial trading bot that selects trades that maximize profit while minimizing risk.

You might also like