BDI AGENTS
Transcript
BDI AGENTS
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 1 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 10/15/2009 bdi agents 2 1 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 3 Is it legitimate or useful to attribute beliefs, desires, and so on, to computer systems? 10/15/2009 bdi agents 4 2 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 useful when 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 5 What objects can be described by the intentional stance? As it turns out, more or less anything can. . . consider a light switch: ‘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) But most adults would find such a description absurd! Why is this? 10/15/2009 bdi agents 6 3 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. (Yoav Shoham) 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 7 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 – objects Agents, 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 10/15/2009 bdi agents 8 4 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 9 SCOPO DEGLI AGENTI “ BELIEFS, DESIRES AND INTENTIONS” Esigenza che si vuole risolvere: “Costruire sistemi che sono situati in ambienti dinamici e che devono ragionare e pianificare, e agire con forti vincoli di tempo. Il sistema deve essere contemporaneamente goal directed e reattivo” [Rao & Georgeff 1992] 10/15/2009 bdi agents 10 5 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 azioni che permettono di rendere vero un certo stato del mondo VINCOLI TEMPORALI: tali sistemi non dispongono di risorse infinite: “resource boundedness” GOAL DIRECTED: devono cercare di ottenere un certo scopo REACTIVITY: devono reagire di fronte a cambiamenti dell’ambiente 10/15/2009 bdi agents 11 NASA: Deep Space 1 remote agent experiment http://rax.arc.nasa.gov/ 10/15/2009 bdi agents 12 6 Robocup http://www.robocup.org/ 10/15/2009 bdi agents 13 ESEMPI DI DOMINI DI APPLICAZIONE Automatizzazione delle procedure usate dagli astronauti sullo Space Shuttle per gestire i malfunzionamenti dei propulsion flight controllers. PRS [Georgeff & Ingrand,1988] Automatizzazione dei controllori di volo che coordinano l’arrivo degli aerei in aeroporto [Rao & Georgeff, 1992] Simulatori 10/15/2009 bdi agents 14 7 HUMAN AGENTHOOD Il modello che i bdi agents vogliono imitare e’ il comportamento umano. In particolare il fatto che gli esseri umani siano guidati da tre “attitudini”: BELIEFS, DESIRES AND INTENTIONS CREDENZE, GOAL E INTENZIONI Ambiguo fra il significato di scopo e desiderio. 10/15/2009 BELIEFS bdi agents DESIRES 15 SELECTION FUNCTION INTENTION 8 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 goals si vogliono ottenere decidere COME ottenere i goals DELIBERATION MEANS-END REASONING 9 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 drive means-end reasoning : se decido di fare qualcosa, devo capire come e trovare tutte le azioni possibili che mi conducono allo scopo constrain future deliberations: se decido di fare qualcosa, non accetterò opzioni inconsistenti con ciò che voglio fare INTENZIONI 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 10 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 11 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 devono essere raggiunti, troviamo inoltre le priorita’ e i costi che che questi obiettivi possono avere Rappresentano lo stato motivazionale del sistema. 12 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. Intenzioni Rappresentano la sequenza di azioni scelta Catturano la componente deliberativa del sistema !" $ "# " " %&' 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 13 () " *(" ")+ " & 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 ,- ./ 14 ,- ./ ,- ./ 15 ,- ./ ,- ./ 16 +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 scelte successive 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 stabilisco l’ordinamento completo delle azioni) o strutturalmente (non scelgo come eseguire delle azioni complesse). Esempio: Posso avere l’intenzione di andare a prendere un libro in biblioteca, senza aver necessariamente costruito un piano in tutti i 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 17 ( +3 .(. 2/5 " ") " 6" 7" Get-book Buy-book Borrow-book Go(library) Walk(library) Read(location) Fill(sheet,location) Drive(library) Piano completo: Walk(library);Read(location);Fill(sheet,location)... 23124 -2 1 8+1 1241 Intendo solo cio’ che credo possibile (i.e. esiste un piano che ritengo eseguibile) 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, ne cerchero’ 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”) 18 +89 31330+ Plan library /3+ 33 Intentions structured into plans perception means-end reasoning Opportunity analyser Filtering process Beliefs Reasoner ) 7:! action : option Deliberation process Desires intentions 5 $" " Beliefs, Desires e Intentions sono considerati come lo “stato mentale” di un agente Per modellizzare questi stati mentali viene usata la logica modale: Beliefs: operatore modale Bel (o B) Desires: operatore modale Des (o D) Intentions: operatore modale Int (o I) 19 ;( " ")+ " 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 formalizzazione della 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 parlare delle intenzioni di un agente. 20 .-, 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 α ) ( (Int α ) ( Des α)) 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. 21 /#" " != " Indecidibile Anche nei casi decidibili, dimostrazioni molto pesanti dal punto di vista computazionale I sistemi reali “approssimano” la semantica modale invece che implementarla (" ")+ " practical reasoning = deliberation + means-ends reasoning 1. deliberation Identificazione e Selezione di goal e intenzioni 2. means-ends reasoning pianificazione, valutazione di piani, selezione di piani 22 (" ")+ " > ; ? 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 proprie intenzioni Se ho intenzione di fare , uno si aspetta che io dedichi tutte la mie risorse per decidere come portare avanti l’esecuzione di 23 (" ")+ " 5 Gli agenti non possono adottare intenzioni in conflitto Se ho intenzione di fare , non ci si aspetta che io adotti l’intenzione di fare incompatibile con Gli agenti sono inclini a riprovare se il loro tentativo di portare avanti una intenzione fallisce Se il primo tentativo di soddisfare fallisce, allora l’agente provera’ un piano alternativo per soddisfare (" ")+ " 5 Gli agenti credono che le loro intenzioni sono are 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 24 (" ")+ " 5 Sotto certe circostanze, gli agenti credono che saranno in grado di portare a termine le proprie intenzioni Gli agenti non intendono tutti i side effects delle loro intenzioni Credo che andare dal dentista possa provocare dolore, e ho intenzione di andare dal dentista – ma questo non significa che intendo soffrire! ( " ")+ " ;@ " A ! + " intention (goal / task) beliefs (state of environment) planner 5 possible actions me an r e a s- e n son ds ing plan to achieve goal 25 percepts 3. BDI Architecture Belief revision Beliefs Knowledge Opportunity analyzer B = brf(B, p) Deliberation process Desires D = options(B, D, I) Intentions Filter I = filter(B, D, I) Means-end reasoner Intentions structured in partial plans π = plan(B, I) Library of plans (" ")+ " agent control loop Plans Executor > actions ; ? - what are the options (desires) ? - how to choose an option ? - incl. filter - chosen option intention … 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 !? 26 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 credenze Des insieme di tutti i desideri Int 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 La option generator function è: ℘(Bel) x ℘(Int) ℘(Bel) ℘(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 27 Il BDI deliberation process (filter) è: ℘(Bel) x ℘(Des) x ℘(Int) ℘(Int) Aggiorna le intenzioni sulla base dei desideri, delle credenze e delle intenzioni Una volta che l’agente ha deciso di fare x, deve provvede ‘praticamente’ ad assolvere il compito. 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 nuove possibilità La funzione execute è: ℘(Int) La funzione action è: P A A function action (p : P) : A begin 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. 28 $ )$ "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). 29 ) " 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) filtering in which the agent chooses between competing alternatives, and commits to achieving them. In order to select between competing options, an agent uses a filter function. ) " 30 (" ")+ " > ; ? 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 31 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 32 8 $$ $ /" this version still overcommitted to intentions: never stops to consider whether or not its intentions are appropriate modification: stop for determining whether intentions have succeeded or whether they are impossible: “Single-minded commitment” / )A$ ! !8 $$ $ Dropping intentions that are impossible or have succeeded Reactivity, replan 33 + ! " 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 $$ $ 34 + ! " 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 35 - $") + ! " 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-ATTIVO E REATTIVO Michael Georgeff ha sperimentato nel proprio framework BDI dMARS l’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 36 - $") + ! " 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. ( " ")+ " ( ! ")+ " / 5 $ >(+/? “BDI-architecture” (beliefs / desires / intentions) explicit data structures for b/d/i planning no “on-the-fly” planning a plan: goal context body plan libraries (post-condition) (pre-condition) (sequence of action / subgoals) intention stack sensor input agent beliefs plans interpreter desires intentions action 37 (+/ 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 part describing the events that must occur in order to execute a KA (the acquisition of some new goal, some change in system beliefs,...). 38 (+/" !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 changes of 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. 39 B %)! " C () " type: drink-cola type: drink-water invocation: goal-add(¬thirst) precondition:have-glass add-list: {¬ thirst} body: invocation: goal-add(¬thirst) precondition:have-glass add-list: {¬ thirst} body: start start have-cola open-tap 1 proposition action drink end 1 drink end 231+(+131+>? beliefs espliciti eventi interni Initialize state(); ed esterni do options := option-generator(event-queue, B,G,I); selected-option := deliberate(options,B,G,I); I := update-intentions(selected-option,I); bound on reaction atomic time execute(I); actions event-queue := event-queue + get-new-externalevents(); drop-successful-attitudes(B,G,I); anche esito azioni drop-impossible-attitudes(B,G,I); until quit. 40 - A " ># A= :: ,:? options := {}; for trigger-event ∈ event-queue do for plan ∈ plan-library do if 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). 41 @ "B %)! " type: prove B invocation: goal-add(Bel(B)) precondition: Bel(A) add-list: {Bel(B)} body: type: meta-selector invocation: lenght(options)>1 add-list: {goal-add(?x)} body: start Bel(∀?x ¬cheap(?x)) 1 ?x := randomchoice(options) end end Bel(cheap(?x)) 2 goal-add(?x) end Beliefs Goals cheap(drink-water) ∧ thirst ∧ have-glass option-set(drink-cola,drink-water) ¬thirst ?x=drink-water Intentions meta-selector Bel(cheap(?x)) drink-water open-tap drink ¬thirst 42 (" ")+ " > ; ? Other implementations IRMA DMARS Jason, for AgentSpeak(L) (java – sourceforge.net) JAM (java) JACK (java) JADEX … 43
Documenti analoghi
OGGETTO: MODELLO BDI (Belief, Desire, Intention)
Desires, più comunemente pensati come Goals, costituiscono un altro elemento fondamentale dello
stato del sistema. In termini computazionali un Goal può essere il valore di una variabile, un record...