Presentation is loading. Please wait.

Presentation is loading. Please wait.

AOSE Agent-Oriented Programming. Introduction A class of programming language that often embodies the various principles proposed by theorists. –Many.

Similar presentations


Presentation on theme: "AOSE Agent-Oriented Programming. Introduction A class of programming language that often embodies the various principles proposed by theorists. –Many."— Presentation transcript:

1 AOSE Agent-Oriented Programming

2 Introduction A class of programming language that often embodies the various principles proposed by theorists. –Many of these languages draw from work done on agent architectures. –They couple such architectures with high-level languages that are derived from the agent theories. Concept of Agent-Oriented Programming introduced in 1993 by Yoav Shoham. –Adopts a view of programs that are implemented as a set of interacting agents. –Inspired by agent theory - agents viewed as mental entities that employ a set of mental states. –Agents executed on purpose-built interpreters that manipulate this state in a well-defined way.

3 OOP versus AOP (Shoham) OOPAOP Basic UnitObjectAgent Parameters describing unconstrainedbeliefs, commitments, state of basic unitcapabilities Process of Computationmessage passing andmessage passing andresponse methods Types of Messageunconstrainedinform, request, offer Constrains on Methodsnonehonesty, consistency

4 AOP System Requirements A complete AOP System includes three primary components: –a restricted formal language with clear syntax and semantics for describing mental states. –an interpreted programming language in which to define and program agents, with primitive commands (such as request and inform). –an ”agentifier”, converting neutral devices into programmable agents. Shoham illustrates this through a prototype AOP language, Agent-0.

5 Agent-0: Mental State Actions: represented as facts that must be true when the action is perform. –Rather than stating that the agent performed an action at a time, we state that the fact that the action was performed at a given time: holding(robot, cup) t : the robot is holding the cup at time t. Beliefs: beliefs are facts that are temporally specified. –You believe X at a given time where X is a sentence about the state of the world at a point in time. B b 10 likes(a,b) 7 : b believes at time point 10 that a likes b at time point 7. B a 3 B b 10 likes(a,b) 7 : a believes at time point 3 that b believes at time point 10 that a likes b at time point 7.

6 Agent-0: Mental State Obligations: agents make commitments to one another about a fact holding. –Agents represent decisions about what will happen as commitments to facts: OBL a,b t greets(a,b) t’ : a is obliged to b at time t to the fact that a greets b at time t’. –Encodes the idea of social agreement Decisions: represents the personal choices of the agent as to what actions it will perform. –This can be represented as obligation to oneself. DEC a t X = def OBL a,a t X

7 Agent-0: Mental State Capabilities: which actions the agent is able achieve at a given time. –Defines what actions are achievable when: CAP a t greets(a,b) t’ : at time t, a believes that a is capable of greeting b at time t’. –Leads to the notion of ability – that at time t, the agent Is capable of achieving an action at time t: ABLE a X =def CAPatime(X)X

8 Agent-0: Mental State Properties internal consistency: that beliefs and obligations are not contradictory –for all a,t {ψ: B a t ψ} is consistent –for all a,t {ψ: OBL a,b t ψ for some b} is consistent good faith: the agents only commit to actions they believe they are able to perform –for any a, b, ψ: OBL a,b t ψ => B a t ((ABLE a ψ) ∧ ψ) Introspection: agents are aware of their obligations –for any a, b, ψ: OBL a,b t ψ => B a t OBL a,b t ψ –for any a, b, ψ: ~OBL a,b t ψ => B a t ~OBL a,b t ψ

9 Agent-0: Mental State Properties persistence of mental state: how the mental state components change over time. –Beliefs persist by default: that is, everything an agent believes at one time point is still believed at the next time point unless a contradictory fact is learnt. –Absence of belief persists by default: anything that an agent does not know at a time point is still unknown at the next time point unless it learns the belief.

10 Agent-0: Mental State Properties persistence of mental state: how the mental state components change over time. –Obligations persist by default: an agent continues to honour its obligations unless the contracting party agrees to the dropping of the obligation or the agent realises that it is not able to fulfill its obligations. –Decisions persist by default: property is inherited from obligation, but interesting to note that decisions can be dropped unilaterally (they are personal to an agent) –Capabilities are fixed: what an agent can do at one time point can be done at the next time point subject to associated conditions.

11 Agent-0: The Interpreter

12 Agent-0: Assumptions Message Passing: –Agents are addressable by name –Names are location independent –The form of the messages is interpreter dependent –The interpreter controls when the messages are sent Clock: –A global clock (scheduler) manages execution of the agent at regular intervals. –Execution lasts for a fixed amount of time (timegrain) Actions: –The agent has a static library of actions that may be invoked by name.

13 Agent-0: Language Syntax Facts: –“Smith is an employee of acme at time t” (t (employee smith acme)) –“Jones is NOT an employee of acme at time t” (NOT (t (employee smith acme))) Private Actions: –“kick the ball at time t” (DO t kick-ball)

14 Agent-0: Language Syntax Communicative Actions: –“Inform a of a fact at time t” (INFORM t a fact) –“(Un-)Request that a perform an action at time t” (REQUEST t a action) (UNREQUEST t a action) –“Don’t perform this action” (REFRAIN action) –“Request at time 1 that a updates the database at time 10” (REQUEST 1 a (DO 10 update-database)) –“Request at time 1 that a requests at time 5 that b informs at time 10 c of a fact” (REQUEST 1 a (REQUEST 5 b (INFORM 10 c fact)))

15 Agent-0: Language Syntax Conditional Actions: –“Only do the action if some mental condition holds” (IF mntlcond action) –“If the agent believes that smith is an employee of acme at time t’ then tell a this at time t” (IF (B (t’ (employee smith acme))) (INFORM t a (t’ (employee smith acme)))) –“Request at time t that b informs at time t+1 c of a fact only if b beliefs the fact to hold” (REQUEST t b (IF (B fact) (INFORM t+1 a fact))) –“If the agent sees the ball at time t and the agent is committed to shooting a time t then perform shoot” (IF (AND (t sees-ball) (CMT shoot)) (DO t shoot))

16 Agent-0: Language Syntax Commitment Rules: –“If a given message condition is satisfied and a given mental condition is satisfied, commit to zero or more action(s) on behalf of some agent(s)” (COMMIT msgcond mntlcond (agent action)*) –“If an agent sends a request for an action and you believe that a is now a friend then commit to the action” (COMMIT (?a REQUEST ?action) (B (now (myfriend ?a))) (?a ?action)) –Here ? denotes a variable.

17 Agent-0: Language Syntax Commitments (Obligations): –A list of agent name and action pairs (agent action) –Can be queried using the the following templates: ((CMT agent) time action) / ((CMT agent) action) Capabilities: –Associate conditions with primitive actions to stop incompatible actions being attempted: (action mntlcond) –“Perform the rotate wheelbase action only if you are not committed to servicing the wheelbase at that time” ((!?time (rotate wheelbase ?degree)) (NOT ((CMT ?x) ?!time (service wheelbase))))

18 Example: Airline Booking System “Issue boarding passes precisely one hour before departure; no seat assignments” –(issue_bp pass flightnum time) => (IF (AND (B ((- time h) (present pass))) (B time (flight ?from ?to flightnum))) (DO time-h (physical_issue_bp pass flightnum time))) “Ask an askee to tell you if it believes some fact q, and return all matching facts” –(query_which t asker askee q) => (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q))) “Ask an askee to tell you whether or not it believes some fact q, and return all matching facts” –(query_which t asker askee q) => (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q)))

19 Example: Airline Booking System “Issue boarding passes precisely one hour before departure; no seat assignments” –(issue_bp pass flightnum time) => (IF (AND (B ((- time h) (present pass))) (B time (flight ?from ?to flightnum))) (DO time-h (physical_issue_bp pass flightnum time))) “Ask an askee to tell you if it believes some fact q, and return all matching facts” –(query_which t asker askee q) => (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q))) “Ask an askee to tell you whether or not it believes some fact q, and return all matching facts” –(query_whether t asker askee q) => (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q))) (REQUEST t askee (IF (B (NOT q)) (INFORM (+ t 1) asker (NOT q))))

20 Example: Airline Booking System Capability: There are no constrains on issuing a boarding pass –((issue_bp ?a ?flight ?time) true) Capability: The update remaining seats can only be carried out if the agent believes that there are seats available –((DO ?time (update_remaining_seats ?time1 ?flight_number ?additional_seats)) (B ?time (remaining_seats ?time1 ?flight_number ?current_seats))))

21 Example: Airline Booking System Commitment Rules: –(COMMIT (?pass REQUEST (IF (B ?p) (INFORM ?t ?pass ?p))) true (?pass (IF (B ?p) (INFORM ?t ?pass ?p)))) –(COMMIT (?cust REQUEST (issue_bp ?pass ?flight ?time)) (AND (B (?time (remaining_seats ?flight ?n))) (?n > 0) (NOT ((CMT ?anyone) (issue_bp ?pass ?anyflight ?time)))) (myself (DO (+ now 1) (update_remaining_seats ?time ?flight -1))) (?cust (issue_bp ?pass ?flight ?time)))

22 Conclusions Agent-0 demonstrates how agents can be programmed as mental entities Contains a relatively small set of constructs but is VERY difficult to understand programs –Nesting of actions powerful but can cause confusion –Undone by the fact the the agent must have a commitment rule to handle each incoming message. No tool support –Agent program is a text file (no syntax checker / code verifier) –Debugging supported through output to the console


Download ppt "AOSE Agent-Oriented Programming. Introduction A class of programming language that often embodies the various principles proposed by theorists. –Many."

Similar presentations


Ads by Google