Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to JADE 簡嘉建.

Similar presentations


Presentation on theme: "Introduction to JADE 簡嘉建."— Presentation transcript:

1 Introduction to JADE 簡嘉建

2 Outline DEMO Agent Standards JADE Term Project進度報告 DEMO(again)
Agent platform Programming Term Project進度報告 DEMO(again)

3 Agent Standards– FIPA FIPA (Foundation for Intelligent Physical Agents) 是一個國際組織, 其主要的任務在於促進智慧型代理人技術。 FIPA組織會員是開放給任何個人, 公司與政府單位或國際組織。 FIPA是一個非營利性的組織在瑞士日內瓦註冊。 FIPA2000參與的公司包括SUN、IBM、Fujitsu、HP….。

4 FIPA Standards FIPA是一個國際性的非營利性組織,其目的在為一致性的代理人技術訂定規格。
FIPA並不是為單一領域的技術做促銷,而是希望對不同領域提供一互動的標準,來讓開發人員能整合不同的系統。FIPA只針對系統元件外部的行為作一規範,至於實作的細節和系統內部的架構則留給平台的開發者。 FIPA-compliant Agent Platforms: JADE、 FIPA-OS(NORTEL)、ASL、Bee-gent(Toshiba)、Grasshopper-2 ….

5 FIPA Standards Online FIPA 標準目前線上可以閱讀的文件包括:
1) 代理人管理 (Agent management) 2) 發展者的指引 (developer guide) 3) 人機互動 (human-machine interaction) 4) 本體語言 (ontology) 與 5) 安全管理 (security management)

6 Mobile Agent Standards – MASIF
MAF (Mobile Agent Facility)的 MASIF提議自1988年起由 OMG (Object Management Group) 開始研究。 MASIF 主要著眼於 1) 代理人管理: (啟始, 終止, 暫停, 回復) 2) 代理人的轉移 3) 代理人與代理人系統的命名 The MASIF specification is largely based on the IBM Aglets mobile agent system design.

7 FIPA vs. OMG FIPA is dominated by computer and telecommunications companies and is focus primarily on agent-level issues. (BDI: belief-desire-intention) expecting agent to have mental states, beliefs about other agents and the state of the world, and desires and plans for take actions to change the state of the world. OMG is the standards body that created the CORBA distributed object protocol and tends to focus on object-level interoperability and management.

8 JADE (Java Agent DEvelopment Framework)
由CSLET S.p.A in Torino, Italy所開發。 一符合FIPA標準的多代理人系統(multi-agent systems)開發架構。 JADE:

9 Two Main Products in JADE
符合FIPA標準的代理人平台(參照下圖) JADE是一個符合FIPA的執行時期多代理人系統,可以讓代理人在上面活動並使用它所提供的特色,如訊息傳遞、代理人生命週期的管理。 開發Java代理人的程式套件 另一方面,JADE是一個Java架構,提供程式開發者來發展一符合FIPA的代理人應用程式。

10 Agent Platform Reference Model (FIPA )

11 AMS (Agent Management System)
AMS本身是一個代理人,它擁有整個代理人平台存取的管理權,並負責代理人平台內所有代理人的認證和登錄。一個理人平台只能有一個AMS。 AMS提供white-page和life-cycle服務,前者負責AID(agent identifiers)的目錄,每個agent一初始必須要跟AMS登錄以取得一個有效的AID;後者維護代理人的各個狀態(參照下圖)。

12 Agent Life Cycle

13 DF (Directory Facilitator)
DF本身是一個代理人,提供yellow-page服務,每個代理人都可向DF登錄自己所提供的服務,而其他的代理人可以查詢平台內代理人所提供的服務有哪些是自己需要的。

14 ACC (Agent Communication Channel)
當JADE agent和non-JADE agent溝通時,ACC負責雙向的交談。 FIPA要求ACC支援IIOP(Internet InterOrb Interoperability Protocol)使得只要遵守FIPA的代理人平台能夠互相運作。

15 JADE Platform 單一的JADE代理人平台可以跨數個主機系統(host systems),但每一主機需要Java Virtual Machine(JVM) 。

16 JADE Platform (cont’d)

17 Features of JADE FIPA-compliant Agent Platform 以Java程式撰寫 分散式的代理人平台
Other FIPA-compliant Agent Platform, FIPA-OS(NORTEL)、ASL、Bee-gent(Toshiba)、Grasshopper-2 …. 以Java程式撰寫 分散式的代理人平台 圖形化的平台管理介面 Remote Management Agent(RMA),也是一個Agent

18 Features of JADE (cont’d)
除錯工具Dummy Agent、Sniffer、IntrospectorAgent Mobility (Java Serialization, Reflection API) 開放的原始碼,遵從LGPL(Lesser General Public License) 可與JESS(Java Expert System Shell, a Java version of CLIPS)整合,提供代理人reasoning的功能

19 JADE Agent程式設計最重要的三件事
Agent Content Language : Ontology Agent communication languages Agent Behaviour

20 JADE Agent程式設計最重要的三件事
Agent Content Language : Ontology Agent communication languages Agent Behaviour

21 Agent Language Agent implementation languages
C++ Java Agent communication languages KQML (Knowledge Query Manipulation Language) FIPA-ACL Agent Content Language : Ontology KIF (knowledge interchange format) WORDNET

22 MAS(Multi-Agent System)
發展一個多代理人系統最重要的任務就是異質軟體的整合,亦即獨立開發的代理人彼此間可以成功的互動。 以多代理人為基礎的技術若缺乏一個相互溝通的標準,它將無法運作。 Agent content language : Ontology Domain 的vocabulary 類似XML Schema Agent communication languages

23 XML & XML Schema <CD> <TITLE>Carolyn Debern</TITLE>
<PRICE>480</PRICE> <TRACKS> <TRACK>Every breath you take</TRACK> <TRACK>Autumn Leaves</TRACK> <TRACK>Tore Amour</TRACK> </TRACKS> </CD>

24 Agent Content Language:Ontology
There is a person whose name is Giovanni and who is 33 years old in an ACL content expression could be represented as the string (Person :name Giovanni :age 33) 舊的content expression(用string表示) Not suitable to handle the information (require each time to parse the string) Perform a number of semantic checks 新的content expression (用object表示) Conveniently be represented inside an agent as Java objects.

25 Internal Mechanism

26 CD.java public class CD extends Item{ // title private String title;
public void setTitle(String s) { this.title=s; } public String getTitle() { return this.title; } // price private String price; public void setPrice(String p) { this.price=p; } public String getPrice() { return this.price; } // tracks private List tracks = new ArrayList(); public void addTracks(Track o) { tracks.add(o); } public boolean removeTracks(Track o) {return tracks.remove(o); } public List getTracks() {return tracks; } public void setTracks(List l) {tracks = l; }}

27 MusicShopOntology.java cdSchema.add(CD_TITLE,(TermSchema)getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY); cdSchema.add(PRICE,(TermSchema)getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL); cdSchema.add(CD_TRACKS, trackSchema, 1,20);

28 CD in ACLMessage (CD :TITLE \"Carolyn Debern\" :PRICE \"480\"
:TRACKS (sequence (Track :NAME \"Every breath you take\") (Track :NAME \"Autumn Leaves\") (Track :NAME \"Tore Amour\")) )

29 Codec SL language is a human-readable string-encoded
LEAP language is a non-human-readable byte-encoded XMLCodec

30 SL0Codec Vs. SLCodec jade.lang.sl.SL0Codec(JADE2.0)
jade.content.lang.sl.SLCodec(JADE2.5) Elements that can appear within a valid sentence Concepts : indicate entities that“exist”in the world. Ex. (Person :name John) Predicates : say something about the status of the world and can be true or false. Ex. (Works-for (Person :name John) (Company :name TILAB)) Agent action : indicate actions that can be performed by some agents. Ex. (Sell (Book :title “The Lord of the rings”) (Person :name John))

31 JADE Agent程式設計最重要的三件事
Agent Content Language : Ontology Agent communication languages Agent Behaviour

32 Agent Communication Language: ACL-KQML
由KQML(Knowledge Query and Manipulation Language)衍生而來 It describes the “speech act” of the message using a set of performatives( message types ), that express an attitude regarding the content of the exchange. The content language of the message is not part of KQML, but can be specified by KQML performatives.

33 An KQML Example (QUERY-IF
:content “(Works-for (Person :name John) (Company :name TILAB))” :sender RequesterAgent :receiver EngagerAgent :language FIPA-SL :ontology employment-ontology)

34 An KQML Example(cont’d)
(INFORM :content “(Works-for (Person :name John) (Company :name TILAB))” :sender EngagerAgent :receiver RequesterAgent :language FIPA-SL :ontology employment-ontology)

35 Categories of Performatives
Basic Query: Evaluate, ask-if, ask-about, ask-one, ask-all Multi-response Query: stream-about, stream-all, eos Response: reply, sorry Generic information: tell, achieve, cancel, untell, unachieve

36 JADE Agent程式設計最重要的三件事
Agent Content Language : Ontology Agent communication languages Agent Behaviour

37 Agent Behaviour An agent must be able to carry out several concurrent tasks in response to different external events. All agent’s tasks are modeled and can be implemented as Behaviour objects. 基本的behaviour Behaviour:atomic behaviour. OneShotBehaviour:must be executed only once and cannot be blocked. CyclicBehaviour:must be executed forever. CompositeBehaviour:are made up by composing a number of other children behaviours.

38 Agent Behaviour (cont’d)
FIPA defined a set of interaction protocols Which are tightly scripted sequences of speech acts, for asking questions, sharing knowledge, and participating in various types of auctions and negotiation. (ex. contract net negotiation protocol、English and Dutch auctions….) For defining dialogues between agents.(不同於echo,而是更進一步定義訊息如何傳送,如何回覆) JADE以behaviour的方式來implement這些interaction protocols.

39 Contract Net Protocol Tasks allocation(應用:Vehicle Routing Problem)

40 Contract-Net Protocol Support in JADE
cfp propose refuse Not-understd accept reject cancel inform failure Initiator Responder Initiator:createCfpContent Responder:handleCfpMessage Initiator: handleProposeMessages handleOtherMessages handleAcceptProposalMessage handleRejectProposalMessage

41 測試情境 在這個多代理人系統內,存在有兩個Seller Agents和一個Buyer Agent。 Seller Agents販賣音樂CD,而Buyer Agent則輔助使用者購買CD。當使用者在介面上輸入某首歌曲的名稱,Buyer Agent會broadcast一個CFP (Call for Proposal)訊息給系統內的Seller Agents,Seller Agents在收到這個CFP後,會查詢庫存資料庫來判斷這首歌出現在哪幾片CD內,這片CD是否尚有庫存。

42 開發環境 Java 2 SDK, Standard Edition, version 1.3.1 (JDK 1.3.1) JADE 2.5
JESS version 6.0

43 何謂合適? Seller Agent評估這個CFP訊息,並提出合適的Proposal (何謂合適?).
Buyer Agent評估這些Proposals,選出合適的Proposals (何謂合適?),並採取相對應的動作. 如果Agent只是做data collection的工作,其實跟直接搜尋database沒什麼兩樣。我們希望它能表現出智慧!!原本由人來做決策,改成由Agent.

44 Seller Agent 目前,Seller Agent的 knowledge base只有一個rule (i.e querydb),這個rule會查詢庫存資料庫有無產品的存貨和相關資訊,這個rule在下一階段仍會繼續使用,因為畢竟有東西可以賣是先決的條件。 下一步 (Knowledge Engineering) 例如:Buyer Agent在購買衣服時會順便附上使用者的資料,如身高、體重、職業等,而Seller Agent可以以它的領域知識,例如如果Buyer的身高、體重成某種比例,那麼Buyer是一個胖子。如果Buyer是一個胖子,就不能推薦橫條紋的衣服。

45 Seller Agent’s Rules 當 Seller Agent 接收到CFP訊息時,會新增一個Fact :
(defrule querydb ;querydb rule ?m <- (TrackName ?n) => (queryCDbyTrack ?m) ;’queryCDbyTrack’ is a user-defined function (retract ?m)) 當 Seller Agent 接收到CFP訊息時,會新增一個Fact : (assert (TrackName Every_breath_you_take))。

46 Buyer Agent 我們並不希望Buyer Agent在作購買的決策上有絕對的自主權,而是希望Buyer Agent站在決策輔助者的角色上,提供使用者足夠的資訊來決定是否採取購買的行動。 Data Fusion Buyer Agent不只是蒐集Data,而是更進一步做Data的整理,來產生有用的information,這些information是使用者做最終決策的基礎。在系統實作上,採用針對proposal的各組成因子(如,價格),提出comments。

47 Buyer Agent’s Rules (defrule match-input ;match-input rule
?m <- (input ?c&:(external-addressp ?c)) => (assert (cdprice (call ?c getPrice))) (retract ?m)) (defrule compare-price ;compare-price rule ?m <- (cdprice ?x) (test (> ?x 500)) (assert (comment (fetch CD))) (assert (price2high (str-cat ?x "(***too expensive)"))) (defrule price-comments ;price-comments rule ?m <- (comment ?c&:(external-addressp ?c)) ?n <- (price2high ?p) => (call ?c setPrice ?p) (retract ?m) (retract ?n))

48 References FIPA:http://www.fipa.org
JADE: JESS: Joseph P. Bigus, Jennifer Bigus, “Constructing Intelligent Agents Using Java: Professional Developer's Guide, 2/e”, JOHN WILEY & SONS,INC Danny B. Lance, Mitsuru Oshima, “Programming And Deploying Java Mobile Agents With Aglets”, ADDISON-WESLEY


Download ppt "Introduction to JADE 簡嘉建."

Similar presentations


Ads by Google