Module 01
Module 01
Ar ficial Intelligence (AI) is the study and development of systems that can perform tasks
requiring intelligence. These tasks include reasoning, learning, problem-solving, and
decision-making. AI can be understood in different ways, depending on whether it focuses
on thinking or ac ng and whether the goal is to replicate human behaviour or achieve
logical ra onality.
The Turing Test, proposed by Alan Turing in 1950, is a prac cal way to define intelligence. A
computer is intelligent if a human interrogator, a er asking ques ons, cannot dis nguish
between responses from the computer and a human.
3. Automated Reasoning: To answer ques ons and make decisions using stored
knowledge.
4. Machine Learning: To learn from experience and adapt to new situa ons.
Although the Turing Test inspired much of AI's early development, researchers today focus
more on the principles of intelligence than on passing the test.
To design machines that think like humans, we need to understand how humans think. This
involves:
3. Brain Imaging: Analysing how the brain works during specific tasks.
Once we understand human cogni on, we can build computer models to replicate it. For
example, the General Problem Solver (GPS) program developed by Allen Newell and
Herbert Simon simulated human problem-solving by tracing reasoning steps similar to
humans.
This approach is part of cogni ve science, which combines AI with psychology to understand
the mind.
The laws of thought approach, origina ng with Aristotle, focuses on crea ng systems that
follow logical reasoning. Aristotle's syllogisms (e.g., "All men are mortal; Socrates is a man;
therefore, Socrates is mortal") represent early a empts at formal logic.
In the 19th century, logic was expanded to represent complex rela onships, and by the mid-
20th century, AI programs could solve problems expressed in logical terms. This method,
called the logicist tradi on, uses formal logic to build intelligent systems.
Challenges:
Despite these challenges, logical reasoning remains a key tool for developing intelligent
systems.
A ra onal agent is a system that acts to achieve the best outcome or maximize its goals
based on its knowledge. Unlike logic-based systems, ra onal agents can act intelligently even
when perfect solu ons are impossible.
Operate autonomously.
For example, recoiling from a hot stove is a ra onal ac on based on reflex, not logical
reasoning. Ra onal agents use knowledge, reasoning, and learning to act effec vely in
diverse situa ons.
Advantages:
2. Speech Recogni on: Automated systems enable voice-driven interac ons, such as
booking flights via phone, using advanced speech recogni on and dialog
management.
4. Game Playing: IBM's DEEP BLUE defeated chess champion Garry Kasparov in 1997,
showcasing AI's strategic reasoning capabili es.
5. Spam Detec on: Learning algorithms classify billions of emails daily as spam,
adap ng to new spamming tac cs effec vely.
6. Logis cs Planning: Tools like DART op mized logis cs for the U.S. military during the
Persian Gulf crisis, reducing planning me from weeks to hours.
7. Robo cs: AI-driven robots like Roomba vacuum cleaners and PackBot handle
household tasks and hazardous opera ons in conflict zones.
8. Machine Transla on: AI translates languages (e.g., Arabic to English) using sta s cal
models built from large datasets, enabling cross-language communica on without
requiring linguists.
An agent in Ar ficial Intelligence is any system that can observe its surroundings (using
sensors) and take ac ons to change or interact with the surroundings (using actuators). The
concept applies to humans, robots, and so ware programs.
Examples of Agents:
1. Human Agent:
o Sensors: Eyes (to see), ears (to hear), and other senses like touch and smell.
o Actuators: Hands, legs, and vocal cords, which allow us to perform ac ons
like wri ng, walking, or speaking.
2. Robo c Agent:
3. So ware Agent:
o Sensors: Inputs like keystrokes, file data, or network packets (messages sent
over the internet).
2. Percept Sequence: The complete history of what the agent has sensed so far.
An agent decides its ac ons based on the informa on it has gathered (precepts).
Its behaviour is governed by an agent func on, which specifies what ac on to take
for every possible percept sequence.
1. Agent Func on: A theore cal or mathema cal descrip on of how the agent
responds to every possible situa on (percept sequence).
o Example: A table showing "If the square is dirty, clean it; otherwise, move."
2. Agent Program: The actual implementa on or code inside the agent that makes it act
according to the agent func on.
Ac ons:
For example:
A good agent is one that performs well in achieving its goals. It should:
Act effec vely: Perform the ac ons in a way that achieves the goal.
In the vacuum cleaner world, a good agent would clean all the dirt in the shortest amount of
me and with minimal movement.
The concept of agents is a tool for understanding and designing intelligent systems. For
example:
Robots: They need to decide how to navigate and interact with their environment.
AI programs: They must take ac ons based on data, like classifying spam emails or
recommending movies.
So ware systems: They handle tasks like managing calendars, answering queries, or
automa ng processes.
A ra onal agent is an agent that always does the right thing. "Right thing" means that the
agent’s ac ons lead to desirable outcomes in its environment.
1. The performance measure should be based on the environment's states, not on the
agent’s opinion of its performance.
o Example: If we let the agent decide its own success, it might deceive itself
into thinking it performed perfectly even when it did not.
o This applies to broader topics like whether a steady life is be er than a risky
one.
2.2.1 Ra onality
Defini on of Ra onality
For an agent to be ra onal, its ac ons should maximize the performance measure based on:
Assump ons:
o It scores one point for each clean square at every me step during a life me
of 1000 me steps.
o The environment’s layout is known, but the dirt’s ini al loca on is unknown.
o The agent can move le , right, or suck up dirt.
o The agent can perceive its current loca on and whether there’s dirt.
If the environment or performance measure changes, the same agent might no longer
behave ra onally.
Example 1: If all dirt is cleaned and the agent keeps moving unnecessarily, it wastes
energy and loses points.
Solu on: A be er agent would stop moving once it confirms all squares are clean.
Example 2: If clean squares can become dirty again, the agent should periodically
check and re-clean them.
What is omniscience?
Omniscience means knowing the actual outcome of every ac on before it happens.
However, this is impossible in real-world scenarios because no one can predict the
future with certainty.
Example:
Imagine walking across the Champs Élysées to meet an old friend. There’s no traffic,
so crossing the street seems ra onal. But if a cargo door from an airplane
unexpectedly falls and hits you, it doesn’t mean you were irra onal—it just means
you couldn’t have foreseen the event.
Key takeaway:
Ra onality maximizes expected performance based on the informa on the agent
has, not the actual performance a er the fact. Expec ng agents to act perfectly (as if
they had a crystal ball) is unrealis c.
Ra onal agents need to take ac ons to improve their knowledge of the environment. This is
called informa on gathering.
Example:
When crossing a busy road, an agent that doesn’t look both ways is missing crucial
informa on (like a fast-approaching truck). A ra onal agent would first look, then
decide whether it’s safe to cross.
Learning
Ra onal agents should not only gather informa on but also learn from their experiences to
improve their behaviour over me.
2. Sphex wasp:
It drags a caterpillar to its burrow and checks the burrow before pu ng the
caterpillar inside. If the caterpillar is moved slightly during the check, the
wasp reverts to dragging it again and repeats this endlessly. It cannot learn or
modify its behaviour.
Why learn?
Fixed behaviours work only in predictable environments. Learning allows agents to
adapt when condi ons change or when their ini al assump ons fail.
Autonomy
What is autonomy?
An agent is autonomous if it relies on its own observa ons and learning rather than
just the knowledge programmed by its designer.
Example:
A vacuum-cleaning agent that learns pa erns of dirt accumula on (e.g., dirt appears
more near doorways) performs be er than one that follows a rigid cleaning
schedule.
Goal of autonomy:
Over me, the agent learns enough from its environment to operate effec vely, even
if the designer's prior knowledge was incomplete or incorrect.
2.3 THE NATURE OF ENVIRONMENTS
Task environment—the "problem" that ra onal agents aim to solve. Understanding the task
environment is essen al for designing ra onal agents.
The task environment is the se ng in which an agent operates and must be defined clearly.
The first step in designing any agent is to specify its task environment using the PEAS
framework:
P: Performance measure
E: Environment
A: Actuators
S: Sensors
This descrip on helps define the problem and the agent’s components.
An automated taxi driver is a complex task environment, and its PEAS descrip on looks like
this:
Performance Measure
The agent's goal is to perform a task as well as possible. In the case of the taxi, the
performance measure includes:
Minimizing trip me, fuel consump on, and wear and tear
Environment
Passengers
This environment is dynamic, so the taxi must adapt to new situa ons.
Actuators
These are the physical components the agent uses to interact with the environment. The
taxi's actuators include:
Sensors
Sensors allow the agent to perceive the environment. The taxi's sensors include:
In addi on to the taxi, there are other agent types with their own PEAS descrip ons. These
include:
Par ally Observable: The agent’s sensors are limited or noisy, so it cannot get full
informa on about the environment.
o Example: Taxi driving, where the agent cannot know the inten ons of other
drivers.
Single Agent: The environment has only one agent ac ng, like solving a crossword
puzzle.
Mul agent: Mul ple agents interact, and their ac ons can affect one another.
Determinis c: The next state of the environment is fully predictable based on the
current state and agent's ac on.
Sta c: The environment doesn’t change while the agent is making decisions.
Semi dynamic: The environment is sta c, but the performance score may change
over me, as seen in med chess games.
Discrete: The environment has a limited set of dis nct states, ac ons, or me steps.
Known: The agent (or designer) knows the rules or "laws" governing the
environment.
The text provides several examples of task environments with their characteris cs:
Task
Observable Agents Determinis c Episodic Sta c Discrete/Con nuous
Environment
Crossword
Fully Single Determinis c Sequen al Sta c Discrete
Puzzle
Chess with a
Fully Mul Determinis c Sequen al Semi Discrete
Clock
Taxi Driving Par ally Mul Stochas c Sequen al Dynamic Con nuous
Medical
Par ally Single Stochas c Sequen al Dynamic Con nuous
Diagnosis
Part-Picking
Par ally Single Stochas c Episodic Dynamic Con nuous
Robot
Insights:
For instance, an agent in a dynamic, stochas c, mul agent environment (like taxi
driving) must deal with uncertainty, plan for unpredictable changes, and coordinate
ac ons with others.
The hardest environments are par ally observable, mul agent, stochas c,
sequen al, dynamic, con nuous, and unknown.
o Example: Driving a rented car in a new country with unfamiliar geography and
traffic laws.
The goal of the agent is to maximize its average performance over all environments
in the class.
The agent program is the logic or so ware that decides the agent's ac ons based on
its observa ons (precepts).
It implements the agent func on, which maps percept sequences to ac ons.
o Architecture: The physical system, such as a robot, a PC, or a car with sensors
and actuators, that runs the agent program.
o Program: The logic designed to perform ac ons based on the agent's inputs.
For example:
A robo c vacuum cleaner with wheels and suc on requires a program to decide
where and when to clean.
If the program says "Walk," the architecture must have legs to execute it.
How Does an Agent Program Work?
An agent program takes the current percept from sensors and decides an ac on to
pass to actuators.
If the agent program needs to remember past percepts, it must include a memory
component.
There are four main types of agent programs, each suited to different environments:
c. Goal-Based Agents
d. U lity-Based Agents
TABLE-DRIVEN AGENT
How it works: Uses a lookup table with all possible percept-ac on pairs.
Why it fails:
1. The table size grows exponen ally with the number of percepts.
3. Designers can’t manually create the table for all situa ons.
For example:
A taxi agent would need a table to handle every possible road, traffic, and weather
combina on, which is imprac cal.
Memory: No physical system can store the enormous table for real-world
environments.
Guidance: Even for simple environments, there’s no easy way to define table entries.
Key Idea in AI
The goal of AI is to create compact programs that approximate ra onal behaviour without
relying on massive tables. For example:
Defini on: These agents choose ac ons based only on the current percept, ignoring
historical data. Their behaviour is dictated by a set of predefined condi on-ac on
rules, such as "if dirty, then clean."
Example:
o A vacuum cleaner agent that decides whether to clean or move based on
whether the current square is dirty.
o A driver braking when they see the brake lights of the car in front.
Implementa on:
Limita ons:
Defini on: These agents maintain an internal state to account for unobservable
aspects of the environment. This state is updated using a model of the world that
predicts how the environment evolves and how the agent’s ac ons affect it.
Structure:
Implementa on:
o This allows the agent to handle situa ons where not all necessary informa on
is directly observable.
Example:
o A taxi driver uses an internal model to track other vehicles' posi ons, even
when they're temporarily out of sight.
o It can also consider goals (e.g., deciding when to refuel) as part of its internal
state.
Advantages:
o Makes educated guesses about the current state and plans ac ons
accordingly.
These agents consider goals to decide their ac ons. A goal represents a desirable
state the agent strives to achieve (e.g., a taxi reaching its des na on).
They use a model of the environment to plan ac ons that lead to the goal.
Example: A taxi at a road junc on needs to decide whether to turn or go straight. The
decision depends on the goal des na on.
Advantages:
Flexibility: A change in the goal (des na on) doesn’t require reprogramming the
en re agent. Only the goal needs to be updated.
Adaptability: It can adjust its decisions if environmental condi ons (e.g., rain
affec ng brakes) change.
Goal-based agents predict future states and choose ac ons accordingly, making
them more adaptable.
Goals alone are insufficient for high-quality behavior because they don’t evaluate
the desirability of different ac ons. U lity-based agents address this.
U lity Func on: Measures the desirability of states, allowing the agent to make
trade-offs between conflic ng goals (e.g., speed vs. safety).
Benefits:
Can handle conflic ng goals by specifying trade-offs using a u lity func on.
Challenges:
These agents improve over me by learning from their experiences, making them
suitable for ini ally unknown environments.
Process of Learning:
Agents learn how the world works (“How the world evolves”) and the effects of their
ac ons (“What my ac ons do”).
Example:
A taxi learning to avoid sharp turns by observing other drivers’ reac ons (e.g.,
honking or shou ng). The cri c flags such ac ons as undesirable, and the agent
updates its rules.
How the components of agent programs work, focusing on the representa on of the
environment. The discussion categorizes these representa ons into atomic, factored, and
structured, emphasizing their increasing complexity and expressiveness.
o Descrip on: The simplest form of representa on, where each state is treated
as a single indivisible unit, like a "black box."
o Example: In a route-finding problem, each state could be the name of the city
you are currently in.
o Advantages: Simple and efficient for problems like search and game-playing.
o Limita ons: Cannot capture internal details or rela onships within a state.
o Applica ons: Used in algorithms like Hidden Markov Models and Markov
Decision Processes, where states are considered indivisible.
2. Factored Representa on:
o Descrip on: Breaks a state into a fixed set of a ributes or variables, each
with its own value. This enables shared a ributes across states.
o Example: In the driving problem, a ributes might include GPS loca on, fuel
level, and toll money.
o Advantages: More detailed and flexible than atomic representa ons, allowing
for par al informa on and uncertainty.
o Limita ons: S ll lacks the ability to capture rela onships between en es.
o Applica ons: Found in areas like constraint sa sfac on, proposi onal logic,
Bayesian networks, and planning.
o Descrip on: Describes states in terms of objects and their rela onships,
making it the most expressive representa on.
o Limita ons: More computa onally intensive for reasoning and learning.
o Applica ons: Underpins rela onal databases, first-order logic, natural
language understanding, and advanced learning algorithms.