版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、2022-4-26史忠植 高級(jí)人工智能1高級(jí)人工智能高級(jí)人工智能第十四章 分布式人工智能多主體環(huán)境多主體環(huán)境MAGEMAGE 史忠植史忠植 中國科學(xué)院計(jì)算技術(shù)所2022-4-26史忠植 高級(jí)人工智能2內(nèi)容提要 概述 MAGE簡介 主體建模 開發(fā)平臺(tái) 運(yùn)行平臺(tái) 移動(dòng)主體 應(yīng)用2022-4-26史忠植 高級(jí)人工智能3 概述概述/resources/agent-software.phpAgent Software Total: 116 MAGE: Multiagent development environment is an integrated to
2、ol suite for constructing multiagent systems2022-4-26史忠植 高級(jí)人工智能4AgentCitiesBeijing!2022-4-26史忠植 高級(jí)人工智能5General Development ProcessRequirement AnalysisSystem DesignSystem DevelopmentBehaviour LibraryAgent LibraryAgent SocietySystem Deployment2022-4-26史忠植 高級(jí)人工智能6多主體系統(tǒng)設(shè)計(jì)過程用例模型功能描述功能描述活動(dòng)模型反應(yīng)規(guī)則模型推理模型行為描述
3、行為描述狀態(tài)機(jī)模型交互協(xié)議模型規(guī)劃模型組織關(guān)系模型主體類模型主體描述主體描述本體模型本體描述本體描述部署模型配置描述配置描述一二三四2022-4-26史忠植 高級(jí)人工智能7 UML中的表示法(抽象語法) OMG發(fā)布的UML定義規(guī)范中,模型的抽象語法是通過類圖表示的各結(jié)構(gòu)成分之間的關(guān)系給出的。UML中用例包的抽象語法2022-4-26史忠植 高級(jí)人工智能8 UML中的表示法(靜態(tài)語義)模型結(jié)構(gòu)成分之間的約束(即靜態(tài)語義)是通過OCL語言描述的規(guī)則表示的。例如:Actor只能與UseCase、Subsystem和Class發(fā)生關(guān)聯(lián),并且關(guān)聯(lián)是二元的。此約束表示如下: self.associatio
4、ns - forAll (a | a.connection - size = 2 and a.allConnections - exists(r | r.type.oclIsKindOf(Actor) and a.allConnections - exists(r | r.type.oclIsKindOf(UseCase) or r.type.oclIsKindOf(Subsystem) or r.type.oclIsKindOf(Class) ) )2022-4-26史忠植 高級(jí)人工智能9本體圖本體圖主體系統(tǒng)主體系統(tǒng)結(jié)構(gòu)結(jié)構(gòu)角色圖角色圖協(xié)議圖協(xié)議圖主體主體類型圖類型圖主體主體交互交互系統(tǒng)系統(tǒng)
5、配置圖配置圖系統(tǒng)系統(tǒng)結(jié)構(gòu)圖結(jié)構(gòu)圖分布圖分布圖類圖類圖本體本體協(xié)作圖協(xié)作圖結(jié)構(gòu)圖結(jié)構(gòu)圖AUMLUML AUMP2022-4-26史忠植 高級(jí)人工智能10AUML擴(kuò)展UML來描述多主體系統(tǒng) 在AUML中,我們引入了四種面向主體的圖來描述一個(gè)多主體系統(tǒng): 本體圖:定義用來描述世界狀態(tài)用到的實(shí)體以及它們之間的關(guān)系。 主體系統(tǒng)結(jié)構(gòu)圖:描述多主體系統(tǒng)的結(jié)構(gòu)。 協(xié)議圖:描述主體之間的交互協(xié)議。 角色圖:描述主體在交互中扮演的角色。 2022-4-26史忠植 高級(jí)人工智能11 AUMP的表示法(屬性圖) AUML的圖形模型都是屬性圖。屬性圖是帶屬性的多重有向圖。 屬性圖的形式化定義如下: AttributeG
6、raph=(V, E, s, d, ) s,d:EV :(EV)(AU) 其中,V是節(jié)點(diǎn)集合,E是邊的集合,s,d是邊到節(jié)點(diǎn)的函數(shù),分別表示邊的起點(diǎn)和終點(diǎn)。 是邊和節(jié)點(diǎn)到屬性描述的函數(shù),屬性描述是屬性名稱到屬性值的函數(shù),A表示屬性名稱集合,U表示屬性值集合。2022-4-26史忠植 高級(jí)人工智能123.2.3 AUMP的表示法(Meta表示法) 描述程序設(shè)計(jì)語言抽象語法的Meta表示法由兩部分組成: (1)構(gòu)造的有限集合。 (2)產(chǎn)生式的有限集合,每個(gè)產(chǎn)生式和一個(gè)構(gòu)造對(duì)應(yīng)。 聚集產(chǎn)生式:表示一個(gè)構(gòu)造有固定數(shù)目的成分。 例Conditional = test:Boolean_expression
7、; thenbranch: Command; elsebranch:Command; 選擇產(chǎn)生式:表示一個(gè)構(gòu)造可以選擇幾種類型。 例Command = Skip | Assignment | Compound | Conditional | Loop 表產(chǎn)生式:表示一個(gè)構(gòu)造是另一個(gè)構(gòu)造的實(shí)例序列。 例Compound = Command+2022-4-26史忠植 高級(jí)人工智能133.2.3 AUMP的表示法(結(jié)合屬性圖和Meta表示法) 基本思想:將模型、節(jié)點(diǎn)、邊、屬性都看作構(gòu)造,模型是非終結(jié)構(gòu)造,節(jié)點(diǎn)、邊和屬性是終結(jié)構(gòu)造,模型通過一定的產(chǎn)生式由節(jié)點(diǎn)、邊和屬性構(gòu)成。 擴(kuò)充:擴(kuò)充Meta表示法表
8、示屬性圖中的函數(shù)關(guān)系。因?yàn)楹瘮?shù)關(guān)系是實(shí)體到另外實(shí)體的映射關(guān)系,而不是構(gòu)造關(guān)系。所以,符號(hào) = 仍然表示構(gòu)造關(guān)系,新加入符號(hào) 表示函數(shù)關(guān)系。如:狀態(tài)機(jī)模型中的轉(zhuǎn)移描述為: Transition sourcestates; targetstates; rule:ECARule 如果t是Transition的一個(gè)實(shí)例,那么用tsource,ttarget, t.rule來表示t的起點(diǎn)、終點(diǎn)和轉(zhuǎn)移規(guī)則。2022-4-26史忠植 高級(jí)人工智能143.2.3 AUMP的表示法(狀態(tài)機(jī)模型的抽象語法)狀態(tài)機(jī)模型由狀態(tài)集合、目標(biāo)集合、轉(zhuǎn)移集合、驅(qū)動(dòng)集合構(gòu)成: StateChartModel = states:
9、 StateSet; goals: GoalSet; transitions: TransitionSet; drives: DriveSet; StateSet = State; GoalSet = Goal; TransitionSet = Transition; DriveSet = Drive;狀態(tài)是起始狀態(tài)、結(jié)束狀態(tài)和一般狀態(tài)之一: State = Initial | Final | CommonState;轉(zhuǎn)移連接兩個(gè)狀態(tài)實(shí)例,并且有一條ECA規(guī)則描述: Transition sourcestates; targetstates; rule:ECARule;ECA規(guī)則由事件、條件和
10、動(dòng)作構(gòu)造: ECARule = event: Event; condition:Condition; action:Action;驅(qū)動(dòng)連接目標(biāo)實(shí)例和狀態(tài)實(shí)例: Drive goalgoals; statestates;2022-4-26史忠植 高級(jí)人工智能153.2.3 AUMP的表示法(靜態(tài)語義的表示) 通過前面的表示法,已經(jīng)將模型的抽象語法表示成為了集合和關(guān)系的形式,那么就可以用集合表示法中的各種約束表示法來描述模型的靜態(tài)語義。 例如,狀態(tài)機(jī)模型中起始狀態(tài)的合法性描述為:有且只有一個(gè)起始狀態(tài);起始狀態(tài)有離開的轉(zhuǎn)移,沒有進(jìn)入轉(zhuǎn)移;離開起始狀態(tài)的轉(zhuǎn)移的ECA規(guī)則中事件和條件為空。 形式化描述如
11、下:).,()()(),(,conditionruleteventruletssourcetstransitiontsrgettatstransitiontssourcetstransitiontspInitialpstatespInitialsstatess2022-4-26史忠植 高級(jí)人工智能163.3.1 活動(dòng)圖動(dòng)態(tài)語義簡介 活動(dòng)圖為主體工作流建模,是描述主體行為最常用的方式。因此,活動(dòng)圖動(dòng)態(tài)語義研究是AUML動(dòng)態(tài)語義研究的重要組成部分。 活動(dòng)圖描述的是工作流的過程維度,即活動(dòng)在時(shí)間上的先后順序,而不考慮資源維度。 AUML在語法上對(duì)活動(dòng)圖并沒有擴(kuò)充,而是從語義上需要對(duì)UML定義的活動(dòng)圖
12、語義進(jìn)行擴(kuò)充。2022-4-26史忠植 高級(jí)人工智能173.3.2 活動(dòng)圖的語法activityactivitystartenddecision/mergefork/joinwait活動(dòng)圖中的節(jié)點(diǎn)waitactivitycompound activity活動(dòng)圖是一個(gè)有向圖,包括節(jié)點(diǎn)和有向邊。 Activity節(jié)點(diǎn)表示一個(gè)活動(dòng)的執(zhí)行。Wait節(jié)點(diǎn)表示等待某個(gè)事件的出現(xiàn)。fork/join表示并發(fā)結(jié)構(gòu),decision/merge表示分支結(jié)構(gòu)。邊實(shí)際上是一條ECA規(guī)則ec/a,其中e是事件表達(dá)式,c是限制條件,a是動(dòng)作表達(dá)式。這三個(gè)部分每個(gè)都是可選的。具有ec/a標(biāo)記的邊具有如下含義:如果系統(tǒng)處于
13、源狀態(tài),事件e出現(xiàn),并且限制條件c滿足,那么系統(tǒng)離開源狀態(tài),執(zhí)行動(dòng)作a,進(jìn)入目標(biāo)狀態(tài)。2022-4-26史忠植 高級(jí)人工智能183.3.4 活動(dòng)圖的語義(執(zhí)行算法)Initialize;While (C final configuration) do Repeat until I ; / wait for input events Retrieve the valuation of the local variables; Take a super-step: Repeat 1. Compute a step; 2. Compute the internal events generated
14、in the step; 3. Compute the next configuration; 4. Update C with the next configuration; 5. Empty the input I and fill it with the generated internal events; 6. Switch new relevant timers on and irrelevant timers off; 7. Update the bag of active edges by handling control nodes; Until I is empty and
15、there are no enabled edges;End while ; 2022-4-26史忠植 高級(jí)人工智能193.3.5 執(zhí)行示例Activity1Condition1Output1Input1Activity2:Goal1Activity3Condition2Activity4Role1Role2工作流描述(活動(dòng)圖)InitialStateActivity1State1Activity1TerminatesOutput1State2Input1State3State4Activity3Output1TerminatesInput1TerminatesActivity3Termina
16、tesInitialStateActivity1State1Activity1TerminatesActivity2,Activity4State2State3Activity2TerminatesActivity4TerminatesRun1Run2Activity4InitialStateActivity1State1Activity1TerminatesActivity2,Activity4State2State3Activity4TerminatesActivity2TerminatesRun3Activity2運(yùn)行 有了動(dòng)態(tài)語義,活動(dòng)圖就可以被執(zhí)行。例如:2022-4-26史忠植 高
17、級(jí)人工智能20Tool Suite(AUMP)2022-4-26史忠植 高級(jí)人工智能21 MAGE AgentAgent kernelAgent kernelSensorFunctionModuleInterfaceResource DatabaseEngineCommunicatorSchedulingFunction ComponentPlug-INsReasoningNegotiationcoOperationothersPlug-inManagerTaskDatabase2022-4-26史忠植 高級(jí)人工智能22Agent Operation Cycle2022-4-26史忠植 高級(jí)人
18、工智能23VAStudio ArchitectureAgent SocietyAgentsBehavioursEditorAgent LibraryBehaviour Library2022-4-26史忠植 高級(jí)人工智能24Screenshot of VAStudio2022-4-26史忠植 高級(jí)人工智能25Syntax of ADL(1) := := := Name = := DescriptionBEGINEND := Local Address = :2022-4-26史忠植 高級(jí)人工智能26Syntax of ADL(2)Acquaintance Addresses := Acquai
19、ntance AddressBEGIN = :*END := Extra ClassesBEGIN*END := Instance = CONSTRUCTOR = := CapabilitiesBEGIN*END := NAME = TYPE = CMDLINE = SOURCE = := 0 | 1 | 22022-4-26史忠植 高級(jí)人工智能27Syntax of ADL(3) := Environment VariablesBEGIN*END := = := int|boolean|char|string|float := SESSIONSBEGIN*END := SESSION END
20、 SESSION 2022-4-26史忠植 高級(jí)人工智能28主體間通信結(jié)構(gòu)Soft BUSAgent1Agent2AgentnFacilitator2022-4-26史忠植 高級(jí)人工智能29主體通信語言(ACL)ACL通信模塊并發(fā)對(duì)話機(jī)制Socket InterfaceOutgoing Message BufferIncoming Message BufferSending ThreadServerThreadClientThreadMessageThreadTimerReceiverThreadFilterThreadMessageSendingFunctionSACL ParserAddr
21、essBookTo MessageDispatcherAgent kernelAgent Community2022-4-26史忠植 高級(jí)人工智能30ACL constructing2022-4-26史忠植 高級(jí)人工智能31 MAGEMAGE主體Agent ManagementSystemDirectoryFacilitator主體AgentMessage Transport System (MTS)SoftwareAgentLibraryFunctionComponentOther Agent PlatformsOther Agent PlatformsMessage Transport S
22、ystem (MTS)2022-4-26史忠植 高級(jí)人工智能32GUI of MAGE2022-4-26史忠植 高級(jí)人工智能33Mage Tools Sniffer: Debugging tool, show communication between agents with graphic interface. Dummy: Debugging tool, demonstrate conversation between agents conveniently. DF: Directory facilitator, a service providing yellow page servic
23、e DLRM: A description logic based reasoning machine, providing reasoning service. ALM: Managing AAP and AAF, it will be further developed to build application via AAP and AAF.2022-4-26史忠植 高級(jí)人工智能34DummyAgent2022-4-26史忠植 高級(jí)人工智能35Sniffer2022-4-26史忠植 高級(jí)人工智能36Directory Facilitator What is Directory Facil
24、itator and why dose MAGE need DF. What can be done through DF? View Register Deregister Modify Search Federal search2022-4-26史忠植 高級(jí)人工智能37GUI of DF2022-4-26史忠植 高級(jí)人工智能38AAP and AAF What is Agent Application Pattern (AAP)? What is Agent Application Framework (AAF)? The relations between them? Why does
25、MAGE provide them? AAP management GUI2022-4-26史忠植 高級(jí)人工智能39GUI for AAP management2022-4-26史忠植 高級(jí)人工智能40FIPA inter-operation protocol library What is inter-operation protocol? Why does MAGE provide these protocols? MAGE provides protocols such as: FipaRequestInitiatorBehaviour FipaRequestResponderBehav
26、iour FipaQueryInitiatorBehaviour FipaQueryResponderBehaviour FipaContractNetInitiatorBehaviour FipaContractNetResponderBehaviour ContractNetInitiator 2022-4-26史忠植 高級(jí)人工智能41AAF: reasoning service Reasoning Description logic Description logic based reasoning machine Working pattern2022-4-26史忠植 高級(jí)人工智能42
27、DLRM2022-4-26史忠植 高級(jí)人工智能43Agent container Providing plenty of agent management function: createAgent, suspendAgent, resumeAgent, waitAgent, wakeAgent changeAgentPrincipal, changeContainerPrincipal, moveAgent, copyAgent, killAgent, dispatch, ping, installMTP, uninstallMTP, enableSniffer, disableSniffe
28、r, enableDebugger, disableDebugger. Providing toolkit for agent: handleStart, handleEnd, handleMove, handleClone, handleSend, handlePosted, handleReceived, handleChangedAgentState, handleChangedAgentPrincipal Providing event handling Demonstrate Start new agent Install a new MTP Uninstall a MTP Kill
29、 ContainerFrame2022-4-26史忠植 高級(jí)人工智能44Agent platform Providing plenty of management function for agent and container addContainer、removeContainer、suspend changeAgentPrincipal、wait、wake、move、copy、sniffOn、sniffOff、debugOn、debugOff、installMTP、uninstallMTP Notify what happened to event handler (mainly AMS
30、)bornAgent、deadAgent、suspendedAgent、resumedAgent、changedAgentPrincipal、newMTP、deadMTP Demonstrate View APDescription Manage installed MTPs PlatformFrame2022-4-26史忠植 高級(jí)人工智能45AgentPlatforms This node includes all platforms: local platform or remote platforms Demonstrate Add platform via AMS AID Add pl
31、atform via URL Add a container to a remote platform Start a tool from a remote container Communication between platforms2022-4-26史忠植 高級(jí)人工智能46移動(dòng)主體 Mobility in MAGE platform Supports user-defined content language and ontology. Inter-operation between MAGE and other agent or non-agent software. 2022-4-
32、26史忠植 高級(jí)人工智能47Introduction to Mobile Agents What is Mobile Agents? Mobility: Agents that can travel in network Autonomy: migrate at times and to place of their own choosing Compare to . Stationary agent Mobile code (Applets) Mobile object2022-4-26史忠植 高級(jí)人工智能48Network Computing ParadigmsClient-Server
33、Paradigm Code-onDemand Paradigm Know- howClientServerClientKnow- howKnow howServerDownload (Applet)AgentAgentKnow- howKnow- howHostHostNetworkMobile Agent Paradigm2022-4-26史忠植 高級(jí)人工智能49Compare Client/Server & Mobile Agent Model Limitation of Client/Server Scaling - Multiple servers Quality of net
34、work connectionReliability , latency , bandwidth Protocol Advantage of Mobile Agents Every node is a server Request Network connection No application-level protocol2022-4-26史忠植 高級(jí)人工智能50Seven good reasons for Mobile Agents Reduce network load Overcome network latency Encapsulate protocols Execute asy
35、nchronously and autonomously Adapt dynamically Naturally heterogeneous Fault-tolerant2022-4-26史忠植 高級(jí)人工智能51Mobile Agent Systems Java-based: Odyssey. General Magic Inc. Concordia. Mitsubishis Aglets. IBM Voyager. ObjectSpace Others: Tacoma: Univ.of Tromso and Cornell Univ. Agent TCL: Dartmouth College
36、2022-4-26史忠植 高級(jí)人工智能52Mobile Agent Model Key concepts: Agent- the main entity in Mobile Agent System Place- the environment where agents operate 2022-4-26史忠植 高級(jí)人工智能53Agent State: needed for resume computation after traveling Implementation: needed for location-independent agent execution Interface ne
37、eded for agent communication Identifier needed for recognize and locate traveling agents Principals needed to determine legal and moral responsibility2022-4-26史忠植 高級(jí)人工智能54Place Engine Workhorse and virtual machines for one or more places Resources Databases,processors,and other services provided by
38、the host Location The network address of a given place Principals Those legally responsible for the opration of a place2022-4-26史忠植 高級(jí)人工智能55The Agent Model Pyramid Host Engines Places Agents2022-4-26史忠植 高級(jí)人工智能56Place and Engine HostEngineAgentPlaceResources2022-4-26史忠植 高級(jí)人工智能57Agent Behavior(1)Creat
39、ion and Disposal Creation: Instantiation and identifier assignment Initialization Autonomous execution Disposal Preparing for disposal Suspension of execution2022-4-26史忠植 高級(jí)人工智能58Agent Behavior(2)Transfer dispatching/receiving Dispatch and Receive:SenderSuspend ExecutionSerialize Agent Encode Data T
40、ransfer DataReceiver Resume ExecutionDeserialize Agent Decode Data Receive Data Network2022-4-26史忠植 高級(jí)人工智能59Agent Behavior(2) Transfer agent class transfer Agent Class TransferServer Class codeOrigin Class codeServer Class codeAgentAgentClass at destinationClass at originClass at Server(code on dema
41、nd)2022-4-26史忠植 高級(jí)人工智能60Security of Mobile Agent What can go wrong? Agent protection remote host , other agents, unauthorized third parties Host protection incoming agents, third parties Network protection - incoming agents Security Services Authenticationuser, host, code, agent Integrity Confidenti
42、alitylAuthorizationlNon-repudiationlAuditing2022-4-26史忠植 高級(jí)人工智能61Aglet Model Basic Elements: Aglet a mobile Java object Proxy a representative of an aglet Context an aglets workplace IdentifierAglet and Proxy:Client Interaction Proxy AgletContextContextHostServer Process(Engine)NetworkHost,Server pr
43、ocess(engine) and Context2022-4-26史忠植 高級(jí)人工智能62Aglet : Life Cycle Model Fundamental operations: Creation Cloning Dispatching Retraction Activation and deactivation DisposalAgletCloneClass FileAgletDisk storageDisposeDispatchRetractCreateDeactivateActivateContext AContext B2022-4-26史忠植 高級(jí)人工智能63Aglet :
44、 Event Model Clone listener Mobility listener Persistence listenerAgletClone eventMobility eventPersistence eventCloneListenerMobilityListenerPersistenceListener2022-4-26史忠植 高級(jí)人工智能64Aglet : Communication Model Message passing: Allows aglets to create and exchange messages in flexible ways. Key Compo
45、nents: Aglet, AgletProxy,Message,Future reply, Reply setAglet/ApplicationMessageReplyMessage ReplyProxyAglet2022-4-26史忠植 高級(jí)人工智能65Aglet Package :a Quick Tour Aglet Class AgletProxy Interface AgletContext Interface Message Class FutureReply Class AgletID Class2022-4-26史忠植 高級(jí)人工智能66 Aglet API : Aglet Cl
46、assCreate a customized aglet:import com.ibm.aglet.*;Public class MyFirstAglet extends Aglet/put aglets methods hereOverriden methods:public void onCreation(Object init)/do some initialization herepublic void run() /do something here; /main entry point/e.g. call dispatch(new URL(“atp:/ 高級(jí)人工智能67Aglet
47、API :Aglet Class What happens when “dispatch”?StateByte CodeHostHostSendingReceivingStateByte Code HostHost Object Serialization TransferDeserialization and re-create state2022-4-26史忠植 高級(jí)人工智能68Aglet API : AgletProxy Why AgletProxy? Acts as a shield object that protects an aglet from malicious aglets
48、 Provide the aglet with location transparency How to get a proxy? Get proxy from a newly created aglet: AgletContext.createAglet(), AgletProxy.clone() Get proxy from existing aglets Aglet.getProxy() get its own proxy AgletContext.getAgletProxies() retrieve an enum. of proxies in a context AgletConte
49、xt.getAgletProxy() get an aglet proxy for a given aglet ID Message passing passed as an argument AgletContext.setProperty put proxy into context property and share it.2022-4-26史忠植 高級(jí)人工智能69Aglet API : AgletContext An aglet context is the equivalent of a place. An aglet uses AgletContext interface to:
50、 Get information about its environment Send message to the environment, including other aglets currently active in that environment How it works:context=getAgletContext();context.createAglet();context.retractAglet(remoteContextURL,agletID);2022-4-26史忠植 高級(jí)人工智能70Aglet API : Message Class Aglets commun
51、icate by exchanging objects of the Message class. “kind” field: distinguishes messagesMessage myName=new Message(“my name”, “Jacob”);Message yourname=new Message(“your name?”); Methods to send message(defined in AgletProxy class): Object sendMessage(Message msg) FutureReply sendFutureMessage(Message
52、 msg) Void sendOnewayMessage(Message msg)2022-4-26史忠植 高級(jí)人工智能71Aglet API : Message ClasshandleMessage method:Public boolean handleMessage(Message msg) if(msg.samekind(“my name”) String name=(String)msg.getArg(); return true; /Yes, I handled this message else if(msg.samekind(“your name?”) msg.sendRepl
53、y(“Yina”); /Return its name return true; /Yes, I handled this message else return false; /No, I did not handle this message2022-4-26史忠植 高級(jí)人工智能72Aglet API : AgletID Class Identity: Globally unique Throughout lifetime AgletID object Hides the implementation-specific representation Immutable Use : Agle
54、tID aid=proxy.getAgletID(); proxy=context.getAgletProxy(aid);2022-4-26史忠植 高級(jí)人工智能73Anatomy of an Aglet Creation & Disposal Clone Mobility Dispatch and Retract Persistence Activate and Deactive2022-4-26史忠植 高級(jí)人工智能74Creation public final AgletContext Aglet.getAgletContext()/Example: getAgletContext(
55、).createAglet(getCodeBase(),”SomeAglet”,null); Methods that can be overriddenprotected Aglet.Aglet()Public void Aglet.onCreation(Object init)Public void Aglet.run()createAglet()Aglet()onCreationrun()2022-4-26史忠植 高級(jí)人工智能75Disposalpublic final void Aglet.dispose();public void Aglet.onDisposing();Dispos
56、e()onDisposing() run()2022-4-26史忠植 高級(jí)人工智能76Event Event Types: CloneEvent MobilityEvent PersistencyEvent Delegation-Based Event Mode CloneListener CloneAdapter MobilityListener MobilityAdapter PersistencyListener PersistencyAdapter2022-4-26史忠植 高級(jí)人工智能77CloningPublic final Object Aglet.clone()Public fi
57、nal void Aglet.addCloneListener(CloneListener listener)Public final void Aglet.removeCloneListener(CloneListener listener)public CloneAdapter.CloneAdapter()public void CloneAdapter.onCloning(CloneEvent event)public void CloneAdapter.onClone(CloneEvent event)public void CloneAdapter.onCloned(CloneEve
58、nt event)2022-4-26史忠植 高級(jí)人工智能78 Cloning (continued)public class CloningExample extends Aglet boolean _theClone=false; public void onCreation(Object o) addCloneListener(new CloneAdapter() public void onCloning(CloneEvent e) / print to the console public void onClone(CloneEvent e) / print to the consol
59、e public void onCloned(CloneEvent e) / print to the console ); public void run() if (! _theClone) /the original runs here try clone(); catch (Exception e) System.out.println(e.getMessage(); else /the clone runs hererun()onCloning()onCloned()onClone()run()originalclone2022-4-26史忠植 高級(jí)人工智能79Mobility -
60、Dispatching - Retractingrun( )dispatch( )onDispatching( )onArrival( )run( )OriginDestinationretractAglet( )onArrival( )run( )run( )onReverting( )Local Remote2022-4-26史忠植 高級(jí)人工智能80Persistence Persistencerun( )deactivate( )onDeactivating( )onActivation( )run( )BeforeAfterAglet ContextDeactivateActivate2022-4-26史忠植 高
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度股權(quán)投資合同模板
- 2025年度包裝設(shè)計(jì)師勞動(dòng)合同升級(jí)版
- 二零二五年度辣椒種植與農(nóng)業(yè)電商孵化基地合作合同
- 2025年度科技產(chǎn)品借款抵押研發(fā)合作合同
- 二零二五年度房產(chǎn)買賣履約保證金合同
- 二零二五年度環(huán)保木業(yè)生產(chǎn)設(shè)備租賃合同協(xié)議4篇
- 2025年農(nóng)行個(gè)人貸款合同模板2篇
- 二零二五年度體育場(chǎng)館租賃與賽事場(chǎng)地標(biāo)識(shí)系統(tǒng)建設(shè)合同
- 2025年度綠色生態(tài)農(nóng)業(yè)園建設(shè)與管理合同4篇
- 二零二五年度個(gè)性化廚具安裝與整體廚房設(shè)計(jì)合同3篇
- 2025年度部隊(duì)食堂食材采購與質(zhì)量追溯服務(wù)合同3篇
- 新人教版一年級(jí)下冊(cè)數(shù)學(xué)教案集體備課
- 消防產(chǎn)品目錄(2025年修訂本)
- 地方性分異規(guī)律下的植被演替課件高三地理二輪專題復(fù)習(xí)
- 繪本 課件教學(xué)課件
- 光伏項(xiàng)目風(fēng)險(xiǎn)控制與安全方案
- 9.2提高防護(hù)能力教學(xué)設(shè)計(jì) 2024-2025學(xué)年統(tǒng)編版道德與法治七年級(jí)上冊(cè)
- 催收培訓(xùn)制度
- 牧場(chǎng)物語-礦石鎮(zhèn)的伙伴們-完全攻略
- ISO 22003-1:2022《食品安全-第 1 部分:食品安全管理體系 審核與認(rèn)證機(jī)構(gòu)要求》中文版(機(jī)翻)
- 農(nóng)業(yè)生產(chǎn)質(zhì)量安全風(fēng)險(xiǎn)評(píng)估與監(jiān)控方案
評(píng)論
0/150
提交評(píng)論