Top Banner
Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on slides by Sebastian Sardina, RMIT University, Melbourne)
42

Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Dec 29, 2015

Download

Documents

Gyles Boyd
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Agent Architectures

Michal Jakob

Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University

A4M33MAS Autumn 2010 - Lect. 2(based on slides by Sebastian Sardina, RMIT University, Melbourne)

Page 2: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

An Example: Airport Assistant Robot

2

navigation, maintaing energy, communication, query solving, . . .

Page 3: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

An Example: Gold Mining Game

• Two teams competing to collect and drop gold in the depot– dynamic– complex– unknown information– failing actions– failing sensors– multi-agent

3

Page 4: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Constraints

We want to program intelligent systems under the following constraints:1.The agent interacts with an external environment

– A grid world with gold pieces, obstacles, and other agents.2.The environment is (highly) dynamic; may change in unexpected ways

– gold pieces appear randomly;3.Things can go wrong; plans and strategies may fail

– a path may end up being blocked.4.Agents have dynamic and multiple objectives.

1. explore, collect, be safe, communicate, etc.;2. motivations/goals/desires may come and go;3. plans can be interrupted.

4

Page 5: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Assumptions

Luckily we can also assume:1.Failure is generally not catastrophic

– I If gold is dropped, we just pick it up again.– If a tree blocks the path, we just go around it.

2.We can understand the system at the “intentional” level– Agents “desire” to collect as much gold as possible.– Agents “believe” they are close to the depot.

3.There is “some” sensible known procedural knowledge of the domain

1. It is “good” to avoid obstacles.2. If we see gold close, then go and collect it.3. If we bump into an unknown wall, then walk along it.

5

Page 6: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Intelligent Agent

• beliefs: a database of agent’s information about itself, the world (environment), other agents, etc. NOW

• goals: description of states the agent “wants” to bring about FUTURE

• How to select actions leading from NOW to the FUTURE?

6

Page 7: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Goal-based Agents

• Hierarchy of agents– simple reflex agents– reflex agents with state– goal-based agents– utility-based agents

7

Page 8: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Reactivity vs Proactivity

8

Reactive(mental state 0)

Deliberative(perceptions 0)

+ responsive, robust w.r.t. unexpected = graceful degradation- no/little past, difficult to implement proactiveness- can get stuck in local optima

+ context (future) = proactiveness, planning+ can achieve goals requiring a sequence of multiple actions- weak responsiveness to the environment

Reactive planning/BDI

How to marry proactivity and reactivity in a single computational model?

How to marry proactivity and reactivity in a single computational model?

Page 9: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Practical Reasoning

9

Page 10: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Practical Reasoning

• Practical reasoning is reasoning directed towards actions — the process of figuring out what to do:– “Practical reasoning is a matter of weighing conflicting considerations

for and against competing options, where the relevant considerations are provided by what the agent desires/values/cares about and what the agent believes.” (Bratman)

– Decides how the world should be and what individuals should do– Process by which you change your choices, plans, and intentions.– Example: you go to class, if you must go to class.

• Theoretical reasoning is reasoning directed towards beliefs — concerned with deciding what to believe– Tries to assess the way things are.– Process by which you change your beliefs and expectations;.– Example: you believe q if you believe p and you believe that if p then

q.

Page 11: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Components of Practical Reasoning

Human practical reasoning consists of two activities:1.Deliberation: deciding what state of affairs we want to achieve

– considering preferences, choosing goals, etc.– balancing alternatives (decision-theory);– the outputs of deliberation are intentions.

2.Means-ends reasoning: deciding how to achieve these states of affairs

– thinking about suitable actions, resources and how to “organize” activity;

– building courses of action (planning);– the outputs of means-ends reasoning are plans.

•Fact: agents are resource-bounded & world is dynamic!•The key: To combine deliberation & means-ends reasoning appropriately.

11

Page 12: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Deliberation

How does an agent deliberate?1.Begin by trying to understand what the options available to you are:

– options available are desires

2.Choose between them, and commit to some:– chosen options are then intentions.

12

Page 13: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Desires

• Desires describe the states of affairs that are considered for achievement, i.e., basic preferences of the agent.

• Desires are much weaker than intentions; not directly related to activity:– “My desire to play basketball this afternoon is merely a potential

influence of my conduct this afternoon. It must vie with my other relevant desires [...] before it is settled what I will do. In contrast, once I intend to play basketball this afternoon, the matter is settled: I normally need not continue to weigh the pros and cons. When the afternoon arrives, I will normally just proceed to execute my intentions.” (Bratman 1990)

13

Page 14: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Functional Components of Deliberation

• Option Generation: the agent generates a set of possible alternatives; via a function, options, which takes the agent’s current beliefs and intentions, and from them determines a set of options/desires.

• Filtering: the agent chooses between competing alternatives, and commits to achieving them. In order to select between competing options, an agent uses a filter function

14

Page 15: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Intentions

• In ordinary speech: intentions refer to actions or to states of mind;– here we consider the latter!– E.g., I may adopt/have the intention to be an academic.

• Focus on future-directed intentions i.e. pro-attitudes leading to actions.– Intentions are about the (desired) future.

• We make reasonable attempts to fulfill intentions once we form them, but they may change if circumstances do.– Behavior arises to fulfill intentions.– Intentions affect action choice

15

Page 16: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Main Properties of Intentions

1. Intentions drive means-end reasoning– If I adopt the intention to become an academic, they I will decide how

to achieve it, for example, by applying to a PhD programme. Moreover, if I fail to gain a PhD place at one university, I might try another university.

2. Intentions constrain future deliberation (i.e., provide a “filter”)1. If I intend to be an academic, I would not consider being rich.

3. Intentions persist– If I intend to become an academic, I will not give up without a good

reason—e.g., if I already obtained an academic position or realized that it will be impossible to be an academic.

4. Intentions influence beliefs concerning future practical reasoning1. If I adopt the intention to be an academic, then I can plan for the

future on the assumption that I will be an academic.

16

Page 17: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Main Properties of Intentions (cont.)

5. Agents believe their intentions are possible– If I intend to be an academic, there must be some conceivable

way for me to become an academic (e.g., getting a PhD and applying for a university position).

6. Agents do not believe they will not bring about their intentions– It would not be rational of me to adopt an intention to become

an academic if I believed I would fail becoming one.

7. Under certain circumstances, agents believe they will bring about their intentions– If I intend to be an academic, then I believe that under “normal

circumstances” I will indeed become an academic.

17

Page 18: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Main Properties of Intentions (cont.)

8. Agents need not intend all the expected side effects of their intentions– If I believe a => b and I intend that a I do not necessarily intend

b also• So, intentions are not closed under implication!• This last problem is known as the side effect or package deal

problem:– I may believe that going to the dentist involves pain, and I may

also intend to go to the dentist — but this does not imply that I intend to suffer pain!

18

Page 19: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Plans

• Human practical reasoning consists of two activities:1. Deliberation: deciding what to do. Forms intentions.2. Means-ends reasoning: deciding how to do it. Forms plans.

Forms plans.• Intentions drive means-ends reasoning: If I adopt an intention,

I will attempt to achieve it, this affects action choice.

19

Page 20: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Means-End Reasoning: Obtaining Plans and (Next) Actions

• How does the agent obtain plans/actions to realize its intentions?

20

Page 21: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Planning in Dynamic Environments

• plan - execute - monitor cycle1. plan from the current state to a goal state(s)2. sequentially execute actions from the plan3. monitor success of action execution

• in the case of action failure, (re-)plan again (goto 1)

• speed of planning vs. environment dynamics1. planning speed > environment rate of change can perform

relatively well2. planning speed < environment rate of change leads to fatal

inefficiencies; the system “suffocates” in (re-)planning

21

Page 22: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Solution Idea: Reactive Planning

• Instead of plan-execute-monitor cycle, select partial plans reactively on the ground of the current state of the world– partial plans encoded in the design time

• Reactive planning agent:

• current beliefs + future goals choose from a plan library

22

Page 23: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Commitments

• After filter function, agent makes a commitment to chosen option:– Commitment: an agreement or pledge to do something in the future;– it implies temporal persistence.

• Commitment strategies:– Blind/Fanatical commitment: A blindly committed agent will continue

to maintain an intention until it believes the intention has actually been achieved.

– Single-minded commitment: A single-minded agent will continue to maintain an intention until it believes that either the intention has been achieved, or else that it is no longer possible to achieve the intention.

– Open-minded commitment: An open-minded agent to remains committed to its intentions until it succeeds or the goal is dropped.

23

Page 24: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Belief-Desire-Intention (BDI) Architecture

25

Page 25: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

BDI Model of Agency

• A model of agency with roots in practical reasoning and intentional systems– a set of concepts for thinking about and building agents

• Behavior arises due to the agent committing to some of its desires, and selecting actions that achieve its intentions given its beliefs.

26

Page 26: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

BDI Concepts

• Structural decomposition:– (B)eliefs: reflect agent’s static beliefs about its environment,

itself, its peers, etc. (now)– (D)esires: descriptions of situations the agent wants to bring

about (future)• System dynamics: from now to the future

– (I)ntentions: courses of action, plans, the agent commits to• partial plans of action that the agent is committed to execute in

order to fulfill the goals

27

Page 27: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Abstract Rational Architecture

• Rao and Georgeff (1992) proposed an abstract interpreter for agents:

• Key to this architecture is the notion of events:– the inputs of the system;– both externals (from the environment) and internal (within the system);– will play a major role in BDI agent programming languages!

28

Page 28: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Technology Development

29

Page 29: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

BDI Agent-oriented Programming

• A new programming model and architecture to simplify the construction of todays large complex systems situated in dynamic environments:– View a system as composed of autonomous interacting entities

(agents) which pursue their own goals and act in a rational manner.– Internal state and decision process of agents is modeled in an intuitive

manner following the notion of mental attitudes.– Goal orientation: instead of directly requesting the agents to perform

certain actions, the developer can define more abstract goals for the agents.

• I provides a certain degree of flexibility on how to achieve the goals.

• Can be seen as a “successor” of object-oriented programming

30

Page 30: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Key Features of BDI Agent-oriented Systems

• Beliefs: information about the world.• Events: goals/desires to resolve; internal or external.• Plan library: recipes for handling goals-events.• Intentions: partially uninstantiated programs with

commitment

31

Page 31: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Goal mining game BDI example

• Beliefs– current location and location of depot.– size of grid, # of gold pieces carrying, etc.

• Events– a gold piece is observed east– the coordinator requests to explore the grid– we formed the internal goal to travel to

loc(10, 22)• Plan library

– if I see gold here & I am not full, collect it– if I hit an obstacle, go around it– if I don’t know of any gold, explore grid

• Intentions– I am currently traveling to the depot– I am informing my team-mates of new obstacles I find

32

Page 32: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Events and Plans

• Events stand for the goals/desires/tasks to be achieved or resolved:– percepts: goldAt(east), goldDropped, etc;– communication: told(player3, loc(3, 2));– external request/goal: achieve(explore grid);– internal sub-goal: go to(loc(10, 22)).

• Plans stand for strategies useful to resolve (pending) events:– encode typical operational procedures in the domain;– non-deterministic;– event- and context- dependent;

33

Page 33: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Intentions

• Agent’s intentions are determined dynamically by the agent at runtime based on its known facts, current goals, and available plans.

• An intention is just a partially executed strategy:– comes from the plan library when resolving events.

• An intention represent a focus of attention:– something the agent is currently working on;– actions/behavior arises as a consequence of executing intentions.

• An agent may have several intentions active at one time.– different simultaneous focuses of attention;

• A new intention is created when an external event is addressed.• An intention may create/post an internal event:

– I the intention will be updated when this event is addressed.

34

Page 34: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

The BDI Execution Cycle [Rao&Georgeff 92]

35

1. Observe the environment for new external events.2. Pick a pending event e.3. Select relevant plans from library (match event).4. Select applicable plans from relevant set (match context).5. If event e is external, create new intention with selected plan.6. If event e is internal, update intention with selected plan on top.7. Partially execute some intention (may post internal events).

• If execution fails, then perform failure recovery.8. Repeat cycle.

1. Observe the environment for new external events.2. Pick a pending event e.3. Select relevant plans from library (match event).4. Select applicable plans from relevant set (match context).5. If event e is external, create new intention with selected plan.6. If event e is internal, update intention with selected plan on top.7. Partially execute some intention (may post internal events).

• If execution fails, then perform failure recovery.8. Repeat cycle.

Page 35: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Key Points of BDI Programming

• Flexible and responsible to the environment: “reactive planning”– Well suited for soft real-time reasoning and control.

• Relies on context-sensitive subgoal expansion: “act as you go.”

• Leave for as late as possible the choice of which plans to commit to as the chosen course of action to achieve (sub)goals.

• Modular and incremental programming.• Non-determinism on choosing plans and bindings.

36

BDI Programming = Implicit Goal-based Programming + Rational Online Executor

BDI Programming = Implicit Goal-based Programming + Rational Online Executor

Page 36: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Possibility of Many Options

37

Page 37: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

BDI: Is it a good idea?

• Benefits:– facilitates quick response to changes in the environment– allows layering of the system

• knowledge representation + reasoning vs. plan selection– plans can be encoded in the design time

• better control on what the system does software enginering

• Shortcommings:– (potentially) too much control of the system (is this still AI?)– no (straightforward) guarantees that the means leads to

reaching the end (unlike planning!)– plan selection is quite greedy the system can get stuck

38

Page 38: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Making Use of the BDI Framework

• Provide alternative plans where possible• Break things down into subgoal steps• Use subgoals and alternative plans rather than if... then in

code• Keep plans small and modular• Plans are abstract modules - don’t chain them together like a

flowchart

39

Page 39: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Plan Structure

40

Page 40: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Structuring Plans and Goals

• Make each plan complete at a particular abstraction level– a high-level but complete plan for Attend Conference

• Use a subgoal - even if only one plan choice for now– decouple a goal from its plans

• Modular and easy to add other plan choices later.– Booking a flight can now be done with the Internet, if available!

• Think in terms of subgoals, not function calls.– What way-points do we need to achieve so as to realize a goal?

• Learn to pass information between subgoals.– How are these way-points inter-related w.r.t. data?

41

Page 41: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Conclusions

42

Page 42: Agent Architectures Michal Jakob Agent Technology Center, Dept. of Cybernetics, FEE Czech Technical University A4M33MAS Autumn 2010 - Lect. 2 (based on.

Conclusions

• Balancing reactivity with proactivity key in programming intelligent agents

• Pragmatic reasoning provides a foundation for reasoning towards action

• BDI architecture utilize pragmatic reasoning as a way to build intelligent agents

• Related reading: – Wooldridge: An Introduction to Multiagent Systems – Chapter 4