Saltar al contenido principal
IT402 : Artificial Intelligence
Sanjivani Rural Education Society’s
Sanjivani College of Engineering, Kopargaon-423603
(An Autonomous Institute Affiliated to Savitribai Phule Pune University, Pune)
NAAC ‘A’ Grade Accredited, ISO 9001:2015 Certified
Department of Information Technology
(UG Course: NBA Accredited)
Mr. R. N. Kankrale
Assistant Professor
FOUNDATIONS OF ARTIFICIAL INTELLIGENCE AND INTELLIGENT
AGENTS
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Definition, Scope, and History of Artificial Intelligence, Applications of Artificial
Intelligence, Characteristics of Intelligent Systems, Intelligent Agents and
Rational Agents, PEAS Representation, Types of Environments, Agent
Architectures, Simple Reflex Agents, Model-Based Agents, Goal-Based Agents
Utility-Based Agents, Learning Agents, Problem Formulation and State-Space
Representation
Illustrative examples: Vacuum Cleaner World and Wumpus World.
Intelligent Agents
• “An agent is anything that can be viewed as perceiving its environment through sensors
and acting upon that environment through actuators.”
• For example;
➢A human agent has eyes, ears and other organs for sensors and hands, legs, vocal
tract and so on for actuators.
➢A robotic agent might have cameras and infrared range finders for sensors and
various motors for actuators.
➢A software agent receives keystrokes, file contents and network packets as sensory
inputs and acts on the environment by displaying on the screen, writing files, and
sending network packets.
18
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Characteristics of Intelligent Systems
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
1. Autonomy
Works without continuous human intervention.
Example:
A robot vacuum cleans the house automatically.
2. Perception
Observes the environment using sensors.
Example:
A self-driving car detects traffic signals.
3. Reasoning
Analyzes information before making decisions.
Example:
Google Maps selects the shortest route.
4. Learning
Learns from previous experiences.
Example:
Netflix recommends movies based on your viewing history.
Characteristics of Intelligent Systems
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
1. Autonomy
Works without continuous human intervention.
Example:
A robot vacuum cleans the house automatically.
2. Perception
Observes the environment using sensors.
Example:
A self-driving car detects traffic signals.
3. Reasoning
Analyzes information before making decisions.
Example:
Google Maps selects the shortest route.
4. Learning
Learns from previous experiences.
Example:
Netflix recommends movies based on your viewing history.
Real-Life Examples of Intelligent Agents
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Intelligent Agent Environment Sensors Actuators
Self-driving car Road Camera, GPS, LiDAR
Steering, Brake,
Accelerator
Robot Vacuum House
Dirt Sensor, Distance
Sensor
Wheels, Suction Motor
Chess AI Chess Board Board Position Chess Move
Google Maps Road Network GPS, Traffic Data Route Suggestion
Voice Assistant (Siri,
Alexa, Google
Assistant)
User Microphone Speaker, Display
ChatGPT User conversation Text Input Text Response
Agents and Environments
• Agents interact with environments through
sensors and actuators.
• The term percept is used to refer to the agent’s
perceptual inputs at any given instant.
• An agent’s percept sequence is the complete
history of everything the agent has ever
perceived.
• Also, we can say that, an agent’s behavior is
described by the agent function that maps any
given percept sequence to an action.
• Internally, the agent function for an artificial
agent will be implemented by an agent program.
19
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Concept of rationality
• A rational agent is one that does the right thing-conceptually speaking, every entry in the
table for the agent function is filled out correctly.
• What is rational at any given time depends on four things;
➢The performance measure that defines the criterion of success.
➢The agent’s prior knowledge of the environment.
➢The actions that the agent can perform.
➢The agent’s percept sequence to date.
• This leads to a definition of a rational agent;
“For each possible percept sequence, a rational agent should select an action that is
expected to maximize its performance measure, given the evidence provided by the
percept sequence and whatever built-in knowledge the agent has”.
22
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Nature of Environments
• As we had to specify the performance measure, the environment, and the agent’s actuators
and sensors. We group all these under the heading of the task environments.
• This is also called as PEAS(Performance, Environment, Actuators, Sensors).
• Let us consider a complex problem; An automated taxi driver.
23
Agent Type Performance
Measure
Environment Actuators Sensors
Taxi Driver Safe, fast, legal,
comfortable trip,
maximize profits
Roads, other traffic,
pedestrians,
customers
Steering, accelerator,
brake, signal, horn,
display
Cameras, sonar,
speedometer, GPS,
odometer,
accelerometer, engine
sensors, keyboard
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Examples of Agent types and their PEAS descriptions
Agent Type Performance
Measure
Environment Actuators Sensors
Medical
diagnosis
system
Healthy patient,
reduced costs
Patient, hospital,
staff
Display of questions,
tests, diagnosis,
treatments, referrals
Keyboard entry of
symptoms, findings,
patient’s answers
Satellite image
analysis
system
Correct image
categorization
Downlink from
orbiting satellite
Display of scene
categorization
Color pixel arrays
Part-picking
robot
Percentage of parts
in correct bins
Conveyor belt with
parts, bins
Jointed arm and
hand
Camera, joint angle
sensors
Refinery
controller
Purity, yield, safety Refinery operators Valves, pumps,
heaters, displays
Temperature, pressure,
chemical sensors
Interactive
English tutor
Student’s score on
test
Set of students,
testing agency
Display of exercises,
suggestions,
corrections
Keyboard entry
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Properties of task environments
1. Fully observable vs partially observable:
➢ If an agent’s sensors give it access to the complete state of the environment at each point in
time, then we say that the task environment is fully observable.
➢ An environment might be partially observable because of noisy and inaccurate sensors or
because parts of the state are simply missing from the sensor data.
➢ For example, a vacuum agent with only a local dirt sensor cannot tell whether there is dirt in
other squares and an automated taxi cannot see what other drivers are thinking.
➢ If the agent has no sensors at all then the environment is unobservable.
2. Single agent vs Multiagent:
➢ The distinction between single-agent and multiagent environments may seem simple enough.
➢ For example, an agent solving a crossword puzzle by itself is clearly in a single-agent
environment.
➢ Whereas, an agent playing chess is in a two-agent environment.
25
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
3. Deterministic vs Stochastic:
➢ If the next state of the environment is completely determined by the current state and the
action executed by the agent, then we say the environment is deterministic, otherwise, it is
stochastic.
➢ Most real situations are so complex that it is impossible to keep track of all the unobserved
aspects, for practical purposes, they must be treated as stochastic.
➢ Taxi driving is stochastic in this sense, because one can never predict the behaviour of traffic
exactly. The vacuum world is deterministic.
4. Episodic vs Sequential:
➢ In an episodic task environment, the agent’s experience is divided into atomic episodes.
➢ In each episode the agent receives a percept and then performs a single action.
➢ For example, an agent that has to spot defective parts on an assembly line. Here, the
current decision doesn’t affect whether the next part is defective or not.
➢ In sequential environments, the current decision could affect all future decisions. (eg: Chess
and taxi driving)
26
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
5. Static vs Dynamic:
➢ If the environment can change while an agent is deliberating, then we say the
environment is dynamic for that agent otherwise, it is static.
➢ If environment does not change with passing time but agent’s performance score does,
then we say the environment is semi-dynamic.
➢ Example of dynamic task environment is taxi driving, as the other cars and taxi itself
keep moving while the driving algorithm hesitates about what to do next.
➢ Static environments are easy to deal with because the agent need not keep looking at the
world while it is deciding on an action. Crossword puzzles are static.
6. Discrete vs Continuous:
➢ The discrete or continuous distinction applies to the state of the environment, to the way
time is handled, and to the percepts and actions of the agent.
➢ For eg: chess environment has a finite number of distinct states, set of percepts and
actions. But, taxi driving is a continuous state and time problem.
27
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
7. Known vs Unknown: (not a strict property of environment)
➢ In a known environment, the outcomes for all actions are given. And if the
environment is unknown, the agent will have to learn how it works in order to make
good decisions.
➢ A solitaire card game is an example of known environment where we know the
rules but still unable to see the cards that have not been turned over.
➢ For unknown environment, consider a new video game, where the screen may
show the entire game state but still we don’t know what the buttons do until we try
them.
28
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Examples
Task environment Fully
observable/
Partially
observable
Single/ Multi-
agent
Deterministic/
Stochastic
Episodic/
Sequential
Static/
Dynamic
Discrete/
Continuous
1.Cross word puzzle Fully Single Deterministic Sequential Static Discrete
2.Chess with a clock Fully Multi Deterministic Sequential Semi-
Dynamic
Discrete
3. Poker Partially Multi Stochastic Sequential Static Discrete
4. Taxi driving Partially Multi Stochastic Sequential Dynamic Continuous
5. Medical
diagnosis
Partially Single Stochastic Sequential Dynamic Continuous
6. Image analysis Fully Single Deterministic Episodic Semi-
Dynamic
Continuous
7. Part picking
robot
Partially Single Stochastic Episodic Dynamic Continuous
8. Interactive
English Tutor
Partially Multi Stochastic Sequential Dynamic Discrete
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
The Structure of Agents
• The job of AI is to design an agent program that implements the agent function(the mapping from
percepts to actions). We assume this program will run on some sort of computing device with
physical sensors and actuators----we call this the architecture.
➢ Agent = architecture + program.
• The agent program takes just the current percept as input because nothing more is available from
the environment.
• We can describe the agent programs in the simple pseudocode language that is defined as follows;
30
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
The Structure of Agents
• The table-driven approach to agent construction certainly fails.
• To understand the reason, consider the example of automated taxi, the visual input from a single
camera comes in at rate of roughly 27 MB/sec(ie. 30 frames/sec, 640*480 pixels with 24 bits of
color information). This gives a lookup table with over 10250,000,000,000 entries for an hours driving.
• Even the lookup table for chess would have at least 10150 entries.
• So, no physical agent in this universe will have the space to store the table, no agent could ever
learn all table entries right from its experience.
• We can outline four basic kinds of agent programs that embody the principles underlying almost
all intelligent systems;
➢ Simple reflex agents,
➢ Model-based reflex agents,
➢ Goal-based agents and
➢ Utility-based agents.
31
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Simple reflex agents
• The simplest kind of agent is the simple reflex agent. These agents select actions on the basis of
the current percept, ignoring the rest of the percept history. For example, the vacuum agent.
• Notice that the vacuum agent program is very small compared to the corresponding table. The most
obvious reduction comes from ignoring the percept history, which cutsdown the number of
possibilities from 4T to just 4. A further, small reduction comes from the fact that when the current
square is dirty, the action does not depend on the location.
32
Absorb
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Simple reflex agents
• Simple reflex behaviors occur even in more complex environments. Imagine yourself as
the driver of the automated taxi.
• If the car in front brakes and its brake lights become on, then we should notice this and
initiate braking. In other words, some processing is done on the visual input to
establish the condition we call “The car in front is braking.”
• Then, this triggers some established connection in the agent program to the action
“initiate braking.”
• We call such a connection a condition–action rule, written as;
➢if car-in-front-is-braking then initiate-braking.
33
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Simple reflex agents
• A more general and flexible approach is
first to build a general-purpose
interpreter for condition–action
rules and then to create rule sets for
specific task environments.
• We use rectangles to denote the
current
agent’s
ovals
internal state of the
decision process, and
to represent the
background information used in
the process.
• The INTERPRET-INPUT function
generates an abstracted description of
the current state from the percept, and
the RULE-MATCH function returns the
first rule in the set of rules that
matches the given state description.
34
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Model-based reflex agents
• The most effective way to handle partial observability is for the agent to keep track of the part of
the world it can’t see now.
• That is, the agent should maintain some sort of internal state that depends on the percept
history and thereby reflects at least some of the unobserved aspects of the current state.
• Updating this internal state information as time goes by requires two kinds of knowledge to be
encoded in the agent program;
➢ First, we need some information about how the world evolves independently of the agent—for
example, that an overtaking car generally will be closer behind than it was a moment
ago.
➢ Second, we need some information about how the agent’s own actions affect the world—for
example, that when the agent turns the steering wheel clockwise, the car turns to the
right.
• This knowledge about “how the world works”—whether implemented in simple Boolean circuits
or in complete scientific theories—is called a model of the world. An agent that uses such a model
is called a model-based agent.
35
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Model-based reflex agents
• Figure gives the structure of the model-based reflex agent with internal state, showing how
the current percept is combined with the old internal state to generate the updated
description of the current state, based on the agent’s model of how the world works.
36
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Model-based reflex agents
• The agent program is shown in Figure.
The interesting part is the function
UPDATE-STATE, which is responsible
for creating the new internal state
description.
• The details of how models and states are
represented vary widely depending on
the type of environment and the
particular technology used in the agent
design.
• Regardless of the kind of representation
used, it is seldom possible for the agent
to determine the current state of a
partially observable environment exactly.
• Instead, the box labelled “what the world
is like now” represents the agent’s “best
guess”.
37
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Goal-based agents
• Knowing something about the current
state of the environment is not always
enough to decide what to do.
• For example, at a road junction, the taxi
can turn left, turn right, or go straight
on.
• The correct decision depends on where
the taxi is trying to get to.
• In other words, the agent needs some
sort of goal information that describes
situations that are desirable.
• The agent program can combine this
with the model to choose actions that
achieve the goal.
38
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Goal-based agents
• Sometimes goal-based action selection is straightforward—for example, when goal
satisfaction results immediately from a single action. Sometimes it will be trickier—for
example, when the agent has to consider long sequences of twists and turns in order to find
a way to achieve the goal.
• Although the goal-based agent appears less efficient, it is more flexible because the
knowledge that supports its decisions is represented explicitly and can be modified.
• If it starts to rain, the agent can update its knowledge of how effectively its brakes will
operate; this will automatically cause all of the relevant behaviors to be altered to suit the
new conditions.
• The goal-based agent’s behavior can easily be changed to go to a different destination,
simply by specifying that destination as the goal.
• The reflex agent’s rules for when to turn and when to go straight will work only for a single
destination; they must all be replaced to go somewhere new.
39
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Utility-based agents
• The term utility is used as a general performance measure that allows a comparison of
different world states according to exactly how happy they would make the agent.
• The performance measure assigns a score to any given sequence of environment states, so it
can easily distinguish between more and less desirable ways of getting to the taxi’s
destination.
• An agent’s utility function is essentially an internalization of the performance measure.
• If the internal utility function and the external performance measure are in agreement, then
an agent that chooses actions to maximize its utility will be rational according to the
external performance measure.
• Technically speaking, a rational utility-based agent chooses the action that maximizes the
expected utility of the action outcomes—that is, the utility the agent expects to derive, on
average, given the probabilities and utilities of each outcome.
40
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Utility-based agents
41
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Learning agents
• A learning agent can be divided into four conceptual components;
➢Learning element: which is responsible for making improvements. It uses feedback
from the critic on how the agent is doing and determines how the performance element
should be modified to do better in the future.
➢Performance element: which is responsible for selecting external actions, it takes in
percepts and decides on actions.
➢Critic: tells the learning element how well the agent is doing with respect to a fixed
performance standard.
➢Problem generator: It is responsible for suggesting actions that will lead to new and
informative experiences.
42
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Learning agents
43
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Problem solving agents, Problem formulation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Intelligent agents are supposed to maximize
its performance measure. Achieving this can be
simplified if the agent can adopt a goal and aim to
satisfy it.
Setting goals help the agent organize its behavior by
limiting the objectives that the agent is trying to
achieve and hence the actions it needs to consider.
This Goal formulation based on the current situation
and the agent’s performance measure is the first step
in problem solving.
Problem solving agents, Problem formulation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Problems and Solutions
Before we get into more about problem formulating phase, we need to first understand
what a problem is in terms of problem solving agents.
The problem can be defined formally in five components:
1.Initial State
2.Actions
3.Transition Model
4.Goal Test
5.Path Cost
Problem solving agents, Problem formulation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Initial State
The first component that describes the problem is the initial state that the agent starts
in. For example, if a taxi agent needs to get to location(B) but the taxi is currently at
location(A) then the initial state of the problem would be location(A).
Actions
The second component that describes the problem is a description of the
possible actions available to the agent. Given a state s, Actions(s) returns the set of
actions that can be executed in s. We say that each of these actions is applicable in s.
Transition Model
The third component is the description of what each action does which is called
the transition model. It is specified by a function Result(s , a) that returns the state
that results from doing action a in state s.
Problem solving agents, Problem formulation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
The initial state, actions and transition model together define the state space of a
problem which is a set of all states reachable from the initial state by any sequence of
actions. The state space forms a graph in which the nodes are states and the links
between the nodes are actions.
Goal Test
The goal test determines whether a given state is a goal state or not. Sometimes there
is an explicit set of possible goal states and the test simply checks whether the given
state is one of them. Sometimes the goal is specified by an abstract property rather
than an explicitly enumerated set of states.
Path Cost
The last component of the problem is the path cost which is a function that assigns a
numeric cost to each path. The problem solving agent chooses a cost function that
reflects its own performance measure.
Problem solving agents, Problem formulation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
The solution to the problem is an action sequence that leads from initial state to goal
state and the solution quality is measured by the path cost function. An optimal
solution has the lowest path cost among all the solutions.
An Example Problem Formulation
Let us take the example of vacuum world that was introduced in the starting of this
series, There is a vacuum cleaner agent and it can move left or right and its jump is to
suck up the dirt from the floor.
State space for vacuum world.
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
State space for vacuum world.
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
The problem for vacuum world can be formulated as follows:
States: The state is determined by both the agent location and the dirt location. The agent
is in one of two locations, each of which might or might not contain dirt. Therefore, there
are 2 x 2² = 8 possible world states.
A larger environment would have n x 2 to the power of n states.
Initial State: Any state can be assigned as the initial state in this case.
Action: In this environment there are three actions, Move Left , Move Right , Suck up the
dirt.
Transition Model: All the actions have expected effects, except for when the agent is in
leftmost square and the action is Left, when the agent is in rightmost square and the
action is Right and the square is clean when the action is to Suck.
State space for vacuum world.
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Goal Test: Goal test checks whether all the squares are clean.
Path Cost: Each step costs 1, so the path cost is the number of steps in the path.
The vacuum world problem is a toy problem and involves only discrete locations, discrete
dirt etc. Therefore, this problem is a Toy Problem. There are many Real-World
Problems like the automated taxi world. Try to formulate problems of real world and see
what would be the states be and what actions could be chosen etc.
Example: Vacuum Cleaner
• Consider the simple example of, Vacuum-
cleaner world.
• This particular world has just two locations:
squares A and B.
• The vacuum agent perceives which square it is
in and whether there is dirt in the square.
• It can choose to move left, move right, absorb
the dirt or do nothing.
• One very simple agent function is; if the
current square is dirty then absorb the dirt
otherwise move to the other square.
20
Percept Sequence Action
[A, Clean] Right
[A, Dirty] Absorb
[B, Clean] Left
[B, Dirty] Absorb
[A, Clean], [A, Clean] Right
[A, Clean], [A, Dirty] Absorb
:
:
:
:
[A, Clean], [A, Clean], [A, Clean] Right
[A, Clean], [A, Clean], [A, Dirty] Absorb
:
:
:
:
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Example: Vacuum Cleaner
21
Sanjivani College of Engineering, Kopargaon Dept of Information Technology
Problem Formulation and State-Space Representation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Component Description
Performance Measure
Clean all squares, minimize time, minimize
energy consumption
Environment Two-room or multi-room environment with dirt
Actuators Move Left, Move Right, Suck, NoOp (optional)
Sensors Dirt sensor, Location sensor
PEAS Description
Problem Formulation and State-Space Representation
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
The classical vacuum cleaner environment has the following properties:
•Fully Observable: The agent knows its location and the cleanliness of all rooms.
•Deterministic: Each action (e.g., Suck) produces a predictable result.
•Sequential: Current actions affect future states and decisions.
•Static: The environment does not change while the agent is deciding.
•Discrete: The environment has a finite number of rooms, actions, and states.
•Single Agent: Only one vacuum cleaner operates in the environment.
•Known: The outcomes of actions are known in advance.
Artificial Intelligence
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Text Books:
1. Elaine Rich and Kevin Knight, "Artificial Intelligence" Tata McGraw
Hill.
2. Stuart Russell & Peter Norvig, "Artificial Intelligence: A Modern
Approach", Pearson Education, 2nd Edition.
Artificial Intelligence
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Reference Books:
1. Ivan Bratko, "Prolog Programming For Artificial Intelligence", 2nd
Edition, Addison Wesley, 1440.
2. Eugene, Charniak, Drew Mcdermott, "Introduction to Artificial
Intelligence", Addison Wesley.
3. Patterson, “Introduction to AI and Expert Systems”, PHI.
4. Nilsson, “Principles of Artificial Intelligence”, Morgan Kaufmann.
5. Carl Townsend, “Introduction to turbo Prolog”, Paperback, 1483.
6. Jacek M. Zurada, “Introduction to Artificial Neural Systems”, Jaico
Publication.
Artificial Intelligence
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
eLearning Resources:
➢Online Courses:
1. An Introduction to Artificial Intelligence by Prof. Mausam, IIT Delhi, NPTEL
Course.
2. AI for Everyone by Andrew Ng, Coursera Course.
➢eResources:
1. http://www.eecs.qmul.ac.uk/~mmh/AINotes/AINotes4.pdf
2. https://www.slideshare.net/JismyKJose/conceptual-dependency-70129647
3.https://web.archive.org/web/20150813153834/http://www.cs.berkeley.edu/~zadeh/p
apers/Fuzzy%20Sets-Information%20and%20Control-1965.pdf
4. https://www.youtube.com/watch?v=aircAruvnKk
5. https://www.youtube.com/watch?v=IHZwWFHWa-w
Artificial Intelligence
Artificial Intelligence – Overview Mr. R. N. Kankrale Department of Information Technology
Thank You