bdi · 3 10/15/2009 bdi agents 5 mccarthy argued that there are occasions when the intentional...
TRANSCRIPT
1
10/15/2009 bdi agents 1
BDI AGENTS� SCOPO DEGLI AGENTI “ BELIEFS,
DESIRES AND INTENTIONS”
� DEFINIZIONE DI “INTENZIONE”
� SPECIFICHE DI AGENTI BDI
� ARCHITETTURE PER AGENTI BDI
10/15/2009 bdi agents 2
Agenti come Sistema Intenzionale� When explaining human activity, it is often useful to make statements such as
the following:Janine took her umbrella because she believed it was going to rain.Michael worked hard because he wanted to possess a PhD.
� These statements make use of a folk psychology, by which human behavior is predicted and explained through the attribution of attitudes, such as believing and wanting (as in the above examples), hoping, fearing, and so on
� The attitudes employed in such folk psychological descriptions are called the intentional notions
2
10/15/2009 bdi agents 3
Intentional System� The philosopher Daniel Dennett coined the term
intentional system to describe entities ‘whose behavior can be predicted by the method of attributing belief, desires and rational acumen’
� Dennett identifies different ‘grades’ of intentional system:‘A first-order intentional system has beliefs and desires (etc.) but no beliefs and desires about beliefs and desires. …A second-order intentional system is more sophisticated; it has beliefs and desires (and no doubt other intentional states) about beliefs and desires (and other intentional states) — both those of others and its own’
10/15/2009 bdi agents 4
� Is it legitimate or useful to attribute beliefs, desires, and so on, to computer systems?
3
10/15/2009 bdi agents 5
� McCarthy argued that there are occasions when the intentional stance is appropriate:
‘To ascribe beliefs, free will, intentions, consciousness, abilities, or wants to a machine is legitimate when such an ascription expresses the same information about the machine that it expresses about a person. It is usefulwhen the ascription helps us understand the structure of the machine, its past or future behavior, or how to repair or improve it. It is perhaps never logically required even for humans, but expressing reasonably briefly what is actually known about the state of the machine in a particular situation may require mental qualities or qualities isomorphic to them. Theories of belief, knowledge and wanting can be constructed for machines in a simpler setting than for humans, and later applied to humans. Ascription of mental qualities is most straightforward for machines of known structure such as thermostats and computer operating systems, but is most useful when applied to entities whose structure is incompletely known’.
10/15/2009 bdi agents 6
� What objects can be described by the intentional stance?� As it turns out, more or less anything can. . . consider a light switch:
� But most adults would find such a description absurd!Why is this?
‘It is perfectly coherent to treat a light switch as a (very cooperative) agent with the capability of transmitting current at will, who invariably transmits current when it believes that we want it transmitted and not otherwise; flicking the switch is simply our way of communicating our desires’. (Yoav Shoham)
4
10/15/2009 bdi agents 7
� The answer seems to be that while the intentional stance description is consistent,
. . . it does not buy us anything, since we essentially understand the mechanism sufficiently to have a simpler, mechanistic description of its behavior. (YoavShoham)
� Put crudely, the more we know about a system, the less we need to rely on animistic, intentional explanations of its behavior
� But with very complex systems, a mechanistic, explanation of its behavior may not be practicable
� As computer systems become ever more complex, we need more powerful abstractions and metaphors to explain their operation — low level explanations become impractical. The intentional stance is such an abstraction
10/15/2009 bdi agents 8
� The intentional notions are thus abstraction tools, which provide us with a convenient and familiar way of describing, explaining, and predicting the behavior of complex systems
� Remember: most important developments in computing are based on new abstractions:– procedural abstraction– abstract data types– objectsAgents, and agents as intentional systems, represent a further, and increasingly powerful abstraction
� So agent theorists start from the (strong) view of agents as intentional systems: one whose simplest consistent description requires the intentional stance
5
10/15/2009 bdi agents 9
� This intentional stance is an abstraction tool — a convenient way of talking about complex systems, which allows us to predict and explain their behavior without having to understand how the mechanism actually works
� Now, much of computer science is concerned with looking for abstraction mechanisms (witness procedural abstraction, ADTs, objects,…)
So why not use the intentional stance as an abstraction tool in computing — to explain, understand, and, crucially, program computer systems?
� This is an important argument in favor of agents
10/15/2009 bdi agents 10
SCOPO DEGLI AGENTI “ BELIEFS, DESIRES AND INTENTIONS”
Esigenza che si vuole risolvere:
“Costruire sistemi che sono situati in ambienti dinamici e chedevono ragionare e pianificare, e agire con forti vincoli di tempo. Il sistema deve essere contemporaneamente goal directed e reattivo”[Rao & Georgeff 1992]
6
10/15/2009 bdi agents 11
SITUATI: non solo sono collocati in un ambiente in cui agiscono, ma, soprattutto, possiedono una rappresentazione simbolica di esso
PIANIFICARE: costruiscono e/o scelgono delle sequenze di azioniche permettono di rendere vero un certo stato del mondo
VINCOLI TEMPORALI: tali sistemi non dispongono di risorseinfinite: “resource boundedness”
GOAL DIRECTED: devono cercare di ottenere un certo scopo
REACTIVITY: devono reagire di fronte a cambiamentidell’ambiente
10/15/2009 bdi agents 12
NASA: Deep Space 1 remote agent experiment
http://rax.arc.nasa.gov/
7
10/15/2009 bdi agents 13
Robocup
http://www.robocup.org/
10/15/2009 bdi agents 14
ESEMPI DI DOMINI DI APPLICAZIONE
Automatizzazione delle procedure usate dagli astronauti sulloSpace Shuttle per gestire i malfunzionamenti dei propulsion flight controllers.PRS [Georgeff & Ingrand,1988]
Automatizzazione dei controllori di volo che coordinano l’arrivodegli aerei in aeroporto[Rao & Georgeff, 1992]
Simulatori
8
10/15/2009 bdi agents 15
HUMAN AGENTHOOD
Il modello che i bdi agents vogliono imitare e’ il comportamentoumano. In particolare il fatto che gli esseri umani siano guidati da tre“attitudini”:
Ambiguo fra il significato di scopoe desiderio.
BELIEFS, DESIRES AND INTENTIONSCREDENZE, GOAL E INTENZIONI
���������� ��
��� ����
BELIEFS DESIRES SELECTION FUNCTION
INTENTION
9
���������� ��
�
� BDI = Belief, Desires, Intentions� BDI - a theory of practical reasoning (Bratman, 1988) per
“resource-bounded agent”� Beliefs = informazioni che l’agente ha del mondo� Desires = desideri e goal� Intentions = desideri o azioni che l’agente ha preso l’impegno di
soddisfare
Il modello che i bdi agents vogliono imitare e’ il comportamento umano. In particolare il fatto che gli esseri umani siano guidati da queste tre
“attitudini”.
���������� ��
������������������ ������
BDI = Belief Desires Intentions
Basata su Practical Reasoning
Il processo di decidere, momento per momento, quale azione compiere mentre si persegono i propri goals
Practical Reasoning
decidere QUALI goalssi vogliono ottenere
DELIBERATION
decidere COME ottenere i goals
MEANS-END REASONING
10
���������� ��
������������������ ������
BDI = Belief Desires Intentions
COSA FARE DELLA PROPRIA VITA DOPO L’UNIVERSITA’
Prendere il dottorato Andare a lavorare in azienda
Quale scegliere?
UNA VOLTA FATTA UNA SCELTA, OCCORRE PERSEGUIRLA
INTENZIONE
PIANO
���������� ��
������������������ ������
BDI = Belief Desires Intentions
INTENZIONI
drive means-end reasoning : se decido di fare qualcosa, devo capire come e trovare tutte le azioni possibili che mi conduconoallo scopo
constrain future deliberations: se decido di fare qualcosa, non accetterò opzioni inconsistenti con ciò che voglio fare
persist: se decido di fare qualcosa e non ho delle buone motivazioni, persisterò nel fare quella cosa
Influence beliefs: se decido di fare qualcosa, crederò di ottenerlo e ciò influenzerà le decisioni future
11
���������� ��
������������������ ������
BDI = Belief Desires Intentions
INTENZIONE
VINCOLA IL FUTURO
PERSISTE
Se adotto una intenzione, persevererò nel realizzarla
(finchè saprò di poterlo fare…)
���������� ��
������������������ ������
BDI = Belief Desires Intentions
INTENZIONE
E’ STRETTAMENTE RELAZIONATA CON LE CREDENZE(Beliefs)
INFLUENZA LE CREDENZE
Se intendo fare qualcosa, crederò che io farò quel qualcosa
12
���������� ��
������������������ ������
OBIETTIVO
TROVARE UN BUON BILANCIAMENTO TRA QUESTI CONCETTI
UN AGENTE DOVRA’ NON SOLO ADOTTARE DELLE INTENZIONI E PERSEGUIRLE, MA ANCHE VERIFICARE CHE POSSANO ANCORA ESSERE
OTTENUTE. QUELLE NON PIU’ OTTENIBILI, VANNO ELIMINATE
Ma controllare la validità delle intenzioni ha un suo costo in termini di risorse computazionali: quale scelta fare?
Continuare a tentare di realizzare intenzioni non più ottenibili non controllando la loro validità
Riconsiderare continuamente la validità delle intenzioni perdendo il tempo necessario per ottenerle
���������� ��
��� ����� Beliefs:
� Rappresentano le caratteristiche dell’ambiente� Vengono aggiornati adeguatamente dopo ogni azione
di sensing� Possono essere visti come la componente
informativa del sistema.� Desires
� Contengono informazioni sugli obiettivi che devonoessere raggiunti, troviamo inoltre le priorita’ e i costiche che questi obiettivi possono avere
� Rappresentano lo stato motivazionale del sistema.
13
���������� ��
��� ����
� Intenzioni� Rappresentano la sequenza di azioni scelta� Catturano la componente deliberativa del sistema
La selection function dovrebbe dare al sistema la capacita’ di raggiungere i propri obiettivi date:
� le risorse computazionali disponibili� le caratteristiche dell’ambiente in cui il sistema e’ situato. � le preferenze dell’agente, funzioni di utilita’, ecc.
���������� ��
������ ������ !"��� ��"#��"��������� ��"� ���
� $ �� %&'
� Perche’ non attendere domani sera prima di formarmi (ora) l’intenzione di andare al cinema?
� Perche’ sprecare risorse per formarmi delle intenzioni ora, se non so cosa accadra’ domani (ad es. Mi potrebbero invitare a cena)?
Soluzione alternativa:utilizzare un pianificatore classico e poi scegliere fra le opzioni che propone
14
���������� ��
()"���� �*�(�"����")�+�"� ��� &
� Scelgo un obbiettivo� Costruisco un piano completo che lo soddisfi� Scelgo fra le alternative tramite “decision theory” (probabilita’ eventi +
utility function)Limiti:� devo conoscere lo stato del mondo� piu’ tempo passo a pianificare e decidere, maggiore e’ la probabilita’
che il mondo cambi� ad ogni cambiamento del mondo devo ricominciare da capo
���������� ��
,-�./
17
���������� ��
+0-.-�1..1�23124-2
Questi problemi sono dovuti alla “resource boundedness”: il ruolo delle intenzioni e’ di limitare lo spazio di ricerca del planning e quello della scelta fra le opzioni.Per questo motivo le intenzioni:� sono future directed e (relativamente) stabili:
se stabilisco ora una linea di azione per il futuro, le sceltesuccessive dovranno essere compatibili con questa: limito le opzioni possibili.Se ho l’intenzione di andare domattina a prendere un libro in biblioteca, non prendero’ in considerazione l’azione di andare a giocare a tennis
���������� ��
� Riguardano piani parziali: � non conoscendo in anticipo come puo’ evolvere il mondo, costruisco
dei piani che sono incompleti temporalmente (non stabiliscol’ordinamento completo delle azioni) o strutturalmente (non scelgocome eseguire delle azioni complesse).
� Esempio:
Posso avere l’intenzione di andare a prendere un libro in biblioteca, senza aver necessariamente costruito un piano in tuttii suoi dettagli (posso non aver ancora scelto se andare in macchina o prendere il tram, perche’ non so se ci sara’sciopero).
� Costituiscono l’input per ulteriori fasi di pianificazione
18
���������� ��
(�+3�.�(.�2/5
����"�����")� � "��6"�� �� 7�"��� ��
Get-book
Buy-book Borrow-book
Go(library) Read(location) Fill(sheet,location)
Walk(library) Drive(library)
Piano completo:Walk(library);Read(location);Fill(sheet,location)...
���������� ��
23124-2�1�8+11241
� Intendo solo cio’ che credo possibile (i.e. esiste un piano che ritengoeseguibile)
� credo che eseguiro’ quello che intendo: se intendo andare al cinema domani, credo che domani saro’ al cinema e non a casa (“conduct coordinating pro-attitude”)
� la stabilita’ delle intenzioni implica che, se fallisce il mio piano, necerchero’ un altro per raggiungere il mio scopo
� controllo se l’esecuzione di un piano ha avuto successo� non intendo quelle che credo essere le conseguenze indesiderate delle
mie azioni (problema dei “side effects”)
19
���������� ��
�+8931330+���/3+�33�
Intentions structured into
plans
Filtering process
means-end reasoning
Deliberation process
Desires
Opportunity analyser
Beliefs
Reasoner
Plan library
perc
eptio
n
action
intentions
option
���������� ��
��)��7�:�!������:���������� ��5���$"����"
� Beliefs, Desires e Intentions sono considerati come lo “stato mentale” di un agente
� Per modellizzare questi stati mentali viene usata la logicamodale:� Beliefs: operatore modale Bel (o B)� Desires: operatore modale Des (o D)� Intentions: operatore modale Int (o I)
20
���������� ��
�;�(�"����")�+�"� ��� �� ����
� Cosa è il practical reasoning ?
� “reasoning directed towards actions”� differenze fra practical reasoning e theoretical
reasoning:� theoretical reasoning è diretto verso i beliefs� practical reasoning verso le azioni
���������� ��
/(18<891���,123��
[Cohen & Levesque, 1990] propongono una formalizzazionedella relazione fra credenze, goal e intenzioni per mezzo di una logica modale.Danno una specifica di cosa e’ un agente BDI, non un formalismo per costruire sistemi.Dichiarativita’: non solo definizione operazionale (i.e. architettura di agente) perche’ e’ necessario poter parlaredelle intenzioni di un agente.
21
���������� ��
��.-,8
Belief goal compatibility: (Des α ) � (Bel α)States that if the agent has a goal to optionally achieve
something, this thing must be an option. An option should not be produced if it is not believed possible.
Goal-intention compatibility: (Int α ) � (Des α)States that having an intention to optionally achieve something
implies having it as a goal (i.e., there are no intentions that are not goals).
���������� ��
��.-,8
Volitional commitment: (Int does(a)) � does(a) If you intend to perform some action a next, then you do a next.
Awareness of goals & intentions :(Des α ) � (����Des α))(Int α ) � (����Int α))
No unconscious actions: done(a) � Bel(done(a))If an agent does some action, then it is aware that it has done the action.
No infinite deferral:(Int α ) � A�(¬(Int α))An agent will eventually either act for an intention, or else drop it.
22
���������� ��
/#"��" ��!��=���� �"��� ���
� Indecidibile� Anche nei casi decidibili, dimostrazioni
molto pesanti dal punto di vista computazionale
� I sistemi reali “approssimano” la semantica modale invece che implementarla
���������� ��
(�"����")�+�"� ��� �� ����
1. deliberation� Identificazione e Selezione di goal e
intenzioni
2. means-ends reasoning� pianificazione, valutazione di piani,
selezione di piani
practical reasoning = deliberation + means-ends reasoning
23
���������� ��
(�"����")�+�"� ��� �� �����>� ��;?
practical reasoning = deliberation + means-ends reasoning
� deliberation
� decidere cosa si vuole raggiungere
l’output di questa fase sono le intenzioni
� means-ends reasoning
� decidere come si vogliono raggiungere questi obiettivi
l’output di questa fase sono i piani
���������� ��
(�"����")�+�"� ��� �� ����5������� ��
� Ci si aspetta che gli agenti determinino la maniera di soddisfare le proprieintenzioni
� Se ho intenzione di fare �, uno si aspettache io dedichi tutte la mie risorse per decidere come portare avanti l’esecuzionedi �
24
���������� ��
(�"����")�+�"� ��� �� ����5������� ��
� Gli agenti non possono adottare intenzioni in conflitto
� Se ho intenzione di fare � , non ci si aspetta cheio adotti l’intenzione di fare � incompatibile con �
� Gli agenti sono inclini a riprovare se il lorotentativo di portare avanti una intenzione fallisce
� Se il primo tentativo di soddisfare � fallisce, alloral’agente provera’ un piano alternativo per soddisfare �
���������� ��
(�"����")�+�"� ��� �� ����5������� ��
� Gli agenti credono che le loro intenzioni sonoare possibili
� Cioe’, credono che ci sia almeno un modo per portarle avanti.
� Gli agenti non credono che non riusciranno a portare a termine le loro intenzioni
� Non sarebbe razionale adottare una intenzione� se credo che falliro’ nel portare a termine �
25
���������� ��
(�"����")�+�"� ��� �� ����5������� ��
� Sotto certe circostanze, gli agenti credono chesaranno in grado di portare a termine le proprieintenzioni
� Gli agenti non intendono tutti i side effectsdelle loro intenzioni
� Credo che andare dal dentista possa provocaredolore, e ho intenzione di andare dal dentista –ma questo non significa che intendo soffrire!
���������� ��
planner
intention(goal / task)
beliefs(state of
environment)
possibleactions
plan toachieve goal
means-endsreasoning
(�"����")�+�"� ��� �� ����5
�;�@�"��A��!��+�"� ���
26
���������� ��
3. BDI ArchitectureBelief revision
Deliberation process
percepts
DesiresOpportunityanalyzer
Intentions
Filter
Means-endreasoner
Plans
Intentions structuredin partial plans
Executor
B = brf(B, p)
D = options(B, D, I)
I = filter(B, D, I)
π = plan(B, I)
Library of plans
actions
BeliefsKnowledge
���������� ��
(�"����")�+�"� ��� �� �����>� ��;?
� agent control loop
while true
observe the world;
update internal world model;
deliberate about what intention to achieve next;
use means-ends reasoning to get a plan for the intention;
execute the plan
end while
- when to reconsider intentions !?
- what are the options (desires) ?- how to choose an option ?- incl. filter- chosen option � intention …
27
���������� ��
������������������ ������
COME POSSIAMO FORMALIZZARE UN AGENTE BDI?
a set of current beliefs: rappresenta l’informazione che l’agente ha sul suo ambiente corrente
a belief revision function(brf): prende una percezione e le credenze correnti dell’agente e, sulla base di queste, determina un nuovo insieme di credenze
an option generation function: determina le opzioni disponibili (desideri) sulla base delle intenzioni e credenze correnti
a set of current options: rappresenta le possibili serie di azioni che l’agente può compiere
a filter function(filter): rappresenta il processo deliberativo dell’agente che determina le intenzioni sulla base dei desideri, delle credenze e delle intenzioni correnti l’informazione che l’agente ha sul suo ambiente corrente
a set of current intentions: rappresenta ciò che l’agente ha deciso di ottenere
an action selection function(execute): determina l’azione da compiere sulla base delle correnti intenzioni
���������� ��
������������������ ������Bel insieme di tutte le credenzeDes insieme di tutti i desideriInt insieme di tutte le intenzioni
Stato dell’agente (B,D,I) dove B ⊆⊆⊆⊆ Bel, D ⊆⊆⊆⊆ Des e I ⊆⊆⊆⊆ Int
La belief revision function brf è: ℘℘℘℘(Bel) x P ℘℘℘℘(Bel)
La option generator function è: ℘℘℘℘(Bel) x ℘℘℘℘(Int) ℘℘℘℘(Des)
Una volta che l’agente ha deciso di fare x, deve provvede ‘praticamente’ ad assolvere il compito.
La funzione options deve controllare:
• la consistenza dell’opzione generata con le credenze e le intenzioni correnti• deve riconoscere quando I cambiamenti ambientali possono avvantaggiare la realizzazione di nuove e vecchie/accantonate intenzioni
28
���������� ��
������������������ ������
Il BDI deliberation process (filter) è: ℘℘℘℘(Bel) x ℘℘℘℘(Des) x ℘℘℘℘(Int) ℘℘℘℘(Int)
Aggiorna le intenzioni sulla base dei desideri, delle credenze e delle intenzioniUna volta che l’agente ha deciso di fare x, deve provvede ‘praticamente’ ad assolvere ilcompito.
La funzione filter ha due obiettivi :
• elimina le intenzioni che non sono più ottenibili o che non convenga più ottenere;
• mantiene le intenzioni che non sono state ancora ottenute e che ci si aspetta avranno un esito positivo;
• adotta nuove intenzioni o per ottenere intenzioni esistenti o per esplorare nuovepossibilità
���������� ��
������������������ ������
La funzione execute è: ℘℘℘℘(Int) A
La funzione action è: P A
function action (p : P) : Abegin
B:= brf(B,p)D:= options(D,I)I:= filter(B,D,I)
return execute(I)end function action
Alle intenzioni può essere associata una priorità o possono essere posizionate in uno stack
Il problema? Come implementare efficientemente queste funzioni.
29
���������� ��
$�)�$���"6� ��
���������� ��
� this version: optimal behaviour if
� deliberation and means-ends reasoning take a vanishingly small amount of time;or
� the world is guaranteed to remain static while the agent is deliberating and performing means-ends reasoning;or
� an intention that is optimal when achieved at time t0 (the time at which the world is observed) is guaranteed to remain optimal until time t2 (the time at which the agent has found a course of action to achieve the intention).
30
���������� ��
�)����"�� �� The deliberate function can be decomposed into two distinct
functional components:� option generation
in which the agent generates a set of possible alternatives;Represent option generation via a function, options, which takes the agent’s current beliefs and current intentions, and from them determines a set of options (= desires)
� filteringin which the agent chooses between competing alternatives, and commits to achieving them.In order to select between competing options, an agent uses a filterfunction.
���������� ��
�)����"�� �
31
���������� ��
(�"����")�+�"� ��� �� �����>� ��;?
� If an option has successfully passed trough the filter function and is chosen by the agent as an intention, we say that
the agent has made a commitment to that option
� Commitments implies temporal persistence of intentions; once an intention is adopted, it should not be immediately dropped out.
���������� ��
(�"����")�+�"� ��� �� �����>� ��;?Question: How committed an agent should be to its intentions?
� degrees of commitments� blind commitment
� � fanatical commitment: continue until achieved
� single-minded commitment� continue until achieved or no longer possible
� open-minded commitment� continue until no longer believed possible
32
���������� ��
8 $$��$����/��"�� ���� An agent has commitment both
� to ends (i.e., the wishes to bring about)� and means (i.e., the mechanism via which the agent wishes to achieve the
state of affairs)
� current version of agent control loop is overcommitted, both to means and ends
� modification: replan if ever a plan goes wrong
���������� ��
Reactivity, replan
33
���������� ��
8 $$��$����/��"�� ���� this version still overcommitted to intentions:
� never stops to consider whether or not its intentions are appropriate
� modification: stop for determining whetherintentions have succeeded or whetherthey are impossible:
“Single-minded commitment”
���������� ��
/�� )�A$��!�!�8 $$��$���
Dropping intentions that are impossibleor have succeeded
Reactivity, replan
34
���������� ��
������ ��+�� ���!��"�� �� Our agent gets to reconsider its intentions when:
� it has completely executed a plan to achieve its current intentions; or� it believes it has achieved its current intentions; or� it believes its current intentions are no longer possible.
� This is limited in the way that it permits an agent to reconsider its intentions
� modification:Reconsider intentions after executing every action
“Open-minded commitment”
���������� ��
-���A$��!�!�8 $$��$���
35
���������� ��
������ ��+�� ���!��"�� �� But intention reconsideration is costly!
A dilemma:� an agent that does not stop to reconsider its intentions sufficiently often will
continue attempting to achieve its intentions even after it is clear that they cannot be achieved, or that there is no longer any reason for achieving them
� an agent that constantly reconsiders its attentions may spend insufficient time actually working to achieve them, and hence runs the risk of never actually achieving them
� Solution: incorporate an explicit meta-level control component, that decides whether or not to reconsider
���������� ��
meta-level control
36
���������� ��
-���$")������� ��+�� ���!��"�� �
� Kinny and Georgeff’s experimentally investigated effectiveness of intention reconsideration strategies
� Two different types of reconsideration strategy were used:� bold agents
never pause to reconsider intentions, and� cautious agents
stop to reconsider after every action� Dynamism in the environment is represented by the rate of world change,
γ
���������� ��
������������������ ������
IL SOLITO DILEMMA: BILANCIARE IL COMPORTAMENTO PRO-ATTIVOE REATTIVO
Michael Georgeff ha sperimentato nel proprio framework BDI dMARSl’introduzione di un fattore γγγγ chiamato rate of world change:
• γγγγ è BASSO: l’ambiente cambia poco. Vivono meglio gli agenti che riconsiderano di meno le intenzioni (BOLD). Gli agenti che riconsiderano spesso le intenzioni, non hanno un comportamento desiderabile(CAUTIOUS).
• γγγγ è ALTO: l’ambiente cambia abbastanza velocemente. Quale tipo di agente si comporteerà meglio?
N.B. Differenti tipi di ambienti richiedono differenti tipi di agenti
37
���������� ��
-���$")������� ��+�� ���!��"�� �
� Results (not surprising):� If γ is low (i.e., the environment does not change
quickly),bold agents do well compared to cautious ones.� cautious ones waste time reconsidering their commitments
while bold agents are busy working towards — and achieving — their intentions.
� If γ is high (i.e., the environment changes frequently),cautious agents tend to outperform bold agents.� they are able to recognize when intentions are doomed, and
also to take advantage of serendipitous situations and new opportunities when they arise.
���������� ��
� “BDI-architecture” (beliefs / desires / intentions)� explicit data structures for b/d/i
� planning� no “on-the-fly” planning � plan libraries
� a plan: goal (post-condition)context (pre-condition)body (sequence of action / subgoals)
� intention stack
(�"����")�+�"� ��� �� ����5
(� ��!��")�+�"� ��� �/����$�>(+/?
beliefs plans
desires intentions
agent
interpreter
sensor input
action
38
���������� ��
(+/
� PRS consists of:� a database containing current beliefs or facts
about the world; � a set of current goals to be realized; � a library of plans describing how certain
sequences of actions and tests may be performed to achieve given goals or to react to particular situations;
� an intention structure containing those plans that have been chosen for execution.
� a Knowledge Area
���������� ��
(+/
� The Knowledge Area KA) is a knowledge base containing procedural knowledge about how to accomplish given goals or react to certain situations. Each KA consists of a body, which describes the steps of the procedure, and an invocation condition which specifies under what situations the KA is useful.
� The invocation condition contains a triggering partdescribing the events that must occur in order to execute a KA (the acquisition of some new goal, some change in system beliefs,...).
39
���������� ��
(+/�"�!�B�
� The interpreter manages these components, selecting appropriate plans based on the beliefs and goals of the system, putting those that have been chosen in the intentional structure and executing them.
� The agent reacts to events, which are either generated by modifications to its beliefs or by stimula coming from the environment by adding new goals.
� An event can trigger one or more plans. A plan that an agent decides to make on the base of a set of default policies becomes an intention.
� At any given moment, the intention structure may contain a certain number of intentions but not all will be satisfied.
���������� ��
(+/�"�!�B�
� Some will be suspended or deferred, some will wait for certain condition to hold prior to activation, some will be meta-level intentions for deciding which action must be made among several alternatives.
� PRS contains an efficient mechanism to respond timely to changesof the environment.
� Since the interpreter continuously attempts to mach KAs with any newly acquired belief or goals, the system is able to notice newly applicable KAs after every primitive action is takes.
40
���������� ��
B� %)�! �����"��C�()"��
type: drink-cola
invocation: goal-add(¬thirst)precondition:have-glass
add-list: {¬ thirst}body:
start
have-cola
drink
1
end
proposition action
type: drink-waterinvocation: goal-add(¬thirst)precondition:have-glass add-list: {¬ thirst}body:
start
open-tap
drink
1
end
���������� ��
��231+(+131+>?
Initialize state();do
options := option-generator(event-queue, B,G,I);selected-option := deliberate(options,B,G,I);I := update-intentions(selected-option,I);execute(I);event-queue := event-queue + get-new-external-events();drop-successful-attitudes(B,G,I);drop-impossible-attitudes(B,G,I);
until quit.
eventi internied esterni
anche esito azioni
bound on reaction timeatomic
actions
beliefs espliciti
41
���������� ��
-��� �A ����"� �>�#���A=����:�:,:?
options := {};for trigger-event ∈ event-queue do
for plan ∈ plan-library doif matches(invocation-cond(plans),trigger-event) then
options := options + plan;return(options).
���������� ��
�)����"��> ��� ��:�:,:?
if length(options) < 2 then return(options)else metalevel-options := (belief-add(option-set(options)));
selected-option := deliberate(metalevel-options);if null(selected-option) then return(random-choice(options));else return(selected-option).
42
���������� ��
@��"B� %)�! �����"��
type: meta-selectorinvocation: lenght(options)>1 add-list: {goal-add(?x)}body:
start
Bel(cheap(?x))
end
1
Bel(∀?x ¬cheap(?x))
?x := random-
choice(options)
type: prove Binvocation: goal-add(Bel(B))precondition: Bel(A)add-list: {Bel(B)}body:
end
end
2
goal-add(?x)
���������� ��
������ �����������
Beliefs Goals Intentions
cheap(drink-water) ∧ thirst ∧have-glass ¬thirstoption-set(drink-cola,drink-water)
meta-selectorBel(cheap(?x))
?x=drink-water drink-wateropen-tapdrink
¬thirst