Agents - KFUPM Open Courseware

advertisement
ICS-381
Principles of Artificial Intelligence
Weeks 3-4
Intelligent Agents
Chapter 2
Dr.Tarek Helmy El-Basuny
Dr. Tarek Helmy, ICS-KFUPM
1
Review: What is AI?
Views of AI fall into four categories:
Thinking humanly
Thinking rationally
Acting humanly
Acting rationally
We will focus on "acting rationally"
Acting rationally: rational agent
‰ Rational behavior: doing the right thing
‰ The right thing: which is expected to maximize goal achievement,
given the available information.
Dr. Tarek Helmy, ICS-KFUPM
2
Topics to be Covered
‰ What is Agent?
‰ Agents and Environments
‰ Rational Agents
‰ PEAS (Performance measure, Environment, Actuators, Sensors)
‰ Examples: Agents and Task Environments
‰ Environment Types
‰ Agent Types
 Table Driven Agents use a percept-action table in memory to find the next action.
 Reflex agents respond immediately to percepts.
 Goal-based agents act in order to achieve their goals.
 Utility-based agents maximize their own utility function.
 Learning agents improve their performance over time.
Dr. Tarek Helmy, ICS-KFUPM
3
Agents and Environments
‰ An agent is anything that can be viewed as perceiving its environment
through sensors and acting upon that environment through actuators.
Sensors
Environment
Percepts
?
Agent
Actions
Effectors
‰ Agent’s percepts sequence: the complete history of every thing the agent
has ever perceived.
‰ The agent function maps from percept histories to actions:
[f: P* Æ A]
‰ The agent program runs on the physical architecture to produce f
‰ Agent = Architecture + Program
Dr. Tarek Helmy, ICS-KFUPM
4
What do you mean? Sensors/Percepts and Effectors/Actions
‰Humans
ÂSensors: Eyes (vision), ears (hearing), skin (touch), tongue
(gustation), nose (olfaction), etc..
Â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: legs, arms, limbs, eyes, tongue, …
ÂActions: rotate left, walk, run, carry an object, …
Dr. Tarek Helmy, ICS-KFUPM
5
Example: Automated Taxi Driving System
‰ Percepts: Video, speedometer, engine sensors, keyboard input, microphone,
…
‰ Actions: Steer, accelerate, brake, horn, speak/display, …
‰ Goals: Maintain safety, reach destination, maximize profits (fuel, tire wear),
obey laws, provide passenger comfort, …
‰ Environment: Duhran street, freeways, traffic, weather, customers, …, etc.
‰ Different aspects of driving may require different types of agent programs!
Dr. Tarek Helmy, ICS-KFUPM
6
Vacuum-Cleaner World
‰
Percepts: location and state of the environment, Actions: Left, Right, Suck, NoOp
‰
There are only two locations: square A and square B, the agent perceives which square it is
in and whether there is dirt in the square. It can choose to move left, right or suck.
Dr. Tarek Helmy, ICS-KFUPM
7
Rational Agents
Rational Agent: one that does the right thing
‰ Rational Agent: Should select an action that is expected to maximize its
performance measure, based on the evidence provided by the percept sequence
and whatever built-in knowledge the agent has.
‰ Performance measure: An objective criterion for success of an agent's behavior
 E.g., performance measure of a vacuum-cleaner agent could be amount
of dirt cleaned up, amount of time taken, amount of electricity
consumed, amount of noise generated, etc.
„
• When do we evaluate the performance is also important. If we
measured how much dirt the agent cleaned up in the first hour of the
day, we would be rewarding those agents that start fast and punishing
those work late.
‰ Agents can perform actions in order to modify future percepts so as to obtain
useful information (information gathering, exploration)
‰ An agent is autonomous if its behavior is determined by its own percepts &
experience (with ability to learn and adapt) without depending solely on build-in
knowledge
Dr. Tarek Helmy, ICS-KFUPM
8
Rationality of Agents Depends on
‰ The performance measure that defines degree of success.
‰ Every thing the agent has seen so fare (the percept sequence).
‰ What the agent knows about the environment.
‰ The actions the agents can perform.
‰ For example, if an agent does not look both ways before crossing a
busy road, then its percept sequence will not tell it that there is a
truck coming at high speed. Crossing without looking is so
dangerous. So an ideal agent would look before crossing to
maximize the performance
Dr. Tarek Helmy, ICS-KFUPM
9
Ideal Rational Agents
Collaborative
Collaborative
Learning
LearningAgents
Agents
Cooperate
Cooperate
Learn
Learn
Smart
Smart
Agents
Agents
Autonomous
Autonomous
Collaborative
Collaborative
Agents
Agents
Dr. Tarek Helmy, ICS-KFUPM
Interface
Interface
Agents
Agents
10
Task Environment
‰ Before we design a rational agent we need to specify a task
environment
 A problem specification for which the agent is a solution
‰ PEAS: to specify a task environment
 Performance measure
 Environment
 Actuators
 Sensors
Dr. Tarek Helmy, ICS-KFUPM
11
PEAS: Taxi Driver Agent
‰ Example: Agent = Taxi driver
 Performance measure: Safe, fast, legal, comfortable trip,
maximize profits
 Environment: Roads, other traffic, pedestrians, customers
 Actuators: Steering wheel, accelerator, brake, signal, horn
 Sensors: Cameras, sonar, speedometer, GPS, odometer,
engine sensors, keyboard
Dr. Tarek Helmy, ICS-KFUPM
12
PEAS: Medical Diagnosis Agent
‰ Example: Agent = Medical diagnosis system
Performance measure: Healthy patient, minimize costs,
Environment: Patient, hospital, staff
Actuators: Screen display (questions, tests, diagnoses,
treatments, referrals)
Sensors: Keyboard (entry of symptoms, patient's answers)
Dr. Tarek Helmy, ICS-KFUPM
13
PEAS: Interactive English Tutor
‰ Agent: Interactive English tutor
‰ Performance measure: Maximize student's score on test
‰ Environment: Set of students
‰ Actuators: Screen display (exercises, suggestions, corrections)
‰ Sensors: Keyboard
Dr. Tarek Helmy, ICS-KFUPM
14
PEAS: Part-Picking Robot
‰ Example: Agent = Part-picking robot
‰ Performance measure: Percentage of parts in correct bins
‰ Environment: Conveyor belt with parts, bins
‰ Actuators: Jointed arm and hand
‰ Sensors: Camera, joint angle sensors
Dr. Tarek Helmy, ICS-KFUPM
15
Environment Types
‰ Fully observable (vs. partially observable): An agent's sensors give it access to the
complete state of the environment at each point in time.
‰ Deterministic (vs. stochastic): A deterministic environment is one in which any
action has a single guaranteed effect — there is no uncertainty about the state that
will result from performing an action.
‰ Episodic (vs. sequential): the performance of an agent is dependent on a number of
discrete episodes, with no link between the performance of an agent in different
scenarios.
‰ Static environment: A static environment is one that can be assumed to remain
unchanged except by the performance of actions by the agent.
‰ A dynamic environment: is one that has other processes operating on it, and which
hence changes in ways beyond the agent’s control.
‰ Discrete (vs. continuous): A limited number of distinct, clearly defined percepts and
actions, (e.g. Chess game).
‰ How do we represent or abstract or model the world?
‰ Single agent (vs. multi-agent): An agent operating by itself in an environment.
Dr. Tarek Helmy, ICS-KFUPM
16
Environment Types
Task environment
Observable
Deterministic/
Episodic/
Static/
Discrete/
Stochastic
Sequential
Dynamic
Continuous
Agents
Crossword puzzle
fully
deterministic
sequential
static
discrete
single
Chess with clock
fully
strategic
sequential
semi
discrete
multi
Poker
partial
stochastic
sequential
static
discrete
multi
Back gammon
fully
stochastic
sequential
static
discrete
multi
Taxi driving
partial
stochastic
sequential
dynamic
continuous
multi
Medical diagnosis
partial
stochastic
sequential
dynamic
continuous
single
Image analysis
fully
deterministic
episodic
semi
continuous
single
Part-picking robot
partial
stochastic
episodic
dynamic
continuous
single
Refinery controller
partial
stochastic
sequential
dynamic
continuous
single
Interact. Eng. tutor
partial
stochastic
sequential
dynamic
discrete
multi
Dr. Tarek Helmy, ICS-KFUPM
17
Some Agent Types
•
•
Goal of AI:
•
Given a PEAS task environment,
•
Construct agent function f,
•
Design an agent program that implements f on a particular architecture
Four basic agent types in order of increasing generality
•
Table-Driven Agents
–
Use a percept sequence/ action table in memory to find the next action. They are
implemented by a (large) lookup table.
•
Simple Reflex agents
–
Are based on condition-action rules and implemented with an appropriate
production (rule-based) system. They are stateless devices, which do not have
memory of past world states.
•
Model-based reflex
–
Have internal state, which is used to keep track of past states of the world.
•
Agents with Explicit Goals
–
Are agents, which in addition to state information have a kind of goal
information that describes desirable situations. Agents of this kind take future
events into consideration.
•
Utility-Based Agents
–
Base their decision on classic axiomatic utility-theory in order to act rationally.
Dr. Tarek Helmy, ICS-KFUPM
18
Table Driven Agent
Current state of decision process
Lookup- Table
for entire history
function REFLEX_VACUUM_AGENT( percept )
returns an action
(location,status) = UPDATE_STATE( percept )
if status = DIRTY then return SUCK;
else if location = A then return RIGHT;
else if location = B then return LEFT;
Dr. Tarek Helmy, ICS-KFUPM
19
Table Driven Agent
•
Problems
–
Huge number of possible percepts (consider an automated taxi with
a camera as the sensor) => lookup table would be huge.
–
Takes long time to build the table.
–
Not adaptive to changes in the environment; requires entire table to
be updated if changes occur.
Dr. Tarek Helmy, ICS-KFUPM
20
Simple Reflex Agents
•
It differs from the lookup table agent in that the condition (that
determines the action) is already higher-level interpretation of the
percepts.
• If car in front is breaking then initiate barking
•
A simple reflex agent works by finding a rule whose condition matches
the current situation (as defined by the percept) and then doing the
action associated with that rule.
function SIMPLE-REFLEX-AGENT(percept) returns action
static: rules, a set of condition-action rules
state Å INTERPRET-INPUT (percept)
rule Å RULE-MATCH (state,rules)
action Å RULE-ACTION [rule]
return action
Dr. Tarek Helmy, ICS-KFUPM
First match.
No further matches sought.
Only one level of deduction.
21
Simple Reflex Agents
Current state of decision process
NO MEMORY: Fails if environment
is partially observable
Example: Vacuum cleaner world
Dr. Tarek Helmy, ICS-KFUPM
22
Simple Reflex Agent
•
Simple Reflex Agent should has condition-action pairs defining all
possible condition-action rules necessary to interact in an environment
•
•
e.g. if car-in-front-is-breaking then initiate breaking
Problems
–
Table is still too big to generate and to store (e.g. taxi)
–
Takes long time to build the table
–
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
Dr. Tarek Helmy, ICS-KFUPM
23
Model-Based Reflex Agents
New: Description of current world state
Sometimes it is unclear what to do without a clear goal
•
In some applications, making a decision based on the current percepts only
is not the right one.
•
The agent has to maintain some sort of internal state, these states are:
•
How the world evolves ( what the state of the surrounded cars),
•
What will happen if this action does (going left or right is ok or no).
Dr. Tarek Helmy, ICS-KFUPM
24
Goal-Based Agent
•
Keeping track of the current state is often not enough. It
needs to add goals to decide which situations are good.
•
Choose actions so as to achieve a given goal.
•
A goal is a description of a desirable situation
•
May have to consider long sequences of possible actions
before deciding if goal is achieved, involves consideration of
the future.
Dr. Tarek Helmy, ICS-KFUPM
25
Goal-Based Agents
•
•
Goals provide reason to prefer one action over the other.
We need to predict the future: we need to plan & search
New
Dr. Tarek Helmy, ICS-KFUPM
26
Utility-based Agents
•
•
•
Some solutions to goal states are better than others.
Which one is best given by a utility function.
Which combination of goals is preferred?
New
Dr. Tarek Helmy, ICS-KFUPM
27
Learning Agents
•
•
How does an agent improve over time?
By monitoring it’s performance and suggesting better modeling, new action rules,
Evaluates
current
world
state
changes
action
rules
Model world
And decide on
actions to be
taken
suggests
explorations
Dr. Tarek Helmy, ICS-KFUPM
28
Summary
‰ What Is Agent?: Anything that can be viewed as perceiving its environment through
sensors and acting upon that environment through its effectors to maximize progress
towards its goals.
‰ Rational Agent
‰ Rational Action: The action that maximizes the expected value of the performance
measure given the percept sequence to date.
‰ Environment Types: Environments are accessible, non-deterministic, non-episodic,
dynamic, and continuous.
‰ Examples: Agents and Task Environments
‰ PEAS (Performance measure, Environment, Actuators, Sensors)
‰ Agent Types
 Table Driven Agents use a percept-action table in memory to find the next
Â
Â
Â
Â
action.
Reflex agents respond immediately to percepts.
Goal-based agents act in order to achieve their goals.
Utility-based agents maximize their own utility function.
Learning agents improve their performance over time.
Dr. Tarek Helmy, ICS-KFUPM
29
The End!!
Thank you
Any Questions?
Dr. Tarek Helmy, ICS-KFUPM
30
Download