Artificial Intelligence 1 Rational Agents - User Websites …takoehle/teaching/ai/... ·  ·...

31
© HSLU - JK Artificial Intelligence 1 Rational Agents Prof. Dr. Jana Koehler Fall 2016

Transcript of Artificial Intelligence 1 Rational Agents - User Websites …takoehle/teaching/ai/... ·  ·...

© HSLU - JK

Artificial Intelligence 1 Rational Agents

Prof. Dr. Jana Koehler Fall 2016

© HSLU - JK

Agenda

The Rational Agent – perception – cognition - action

Properties of Environments

Types of Agents

– Simple Reflex agents respond immediately to percepts – Goal-based agents work towards goals – Utility-based agents try to maximize their reward – Learning agents improve their behavior over time

2 Artificial Intelligence 2016 - Rational Agents

© HSLU - JK

What is an Agent?

Artificial Intelligence 2016 - Rational Agents 3

11- https://www.youtube.com/watch?v=IK7l4ZLm55I

© HSLU - JK

The Rational Agent

AGENT = something that acts (latin agere, do, make …)

RATIONAL AGENT = acts so as to achieve the best expected outcome

Rational thinking is one possible mechanism to achieve rational behavior

Perfect rationality cannot be achieved in complex environments – LIMITED RATIONALITY = acting appropriately

Artificial Intelligence 2016 - Rational Agents 5

© HSLU - JK

Agent

Perceive the environment through sensors (= percepts) Act upon the environment through actuators (= actions)

Examples: Humans and animals, robots and software agents (softbots), temperature control, ABS, . .

Artificial Intelligence 2016 - Rational Agents 6

© HSLU - JK

A Simplified Human Agent

Artificial Intelligence 2016 - Rational Agents 7

© HSLU - JK

The Vacuum Cleaner Agent

Percepts – Am I in square A or B? – Is the square dirty?

Actions – move left, move right – suck – do nothing

Artificial Intelligence 2016 - Rational Agents 8

© HSLU - JK

Modeling the Agent

Percept sequence – complete history of what the agent has perceived to date

Agent function

– a function that maps any given percept sequence to an action

Agent program – implementation of the agent function

Artificial Intelligence 2016 - Rational Agents 9

© HSLU - JK

An Agent Table

Artificial Intelligence 2016 - Rational Agents 10

percept sequence action [A, clean] right [A, dirty] suck [B, clean] left [B, dirty] suck [A, clean], [A, clean] right [B, clean], [B,clean] left … …

"If the current square is dirty, then suck else move to the other square."

© HSLU - JK

Rational Agents

. . . do the "right thing"! In order to evaluate their performance, we have to define a

performance measure Vacuum cleaner agent

– m2 per hour, level of cleanliness, energy usage, noise level, safety (behavior towards hamsters/small children)

Optimal behavior is often unattainable

– Not all relevant information is perceivable – Complexity of the problem is too high

Artificial Intelligence 2016 - Rational Agents 11

© HSLU - JK

Rationality vs. Omniscience

An omniscient agent knows the actual effects of its actions

In comparison, a rational agent behaves according to its percepts and knowledge and attempts to maximize the expected performance

Example: If I look both ways before crossing the street, and then as I cross I am hit by a meteorite, I can hardly be accused of lacking rationality

Rationality maximizes expected performance, perfection maximizes actual performance

Artificial Intelligence 2016 - Rational Agents 12

© HSLU - JK

Rational Agent - Definition

Rational behavior is dependent on – performance measures (goals) – percept sequences – knowledge of the environment – possible actions

Artificial Intelligence 2016 - Rational Agents 13

© HSLU - JK

The Performance Measure

Each action of the agent takes the world to another state

If the sequence of world states is desirable for an external observer, the agent has performed well

The performance measure evaluates the STATES of the ENVIRONMENT independent of the AGENT! otherwise an agent could achieve perfect rationality

simply by deluding itself that its performance was perfect – You get the behavior you reward Vacuum cleaner: amount of dirt collected – suck, release, suck,

release, suck

Artificial Intelligence 2016 - Rational Agents 14

© HSLU - JK

Specifying Task Environments (PEAS)

Artificial Intelligence 2016 - Rational Agents 15

© HSLU - JK

Properties of Task Environments

Artificial Intelligence 2016 - Rational Agents 16

Question Yes No Are all relevant aspects of the environment accessible by the agent's sensors thus observable?

Accessible Inaccessible

Do effects of actions happen as planned by the agent?

Deterministic Stochastic

Do effects of actions only depend on the current state and the action?

Episodic Sequential

Examples • breaking on a dry road • breaking on an icy road • throwing a dice • classifying an object with rules based on it's properties • moving the king in a chess game

© HSLU - JK

Properties of Task Environments

Artificial Intelligence 2016 - Rational Agents 17

Question Yes No Is the environment changing while the agent is deliberating?

Dynamic Static

Can the environment be modeled with discrete states?

Discrete Continuous

Can we model the AI system with only one agent? Single-Agent Multi-Agent

Does the agent have complete knowledge of the environment?

Known Unknown

Examples • playing basketball • controlling the movement of a walking robot • playing go • interaction between autonomous cars • playing robocup soccer • exploring an unkown city

© HSLU - JK

An Example Environment

Environments that are unknown, partially observable, nondeterministic, stochastic, dynamic, continuous, and multi-agent are the most challenging.

Artificial Intelligence 2016 - Rational Agents 18

• Accessible/Inaccessible • Deterministic/Stochastic • Episodic/Sequential • Static/Dynamic • Discrete/Continuous • Single agent/Multi-agent • Known/Unknown

© HSLU - JK

Structure of Rational Agents

Realization of the ideal mapping through an – Agent program, executed on an – Architecture which also provides an interface to the

environment (percepts, actions)

Artificial Intelligence 2016 - Rational Agents 19

© HSLU - JK

Types of Agents

Agents differ in their capabilities – Exploration: explorative actions for information

gathering – Learning: as much as possible from the perceipts – Autonomy: improve partial or incorrect knowledge

4 Types Simple Reflex Agent Goal-based Agent Utility-based Agent Learning Agent

Artificial Intelligence 2016 - Rational Agents 20

© HSLU - JK

Simple Reflex Agent

Senses the world and responds immediately based on simple rules that interpret the sensor input and link it to actions – no explicit world model, no "memory"

Artificial Intelligence 2016 - Rational Agents 21

© HSLU - JK

Function of the Reflex Agent

Artificial Intelligence 2016 - Rational Agents 22

Condition-action-rule (productions) "If car -in-front-is-braking then initiate-braking."

© HSLU - JK

When do Simple Reflex Agents work?

Correct decision is made based on current percepts only − environment must be fully observable, otherwise infinite

loops can occur − escape from infinite loops through randomization

Vacuum agent without a location sensor and in a clean

room A: moving left will fail forever Vacuum agent with a coin flip to choose a move

Artificial Intelligence 2016 - Rational Agents 23

© HSLU - JK

Goal-based Agent

Builds a model of the world and uses an explicit representation of goals

Evaluates the effects of actions on the world model before selecting an action

Artificial Intelligence 2016 - Rational Agents 27

© HSLU - JK

Utility-based Agent

If several actions are possible in a state, this agent can evaluate their utility and make a deliberate choice – reaches the goal via "useful" intermediate states

Artificial Intelligence 2016 - Rational Agents 28

© HSLU - JK

Utility-based Agent - Utility Function

The utility function is used by the agent to evaluate the desirability of a state of the world

A utility function maps a state (or a sequence of states) onto a real number

The agent can use these numbers – to select an action (sequence) – to weigh the importance of competing goals

Artificial Intelligence 2016 - Rational Agents 29

© HSLU - JK

Learning Agent

This agent can reflect on it's own performance and improve over time

Artificial Intelligence 2016 - Rational Agents 30

© HSLU - JK

Learning Agent

Learning agents can become more competent over time Can start with an initially empty knowledge base Can operate in initially unknown environments

Responsibilites of its components

– performance element: corresponds to a utility-based agent and selects the next action of the agent

– learning element: improves the performance element by posing new tasks

– critic: evaluates the behavior of the agent based on the sensor input and gives the evaluation as feedback to the learning element

– problem generator: suggests actions that will lead to informative experiences

Artificial Intelligence 2016 - Rational Agents 31

© HSLU - JK

Summary Questions

1. What is a rational agent?

2. How can we characterize environments?

3. What types of rational agents do we distinguish?

Artificial Intelligence 2016 - Rational Agents 32

© HSLU - JK

Exercise 1.1 Performance Measure vs. Utility

a) What is the difference between a performance measure and a utility function?

b) Describe the relation between the performance measure and the utility function for a learning agent.

Artificial Intelligence 2016 - Rational Agents 33

© HSLU - JK

Exercise 1.2 Table Size for a Table Driven Agent

Let P be the set of possible percepts and T the lifetime of the agent (the total number of perceipts it will receive) a) What is the size of P for the vacuum cleaning agent? b) How many different percepts are possible in a state? c) How many entries does the lookup table of the vacuum

cleaning agent contain after 3 time steps? • if we store only the percepts that were perceived? • if we store all possible percepts in each state?

d) How many entries will the lookup table contain if we store all possible percepts, i.e. all possible percept sequences for the whole life time of the agent? • give the general formula

Artificial Intelligence 2016 - Rational Agents 34

© HSLU - JK

Exercise 1.3 PEAS Specifications of Task environments

a) Specify PEAS for the following domains – A group of people playing poker – A person driving a car – A student using a vocabulary trainer – A doctor performing a medical diagnosis

b) Classify each of the domains above along the properties that we discussed: – Accessible vs. inaccessible – Deterministic vs. stochastic – Episodic vs. sequential – Static vs. dynamic – Discrete vs. continuous – Single agent vs. multi-agent – Known vs. Unknown

Artificial Intelligence 2016 - Rational Agents 35

TESTAT Abgabe bis 25.9. 24:00