CSE 412: Artificial IntelligenceCSE 412: Artificial Intelligence
Topic - 2: Intelligent AgentsTopic - 2: Intelligent Agents
Fall 2018Fall 2018
Tajim Md. Niamat Ullah Akhund
Lecturer
Department of Computer Science and Engineering
Daffodil International University
Email: tajim.cse@diu.edu.bd
Agents and EnvironmentsAgents and Environments
Good Behavior: The Concept of RationalityGood Behavior: The Concept of Rationality
The Nature of EnvironmentsThe Nature of Environments
The Structure of AgentsThe Structure of Agents
Topic ContentsTopic Contents
Intelligent AgentIntelligent Agent
An agent
 perceives its environment with sensors
and
 acts upon that environment with its
actuators.
An agent gets percepts one at a time,
and maps this percept sequence to
actions.
3
Majidur RahmanMajidur Rahman
An AgentAn Agent
4
Majidur RahmanMajidur Rahman
Example of an AgentExample of an Agent
Let us consider a vacuum-cleaner agent that is
shown in the figure bellow.
The vacuum-cleaner world has just two locations:
squares A and B.
5
Example of an AgentExample of an Agent
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, suck up the
dirt, or do nothing.
One very simple agent function is the following: if
the current square is dirty, then suck; otherwise,
move to the other square.
6
Example of an AgentExample of an Agent
Environment: squares A and B
Percepts: [location, status], e.g. [A, Dirty]
Actions: left, right, suck, and no-op
7
Majidur RahmanMajidur Rahman
function REFLEX-VACUUM-AGENT ([location, status]) return an action
if status == Dirty then return Suck
else if location == A then return Right
else if location == B then return Left
Example of an AgentExample of an Agent
Majidur RahmanMajidur Rahman
Rational AgentRational Agent
 For each possible percept sequence, a rational agent
should select an action (using an agent function) that is
expected to maximize its performance measure, given
the evidence provided by the percept sequence and
whatever built-in prior knowledge the agent has.
 A percept sequence is the complete history of anything
the agent has ever perceived.
 A performance measure is a means of calculating how
well the agent has performed based on the sequence of
percepts that it has received.
 An agent’s prior knowledge of the environment is the
knowledge that the agent designer has given to the
agent before its introduction to the environment.
9
Majidur RahmanMajidur Rahman
Rational AgentRational Agent
 An agent function maps percept sequences to actions.
f : seq(P) →A
 Agent function for vacuum Cleaner example:
10
Majidur RahmanMajidur Rahman
Performance
Measures
Environment
Actuators
Sensors
used by the agent to perform actions
surroundings beyond the control of the agent
used to evaluate how well an agent
solves the task at hand
provide information about the current state of
the environment
 To design a rational agent we must specify its task
environment:
Task EnvironmentsTask Environments
11
Majidur RahmanMajidur Rahman
ExampleExample
PEAS description of the environment for an
automated taxi:
 Performance
Safety, destination, profits, legality, comfort
 Environment
Streets/motorways, other traffic, pedestrians, weather
 Actuators
Steering, accelerator, brake, horn, speaker/display
 Sensors
Video, sonar, speedometer, engine sensors, keyboard,
GPS
12
Majidur RahmanMajidur Rahman
Example…Example…
13
Majidur RahmanMajidur Rahman
Environment TypesEnvironment Types
The environment for an agent may be
 Fully or partially observable
 Deterministic or stochastic
 Episodic or sequential
 Static or dynamic
 Discrete or continuous
 Single or multi-agent
14
Majidur RahmanMajidur Rahman
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
Observable??
Deterministic??
Episodic??
Static??
Discrete??
Single-agent??
Majidur RahmanMajidur Rahman 15
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable??
Deterministic??
Episodic??
Static??
Discrete??
Single-agent??
Fully vs. partially observable: an environment is full observable when
the sensors can detect all aspects that are relevant to the choice of
action.
Majidur RahmanMajidur Rahman 16
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
Deterministic??
Episodic??
Static??
Discrete??
Single-agent??
Fully vs. partially observable: an environment is full observable when
the sensors can detect all aspects that are relevant to the choice of
action.
Majidur RahmanMajidur Rahman 17
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
DeterministicDeterministic??
Episodic??
Static??
Discrete??
Single-agent??
Deterministic vs. stochastic: if the next environment state is
completely determined by the current state the executed action then the
environment is deterministic.
Majidur RahmanMajidur Rahman 18
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
DeterministicDeterministic?? YES NO YES NO
Episodic??
Static??
Discrete??
Single-agent??
Deterministic vs. stochastic: if the next environment state is
completely
determined by the current state the executed action then the
environment is deterministic.
Majidur RahmanMajidur Rahman 19
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
DeterministicDeterministic?? YES NO YES NO
EpisodicEpisodic??
Static??
Discrete??
Single-agent??
Episodic vs. sequential: In an episodic environment the agent’s
experience can be divided into atomic steps where the agents perceives
and then performs a single action. The choice of action depends only on
the episode itself.
Majidur RahmanMajidur Rahman 20
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
Deterministic?? YES NO YES NO
EpisodicEpisodic?? NO NO NO NO
Static??
Discrete??
Single-agent??
Episodic vs. sequential: In an episodic environment the agent’s
experience can be divided into atomic steps where the agents perceives
and then performs a single action. The choice of action depends only on
the episode itself
Majidur RahmanMajidur Rahman 21
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
Observable?? FULL FULL PARTIAL PARTIAL
Deterministic?? YES NO YES NO
Episodic?? NO NO NO NO
Static??
Discrete??
Single-agent??
Static vs. dynamic: If the environment can change while the agent is
choosing an action, the environment is dynamic. Semi-dynamic if the
agent’s performance changes even when the environment remains the
same.
Majidur RahmanMajidur Rahman 22
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
DeterministicDeterministic?? YES NO YES NO
EpisodicEpisodic?? NO NO NO NO
StaticStatic?? YES YES SEMI NO
Discrete??
Single-agent??
Static vs. dynamic: If the environment can change while the agent is choosing
an action, the environment is dynamic. Semi-dynamic if the agent’s performance
changes even when the environment remains the same.
Majidur RahmanMajidur Rahman 23
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
Observable?? FULL FULL PARTIAL PARTIAL
Deterministic?? YES NO YES NO
Episodic?? NO NO NO NO
Static?? YES YES SEMI NO
Discrete??
Single-agent??
Discrete vs. continuous: This distinction can be applied to the state of the
environment, the way time is handled and to the percepts/actions of the agent.
Majidur RahmanMajidur Rahman 24
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
Observable?? FULL FULL PARTIAL PARTIAL
Deterministic?? YES NO YES NO
Episodic?? NO NO NO NO
Static?? YES YES SEMI NO
Discrete?? YES YES YES NO
Single-agent??
Discrete vs. continuous: This distinction can be applied to the state of the
environment, the way time is handled and to the percepts/actions of the agent.
Majidur RahmanMajidur Rahman 25
Environment TypesEnvironment Types
Solitaire Backgammom Internet shopping Taxi
ObservableObservable?? FULL FULL PARTIAL PARTIAL
DeterministicDeterministic???? YES NO YES NO
EpisodicEpisodic???? NO NO NO NO
StaticStatic???? YES YES SEMI NO
DiscreteDiscrete???? YES YES YES NO
Single-agentSingle-agent???? YES NO NO NO
Single vs. multi-agent: Does the environment contain other agents who are
also maximizing some performance measure that depends on the current
agent’s actions?
Majidur RahmanMajidur Rahman 26
Environment TypesEnvironment Types
The simplest environment is
 Fully observable, deterministic, episodic,
static, discrete and single-agent.
Most real situations are:
 Partially observable, stochastic, sequential,
dynamic, continuous and multi-agent.
Majidur RahmanMajidur Rahman 27
Agent TypesAgent Types
Four basic kinds of agent that embody the
principles underlying almost all intelligent systems:
 Simple reflex agents;
 Model-based reflex agents;
 Goal-based agents; and
 Utility-based agents.
28
Majidur RahmanMajidur Rahman
Agent Types: Simple ReflexAgent Types: Simple Reflex
 Select action on the basis of only
the current percept,
e.g. the vacuum-agent
 Large reduction in possible
percept/action situations
 Implemented through
condition-action rules
if dirty then suck
 Example:
– Agent: Mail sorting robot
– Environment: Conveyor belt of
letters
– Rule: e.g.
city = Edin → put Scotland bag
29
Majidur RahmanMajidur Rahman
Agent Types: Model-BasedAgent Types: Model-Based
 To tackle partially observable
environments
 Maintain internal state that
depends on percept history
 Over time update state using
world knowledge
 How does the world change
independently
 How do actions affect the world
 Example:
– Agent: Robot vacuum cleaner
– Environment: Dirty room, furniture
– Model: Map of room, which areas
already cleaned 30
Majidur RahmanMajidur Rahman
Agent Types: Goal-BasedAgent Types: Goal-Based
 The agent needs a goal to know
which situations are desirable
 Difficulties arise when long
sequences of actions are required
to find the goal
 Typically investigated in search
and planning research
 Major difference: future is taken
into account
 Example:
– Agent: Robot maid
– Environment: House and people
– Goal: Clean clothes, tidy room,
table laid, etc 31
Majidur RahmanMajidur Rahman
32
Agent Types: Utility-BasedAgent Types: Utility-Based
 Certain goals can be reached in
different ways
 Some are better: have a higher
utility
 Utility function maps a (sequence
of) state(s) onto a real number
 Improves on goals:
 Selecting between conflicting
goals
 Selecting between several goals
based on likelihood of success
and importance of goals
 Example:
– Agent: Mars Lander
– Environment: The surface of
mars with obstacles
– Utility: Shortest and obstacle-free
path Majidur RahmanMajidur Rahman
THANKS…
Majidur RahmanMajidur Rahman
********** ********** If You Need Me ********** **********
Mail: tajim.cse@diu.edu.bd
Website: https://www.tajimiitju.blogspot.com
ORCID: https://orcid.org/0000-0002-2834-1507
LinkedIn: https://www.linkedin.com/in/tajimiitju
ResearchGate: https://www.researchgate.net/profile/Tajim_Md_Niamat_Ullah_Akhund
YouTube: https://www.youtube.com/tajimiitju?sub_confirmation=1
SlideShare: https://www.slideshare.net/TajimMdNiamatUllahAk
Facebook: https://www.facebook.com/tajim.mohammad
GitHub: https://github.com/tajimiitju
Google+: https://plus.google.com/+tajimiitju
Gmail: tajim.mohammad.3@gmail.com
Twitter: https://twitter.com/Tajim53
Thank you
Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund

AI Lecture 2 (intelligent agents)

  • 1.
    CSE 412: ArtificialIntelligenceCSE 412: Artificial Intelligence Topic - 2: Intelligent AgentsTopic - 2: Intelligent Agents Fall 2018Fall 2018 Tajim Md. Niamat Ullah Akhund Lecturer Department of Computer Science and Engineering Daffodil International University Email: tajim.cse@diu.edu.bd
  • 2.
    Agents and EnvironmentsAgentsand Environments Good Behavior: The Concept of RationalityGood Behavior: The Concept of Rationality The Nature of EnvironmentsThe Nature of Environments The Structure of AgentsThe Structure of Agents Topic ContentsTopic Contents
  • 3.
    Intelligent AgentIntelligent Agent Anagent  perceives its environment with sensors and  acts upon that environment with its actuators. An agent gets percepts one at a time, and maps this percept sequence to actions. 3 Majidur RahmanMajidur Rahman
  • 4.
    An AgentAn Agent 4 MajidurRahmanMajidur Rahman
  • 5.
    Example of anAgentExample of an Agent Let us consider a vacuum-cleaner agent that is shown in the figure bellow. The vacuum-cleaner world has just two locations: squares A and B. 5
  • 6.
    Example of anAgentExample of an Agent 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, suck up the dirt, or do nothing. One very simple agent function is the following: if the current square is dirty, then suck; otherwise, move to the other square. 6
  • 7.
    Example of anAgentExample of an Agent Environment: squares A and B Percepts: [location, status], e.g. [A, Dirty] Actions: left, right, suck, and no-op 7 Majidur RahmanMajidur Rahman
  • 8.
    function REFLEX-VACUUM-AGENT ([location,status]) return an action if status == Dirty then return Suck else if location == A then return Right else if location == B then return Left Example of an AgentExample of an Agent Majidur RahmanMajidur Rahman
  • 9.
    Rational AgentRational Agent For each possible percept sequence, a rational agent should select an action (using an agent function) that is expected to maximize its performance measure, given the evidence provided by the percept sequence and whatever built-in prior knowledge the agent has.  A percept sequence is the complete history of anything the agent has ever perceived.  A performance measure is a means of calculating how well the agent has performed based on the sequence of percepts that it has received.  An agent’s prior knowledge of the environment is the knowledge that the agent designer has given to the agent before its introduction to the environment. 9 Majidur RahmanMajidur Rahman
  • 10.
    Rational AgentRational Agent An agent function maps percept sequences to actions. f : seq(P) →A  Agent function for vacuum Cleaner example: 10 Majidur RahmanMajidur Rahman
  • 11.
    Performance Measures Environment Actuators Sensors used by theagent to perform actions surroundings beyond the control of the agent used to evaluate how well an agent solves the task at hand provide information about the current state of the environment  To design a rational agent we must specify its task environment: Task EnvironmentsTask Environments 11 Majidur RahmanMajidur Rahman
  • 12.
    ExampleExample PEAS description ofthe environment for an automated taxi:  Performance Safety, destination, profits, legality, comfort  Environment Streets/motorways, other traffic, pedestrians, weather  Actuators Steering, accelerator, brake, horn, speaker/display  Sensors Video, sonar, speedometer, engine sensors, keyboard, GPS 12 Majidur RahmanMajidur Rahman
  • 13.
  • 14.
    Environment TypesEnvironment Types Theenvironment for an agent may be  Fully or partially observable  Deterministic or stochastic  Episodic or sequential  Static or dynamic  Discrete or continuous  Single or multi-agent 14 Majidur RahmanMajidur Rahman
  • 15.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi Observable?? Deterministic?? Episodic?? Static?? Discrete?? Single-agent?? Majidur RahmanMajidur Rahman 15
  • 16.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? Deterministic?? Episodic?? Static?? Discrete?? Single-agent?? Fully vs. partially observable: an environment is full observable when the sensors can detect all aspects that are relevant to the choice of action. Majidur RahmanMajidur Rahman 16
  • 17.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL Deterministic?? Episodic?? Static?? Discrete?? Single-agent?? Fully vs. partially observable: an environment is full observable when the sensors can detect all aspects that are relevant to the choice of action. Majidur RahmanMajidur Rahman 17
  • 18.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL DeterministicDeterministic?? Episodic?? Static?? Discrete?? Single-agent?? Deterministic vs. stochastic: if the next environment state is completely determined by the current state the executed action then the environment is deterministic. Majidur RahmanMajidur Rahman 18
  • 19.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL DeterministicDeterministic?? YES NO YES NO Episodic?? Static?? Discrete?? Single-agent?? Deterministic vs. stochastic: if the next environment state is completely determined by the current state the executed action then the environment is deterministic. Majidur RahmanMajidur Rahman 19
  • 20.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL DeterministicDeterministic?? YES NO YES NO EpisodicEpisodic?? Static?? Discrete?? Single-agent?? Episodic vs. sequential: In an episodic environment the agent’s experience can be divided into atomic steps where the agents perceives and then performs a single action. The choice of action depends only on the episode itself. Majidur RahmanMajidur Rahman 20
  • 21.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL Deterministic?? YES NO YES NO EpisodicEpisodic?? NO NO NO NO Static?? Discrete?? Single-agent?? Episodic vs. sequential: In an episodic environment the agent’s experience can be divided into atomic steps where the agents perceives and then performs a single action. The choice of action depends only on the episode itself Majidur RahmanMajidur Rahman 21
  • 22.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi Observable?? FULL FULL PARTIAL PARTIAL Deterministic?? YES NO YES NO Episodic?? NO NO NO NO Static?? Discrete?? Single-agent?? Static vs. dynamic: If the environment can change while the agent is choosing an action, the environment is dynamic. Semi-dynamic if the agent’s performance changes even when the environment remains the same. Majidur RahmanMajidur Rahman 22
  • 23.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL DeterministicDeterministic?? YES NO YES NO EpisodicEpisodic?? NO NO NO NO StaticStatic?? YES YES SEMI NO Discrete?? Single-agent?? Static vs. dynamic: If the environment can change while the agent is choosing an action, the environment is dynamic. Semi-dynamic if the agent’s performance changes even when the environment remains the same. Majidur RahmanMajidur Rahman 23
  • 24.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi Observable?? FULL FULL PARTIAL PARTIAL Deterministic?? YES NO YES NO Episodic?? NO NO NO NO Static?? YES YES SEMI NO Discrete?? Single-agent?? Discrete vs. continuous: This distinction can be applied to the state of the environment, the way time is handled and to the percepts/actions of the agent. Majidur RahmanMajidur Rahman 24
  • 25.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi Observable?? FULL FULL PARTIAL PARTIAL Deterministic?? YES NO YES NO Episodic?? NO NO NO NO Static?? YES YES SEMI NO Discrete?? YES YES YES NO Single-agent?? Discrete vs. continuous: This distinction can be applied to the state of the environment, the way time is handled and to the percepts/actions of the agent. Majidur RahmanMajidur Rahman 25
  • 26.
    Environment TypesEnvironment Types SolitaireBackgammom Internet shopping Taxi ObservableObservable?? FULL FULL PARTIAL PARTIAL DeterministicDeterministic???? YES NO YES NO EpisodicEpisodic???? NO NO NO NO StaticStatic???? YES YES SEMI NO DiscreteDiscrete???? YES YES YES NO Single-agentSingle-agent???? YES NO NO NO Single vs. multi-agent: Does the environment contain other agents who are also maximizing some performance measure that depends on the current agent’s actions? Majidur RahmanMajidur Rahman 26
  • 27.
    Environment TypesEnvironment Types Thesimplest environment is  Fully observable, deterministic, episodic, static, discrete and single-agent. Most real situations are:  Partially observable, stochastic, sequential, dynamic, continuous and multi-agent. Majidur RahmanMajidur Rahman 27
  • 28.
    Agent TypesAgent Types Fourbasic kinds of agent that embody the principles underlying almost all intelligent systems:  Simple reflex agents;  Model-based reflex agents;  Goal-based agents; and  Utility-based agents. 28 Majidur RahmanMajidur Rahman
  • 29.
    Agent Types: SimpleReflexAgent Types: Simple Reflex  Select action on the basis of only the current percept, e.g. the vacuum-agent  Large reduction in possible percept/action situations  Implemented through condition-action rules if dirty then suck  Example: – Agent: Mail sorting robot – Environment: Conveyor belt of letters – Rule: e.g. city = Edin → put Scotland bag 29 Majidur RahmanMajidur Rahman
  • 30.
    Agent Types: Model-BasedAgentTypes: Model-Based  To tackle partially observable environments  Maintain internal state that depends on percept history  Over time update state using world knowledge  How does the world change independently  How do actions affect the world  Example: – Agent: Robot vacuum cleaner – Environment: Dirty room, furniture – Model: Map of room, which areas already cleaned 30 Majidur RahmanMajidur Rahman
  • 31.
    Agent Types: Goal-BasedAgentTypes: Goal-Based  The agent needs a goal to know which situations are desirable  Difficulties arise when long sequences of actions are required to find the goal  Typically investigated in search and planning research  Major difference: future is taken into account  Example: – Agent: Robot maid – Environment: House and people – Goal: Clean clothes, tidy room, table laid, etc 31 Majidur RahmanMajidur Rahman
  • 32.
    32 Agent Types: Utility-BasedAgentTypes: Utility-Based  Certain goals can be reached in different ways  Some are better: have a higher utility  Utility function maps a (sequence of) state(s) onto a real number  Improves on goals:  Selecting between conflicting goals  Selecting between several goals based on likelihood of success and importance of goals  Example: – Agent: Mars Lander – Environment: The surface of mars with obstacles – Utility: Shortest and obstacle-free path Majidur RahmanMajidur Rahman
  • 33.
  • 34.
    ********** ********** IfYou Need Me ********** ********** Mail: tajim.cse@diu.edu.bd Website: https://www.tajimiitju.blogspot.com ORCID: https://orcid.org/0000-0002-2834-1507 LinkedIn: https://www.linkedin.com/in/tajimiitju ResearchGate: https://www.researchgate.net/profile/Tajim_Md_Niamat_Ullah_Akhund YouTube: https://www.youtube.com/tajimiitju?sub_confirmation=1 SlideShare: https://www.slideshare.net/TajimMdNiamatUllahAk Facebook: https://www.facebook.com/tajim.mohammad GitHub: https://github.com/tajimiitju Google+: https://plus.google.com/+tajimiitju Gmail: tajim.mohammad.3@gmail.com Twitter: https://twitter.com/Tajim53 Thank you Tajim Md. Niamat Ullah AkhundTajim Md. Niamat Ullah Akhund

Editor's Notes

  • #17 Volledige observeerbare omgevingen zijn handig omdat de agent geen Interne staat moet bijhouden over de omgeving Partieel observeerbare omgevingen door noise of niet goed afgestelde sensoren of ontbrekende informatie
  • #19 Als de omgeving gedeeltelijk observeerbaar is kan deze stochastisch lijken. Dus het is beter om te kijken of de omgebing determinitisch of stochastisch is vanuit het standpunt van de agent. Als de omgeving deterministisch is behalve de acties van de andere agenten dan is de omgeving strategisch.
  • #23 If the agent performance score changes ahen time passes, the environment is semi-dynamic.
  • #24 If the agent performance score changes ahen time passes, the environment is semi-dynamic.
  • #25 If the agent performance score changes ahen time passes, the environment is semi-dynamic.
  • #26 If the agent performance score changes ahen time passes, the environment is semi-dynamic.
  • #27 If the agent performance score changes ahen time passes, the environment is semi-dynamic.