Presentation is loading. Please wait.

Presentation is loading. Please wait.

高级人工智能 第十四章 分布智能 (二) 史忠植 中国科学院计算技术所 2018/11/19 史忠植 高级人工智能.

Similar presentations


Presentation on theme: "高级人工智能 第十四章 分布智能 (二) 史忠植 中国科学院计算技术所 2018/11/19 史忠植 高级人工智能."— Presentation transcript:

1 高级人工智能 第十四章 分布智能 (二) 史忠植 中国科学院计算技术所 2018/11/19 史忠植 高级人工智能

2 内容提要 概述 MAGE简介 主体建模 开发平台 运行平台 移动主体 应用 2018/11/19 史忠植 高级人工智能

3 概述 http://www.agentlink.org/resources/agent-software.php
Agent Software Total: 116 MAGE: Multiagent development environment is an integrated tool suite for constructing multiagent systems 2018/11/19 史忠植 高级人工智能

4 AgentCities Beijing! 2018/11/19 史忠植 高级人工智能

5 MAGE简介 Multi-AGent Environment 面向主体的软件开发、集成和运行环境
目标 面向主体的软件开发、集成和运行环境 功能 实现基于主体的应用集成(软件重用的最佳解决方案) 主要特点 分布式计算平台 多种软件重用方案 多种主体生成方式 图形用户界面、强大的管理功能 丰富的行为模板、主体行为调度模型 2018/11/19 史忠植 高级人工智能

6 MAGE的总体结构 需求分析 系统设计 系统开发 / 主体生成 行为层 主体层 主体社会 主体统一建模平台AUMP
可视化主体开发环境VAStudio MAGE 运行环境 需求分析 系统设计 系统开发 / 主体生成 行为层 主体层 主体社会 系统部署、运行 2018/11/19 史忠植 高级人工智能

7 MAGE 主体系统结构 Agent kernel Function Function Component Module Sensor
Interface Resource Database Engine Communicator Scheduling Function Component Plug-INs Reasoning Negotiation Co-Operation others Plug-in Manager Task Database 2018/11/19 史忠植 高级人工智能

8 情感智能主体结构 规划 传感器 信念 情感推理机 环境 情感知识库 理性推理机 效应器 意图 愿望 2018/11/19
史忠植 高级人工智能

9 主体工作周期 2018/11/19 史忠植 高级人工智能

10 主体统一建模平台AUMP AUMP:Agent Unified Modeling Platform
功能:为需求分析和系统设计提供可视化的建模支持 类比: UML(统一建模语言)建模工具:Rational Rose AUML(主体统一建模语言)建模平台:AUMP AUMP建模结果例 2018/11/19 史忠植 高级人工智能

11 多主体系统设计过程 用例模型 功能描述 活动模型 反应规则模型 推理模型 行为描述 状态机模型 交互协议模型 规划模型 组织关系模型
主体类模型 主体描述 本体模型 本体描述 部署模型 配置描述 2018/11/19 史忠植 高级人工智能

12 UML中的表示法(抽象语法) OMG发布的UML定义规范中,模型的抽象语法是通过类图表示的各结构成分之间的关系给出的。
2018/11/19 史忠植 高级人工智能 UML中用例包的抽象语法

13 UML中的表示法(静态语义) 模型结构成分之间的约束(即静态语义)是通过OCL语言描述的规则表示的。
例如:Actor只能与UseCase、Subsystem和Class发生关联,并且关联是二元的。此约束表示如下: self.associations -> 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) ) ) 2018/11/19 史忠植 高级人工智能

14 AUMP 主体 交互 主体系统结构 本体 AUML 主体 类型图 系统 配置图 系统 结构图 本体图 协议图 角色图 UML 类图 分布图
协作图 2018/11/19 史忠植 高级人工智能

15 AUML扩展UML 在AUML中,我们引入了四种面向主体的图来描述一个多主体系统:
本体图:定义用来描述世界状态用到的实体以及它们之间的关系。 主体系统结构图:描述多主体系统的结构。 协议图:描述主体之间的交互协议。 角色图:描述主体在交互中扮演的角色。 2018/11/19 史忠植 高级人工智能

16 AUMP的表示法(属性图) AUML的图形模型都是属性图。属性图是带属性的多重有向图。 属性图的形式化定义如下:
AttributeGraph=(V, E, s, d, ) s,d:EV :(E∪V)(AU) 其中,V是节点集合,E是边的集合,s,d是边到节点的函数,分别表示边的起点和终点。 是边和节点到属性描述的函数,属性描述是属性名称到属性值的函数,A表示属性名称集合,U表示属性值集合。 属性图由多重有向图的节点和边添加属性描述得到 2018/11/19 史忠植 高级人工智能

17 AUMP的表示法(Meta表示法) 聚集产生式:表示一个构造有固定数目的成分。
(1)构造的有限集合。 (2)产生式的有限集合,每个产生式和一个构造对应。 聚集产生式:表示一个构造有固定数目的成分。 例Conditional = test:Boolean_expression; thenbranch: Command; elsebranch:Command; 选择产生式:表示一个构造可以选择几种类型。 例Command = Skip | Assignment | Compound | Conditional | Loop 表产生式:表示一个构造是另一个构造的实例序列。 例Compound = Command+ 属性图由多重有向图的节点和边添加属性描述得到 2018/11/19 史忠植 高级人工智能

18 AUMP的表示法(结合属性图和Meta表示法)
基本思想:将模型、节点、边、属性都看作构造,模型是非终结构造,节点、边和属性是终结构造,模型通过一定的产生式由节点、边和属性构成。 扩充:扩充Meta表示法表示属性图中的函数关系。因为函数关系是实体到另外实体的映射关系,而不是构造关系。所以,符号 = 仍然表示构造关系,新加入符号  表示函数关系。如:状态机模型中的转移描述为: Transition  sourcestates; targetstates; rule:ECARule 如果t是Transition的一个实例,那么用tsource,ttarget, t.rule来表示t的起点、终点和转移规则。 属性图由多重有向图的节点和边添加属性描述得到 2018/11/19 史忠植 高级人工智能

19 AUMP的表示法(状态机模型的抽象语法)
状态机模型由状态集合、目标集合、转移集合、驱动集合构成: StateChartModel = states: StateSet; goals: GoalSet; transitions: TransitionSet; drives: DriveSet; StateSet = {State}; GoalSet = {Goal}; TransitionSet = {Transition}; DriveSet = {Drive}; 状态是起始状态、结束状态和一般状态之一: State = Initial | Final | CommonState; 转移连接两个状态实例,并且有一条ECA规则描述: Transition  sourcestates; targetstates; rule:ECARule; ECA规则由事件、条件和动作构造: ECARule = event: Event; condition:Condition; action:Action; 驱动连接目标实例和状态实例: Drive  goalgoals; statestates; 属性图由多重有向图的节点和边添加属性描述得到 2018/11/19 史忠植 高级人工智能

20 AUMP的表示法(静态语义的表示) 通过前面的表示法,已经将模型的抽象语法表示成为了集合和关系的形式,那么就可以用集合表示法中的各种约束表示法来描述模型的静态语义。 例如,状态机模型中起始状态的合法性描述为:有且只有一个起始状态;起始状态有离开的转移,没有进入转移;离开起始状态的转移的ECA规则中事件和条件为空。 形式化描述如下: 属性图由多重有向图的节点和边添加属性描述得到 2018/11/19 史忠植 高级人工智能

21 活动图动态语义简介 活动图为主体工作流建模,是描述主体行为最常用的方式。因此,活动图动态语义研究是AUML动态语义研究的重要组成部分。
活动图描述的是工作流的过程维度,即活动在时间上的先后顺序,而不考虑资源维度。 AUML在语法上对活动图并没有扩充,而是从语义上需要对UML定义的活动图语义进行扩充。 2018/11/19 史忠植 高级人工智能

22 活动图的语法 活动图是一个有向图,包括节点和有向边。 Activity节点表示一个活动的执行。 Wait节点表示等待某个事件的出现。
start end decision/merge fork/join wait 活动图中的节点 compound activity Activity节点表示一个活动的执行。 Wait节点表示等待某个事件的出现。 2018/11/19 史忠植 高级人工智能

23 主体统一建模平台AUMP 功能:为需求分析和系统设计提供可视化的建模支持 类比: UML(统一建模语言)建模工具:Rational Rose
AUMP:Agent Unified Modeling Platform 功能:为需求分析和系统设计提供可视化的建模支持 类比: UML(统一建模语言)建模工具:Rational Rose AUML(主体统一建模语言)建模平台:AUMP 在AUMP上建模 fork/join表示并发结构,decision/merge表示分支结构。 边实际上是一条ECA规则e[c]/a,其中e是事件表达式,c是限制条件,a是动作表达式。这三个部分每个都是可选的。具有e[c]/a标记的边具有如下含义:如果系统处于源状态,事件e出现,并且限制条件c满足,那么系统离开源状态,执行动作a,进入目标状态。 2018/11/19 史忠植 高级人工智能

24 活动图的语义(执行算法) 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 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 there are no enabled edges; End while ; 2018/11/19 史忠植 高级人工智能

25 执行示例 有了动态语义,活动图就可以被执行。例如: 工作流描述(活动图) 运行 Run1 Run2 Run3 Initial State
{Activity1} State1 Activity1 Terminates {Output1} State2 {Input1} State3 State4 {Activity3} Output1 Input1 Activity3 {Activity2, Activity4} Activity2 Activity4 Run1 Run2 {Activity4} Run3 {Activity2} 运行 Activity1 Condition1 Output1 Input1 Activity2 :Goal1 Activity3 Condition2 Activity4 Role1 Role2 工作流描述(活动图) 2018/11/19 史忠植 高级人工智能

26 AUMP 界面 2018/11/19 史忠植 高级人工智能

27 AUMP对于UML 的支持、重用 目前很多仍采用Rational Rose等平台,进行面向对象的设计(O-O),为了支持UML, 我们提供了对于UML 的支持。它具有通用性,适用于广泛应用领域的大规模软件系统设计。因此,除了支持描述多主体系统的自主性、主动性外,AUMP支持UML1.x的用例图、状态图、活动图、协作图、部署图等的绘制 2018/11/19 史忠植 高级人工智能

28 计算模型 主体 请求/服务 交互关系: 请求/服务 特点: 网络化 分布式 软总线 开放式 主体服务 2018/11/19
史忠植 高级人工智能

29 面向主体的软件开发环境 大型软件系统CARBA 主体领域模式 AppPattern 主体应用框架 AppFacilities
主体服务 AgentServices 2018/11/19 史忠植 高级人工智能

30 可视化主体开发工具 VAStudio 系统结构
Agent Society Agents Agent Library Behaviours Behaviour Library Editor 2018/11/19 史忠植 高级人工智能

31 VAStudio系统界面 2018/11/19 史忠植 高级人工智能

32 行为库 数据包 package intsci.ace.data 神经网络包 package intsci.ace.neural 学习包
package intsci.ace.learning 数据挖掘包 package intsci.ace.mining 语言处理包 package intsci.ace.language 2018/11/19 史忠植 高级人工智能

33 行为库 图形处理包 package intsci.ace.graphics 图象处理包 package intsci. ace .image
搜索引擎包 package intsci.ace.search 专家系统包 package intsci.ace.expert 模型包 package intsci.ace.model 决策支持包 package intsci.ace.decision 2018/11/19 史忠植 高级人工智能

34 可视化主体开发工具VAStudio 功能:可视化的多主体系统设计环境 VAStudio:Visual Agent Studio
当前主体社会中的主体、行为 2018/11/19 史忠植 高级人工智能

35 行为库中的已有行为,包括数据访问、神经网络算法、机器学习算法、数据挖掘算法、画图接口、推理引擎、数值计算模型等
可视化主体开发环境VAStudio VAStudio:Visual Agent Studio 功能:可视化的多主体系统设计环境 行为库中的已有行为,包括数据访问、神经网络算法、机器学习算法、数据挖掘算法、画图接口、推理引擎、数值计算模型等 2018/11/19 史忠植 高级人工智能

36 用VAStudio编写一个主体例(1) 1. 加入行为库中的现有行为 2018/11/19 史忠植 高级人工智能

37 用VAStudio编写一个主体例(2) 2. 填写行为参数 2018/11/19 史忠植 高级人工智能

38 用VAStudio编写一个主体例(3) 3. 主体编辑完成,代码已自动生成 2018/11/19 史忠植 高级人工智能

39 用VAStudio编写多主体应用系统(1)
拍卖、竞拍系统 1. 编写拍卖发起主体(即拍卖方):采用有限状态自动机方式,画出状态图转换并指定通信方式即可,代码将自动生成 2018/11/19 史忠植 高级人工智能

40 用VAStudio编写多主体应用系统(2)
2. 编写两个拍卖响应主体(即竞拍方):同样采用有限状态机方式,两个同样的竞拍主体可以直接复制得到 2018/11/19 史忠植 高级人工智能

41 用VAStudio编写多主体应用系统(3)
3.拍卖系统开发完成,编译通过 2018/11/19 史忠植 高级人工智能

42 用VAStudio编写多主体应用系统(4)
4. 在MAGE运行环境中运行系统 2018/11/19 史忠植 高级人工智能

43 用VAStudio编写多主体应用系统(5)
运行结果(1): 一个竞拍主体的运行过程 2018/11/19 史忠植 高级人工智能

44 用VAStudio编写多主体应用系统(6)
运行结果(2): 拍卖主体的运行过程 2018/11/19 史忠植 高级人工智能

45 构建主体 mage.core.behaviours.* mage.core.Agent 简单行为组合复杂行为 各种类型Behaviour
在主体setup中添加行为 addBehaviour 简单行为组合复杂行为 流程图 FSM 2018/11/19 史忠植 高级人工智能

46 构建主体 OneShotBehaviour CyclicBehaviour SequentialBehaviour
SimpleBehaviour OneShotBehaviour CyclicBehaviour CompositeBehaviour SequentialBehaviour ParallelBehaviour FSMBehaviour 2018/11/19 史忠植 高级人工智能

47 主体间通信结构 2018/11/19 史忠植 高级人工智能

48 主体通信语言(ACL) ACL 通信模块 并发对话机制 2018/11/19 史忠植 高级人工智能

49 主体通讯 2018/11/19 史忠植 高级人工智能

50 主体通讯 mage.lang.acl.* 通讯必须通过主体进行 行为中发送或者接受消息 ACLMessage MessageTemplate
发送消息send 接收消息receive或blockingReceive 行为中发送或者接受消息 通过所属主体实例myAgent 2018/11/19 史忠植 高级人工智能

51 ACL 构造 2018/11/19 史忠植 高级人工智能

52 消息传输系统 MTS (Message Transport System)
MAGE运行平台体系结构 MAGE 主体管理系统AMS 目录服务主体DF 主体 消息传输系统 MTS (Message Transport System) 软件 主体库 功能构件 其它主体平台 2018/11/19 史忠植 高级人工智能

53 Directory Facilitator
What is Directory Facilitator and why dose MAGE need DF. What can be done through DF? View Register Deregister Modify Search Federal search 2018/11/19 史忠植 高级人工智能

54 GUI of DF 2018/11/19 史忠植 高级人工智能

55 MAGE GUI 2018/11/19 史忠植 高级人工智能

56 主体容器 container Providing plenty of agent management function: createAgent, suspendAgent, resumeAgent, waitAgent, wakeAgent changeAgentPrincipal, changeContainerPrincipal, moveAgent, copyAgent, killAgent, dispatch, ping, installMTP, uninstallMTP, enableSniffer, disableSniffer, 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 ContainerFrame 2018/11/19 史忠植 高级人工智能

57 MAGE 工具 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 service 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. 2018/11/19 史忠植 高级人工智能

58 DummyAgent 2018/11/19 史忠植 高级人工智能

59 Sniffer 2018/11/19 史忠植 高级人工智能

60 移动主体 Mobility in MAGE platform
Supports user-defined content language and ontology. Inter-operation between MAGE and other agent or non-agent software. …… 2018/11/19 史忠植 高级人工智能

61 Introduction 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 object 2018/11/19 史忠植 高级人工智能

62 Network Computing Paradigms
Client-Server Paradigm Code-onDemand Paradigm Download (Applet) Server Know how Server Client Client Know- how Know- how Mobile Agent Paradigm Agent Agent Network Know- how Know- how Host Host 2018/11/19 史忠植 高级人工智能

63 Compare Client/Server & Mobile Agent Model
Limitation of Client/Server Scaling -- Multiple servers Quality of network connection Reliability , latency , bandwidth Protocol Advantage of Mobile Agents Every node is a server Request Network connection No application-level protocol 2018/11/19 史忠植 高级人工智能

64 Mobile Agents 优点 Reduce network load Overcome network latency
Encapsulate protocols Execute asynchronously and autonomously Adapt dynamically Naturally heterogeneous Fault-tolerant 2018/11/19 史忠植 高级人工智能

65 Mobile Agent Systems Java-based: Others: Odyssey. General Magic Inc.
Concordia. Mitsubishi’s Aglets. IBM Voyager. ObjectSpace Others: Tacoma: Univ.of Tromso and Cornell Univ. Agent TCL: Dartmouth College 2018/11/19 史忠植 高级人工智能

66 Mobile Agent Model Key concepts: Agent Place
-- the main entity in Mobile Agent System Place -- the environment where agents operate 2018/11/19 史忠植 高级人工智能

67 Agent State: Implementation: Interface Identifier Principals
needed for resume computation after traveling Implementation: needed for location-independent agent execution Interface needed for agent communication Identifier needed for recognize and locate traveling agents Principals needed to determine legal and moral responsibility 2018/11/19 史忠植 高级人工智能

68 Place Engine Resources Location Principals
Workhorse and virtual machines for one or more places Resources Databases,processors,and other services provided by the host Location The network address of a given place Principals Those legally responsible for the opration of a place 2018/11/19 史忠植 高级人工智能

69 The Agent Model Pyramid
Host Engines Places Agents 2018/11/19 史忠植 高级人工智能

70 Place and Engine Host Agent Place Resources Engine 2018/11/19
史忠植 高级人工智能

71 Agent Behavior(1) Creation and Disposal
Instantiation and identifier assignment Initialization Autonomous execution Disposal Preparing for disposal Suspension of execution 2018/11/19 史忠植 高级人工智能

72 Agent Behavior(2) Transfer – dispatching/receiving
Dispatch and Receive: Sender Receiver Suspend Execution Resume Execution Serialize Agent Deserialize Agent Encode Data Decode Data Transfer Data Receive Data Network 2018/11/19 史忠植 高级人工智能

73 Agent Behavior(2) Transfer – agent class transfer
Server Class code Class at Server(code on demand) Origin Server Agent Agent Class code Class code Class at origin Class at destination 2018/11/19 史忠植 高级人工智能

74 移动主体系统—Telescript Telescript平台是用Telescript语言来完成的,该语言是一种用于开发大型分布式系统的面向对象的解释性语言,它有点类似于Java和C++,可以被编译成字节码运行在宿主机的虚拟机上。Telescript Agent之间的通信有两种方式:两个Agent运行在同一个空间,互相调用对方的方法;在不同的空间之间建立连接,两个Agent可以相互传递对象。尽管Telescript是一个比较成功的移动Agent平台,它的安全性,容错性,执行效率都非常好,但是由于Java的迅速流行,必然导致它的失败。 2018/11/19 史忠植 高级人工智能

75 移动主体系统—D’Agent D’Agent(以前称为Agent Tcl)是美国Dartmouth大学研究的移动Agent系统。它从支持单一语言Tcl发展到目前支持多种语言:Tcl,Java,Scheme.D’Agent提供一个go指令(仅适用于Tcl和Java),可以自动捕获和恢复移动Agent的完整状态,即意味着Agent可以在任意点中断执行,然后移动到其他环境中执行。D’Agent服务程序的实现采用的是多线程方式,相比于多进程方式,虽然实现难度增加,但是进程间通信大大降低,提高了系统的执行效率。D’Agent采用公钥系统来管理Agent对资源的访问,但是可以授权访问某种资源,还可以限制使用(如:CPU使用超时)。D’Agent的通信方式可采用RPC,RMI等不同的方式,而且支持异步或同步的通信模式。 2018/11/19 史忠植 高级人工智能

76 移动主体系统—Grasshoper Grasshoper是IKV++公司的产品。Grasshoper环境包括Agent处(Agency)和域注册器,通过专有的ORB(Grasshoper ORB)互联。Agency(相当于MASIF中的Place)是Agent实际的运行环境,数个Agency结合构成域,由域注册器(相当于MASIF中的MAFFinder)提供名字服务。Grasshoper的通信基础设计非常巧妙,可以通过CORBA来进行通信,还可以通过Java RMI和Socket连接进行通信,整个通信结构实现采用插件技术,具有很好的扩充性,并同时支持异步或同步的通信,动态消息机制和多点发送。Grasshoper的安全服务中采用X.509证书实现身份认证,采用SSL来保证传输中的安全性,通过用户定制的安全管理器来完成资源访问控制,并实现了数字签名。 2018/11/19 史忠植 高级人工智能

77 移动主体系统—Voyager Voyager 的最大特点是以Voyager ORB作为核心,将Agent和分布式计算紧密结合在一起的。但Voyager 只支持纯Java的对象的通信,与CORBA和MASIF不兼容,它还支持异步或同步的通信,动态消息机制和单向多点发送。在容错服务方面,Voyager支持任意时间的显式地存储,其安全机制主要是通过Voyager Security类进行编程设置。 2018/11/19 史忠植 高级人工智能

78 移动主体系统— Aglet Aglet是由IBM公司用纯Java开发的移动Agent技术,并提供着实用的平台—Aglet Workbench,让人们开发或执行移动Agent系统。Aglet是一个较为成功和全面的系统,主要表现在:它提供了一个简单而全面的移动Agent编程模型;它为Agent间提供了动态和有效的通信机制;它还提供了一套详细且易用的安全机制。 2018/11/19 史忠植 高级人工智能

79 Aglet的系统框架 2018/11/19 史忠植 高级人工智能

80 ATP的示意图 2018/11/19 史忠植 高级人工智能

81 Aglet对象模型 Aglet系统首先提供一个上下文环境(context)来管理Aglet的基本行为:如创建(create)Aglet,复制(clone)Aglet,或分派(dispatch)Aglet到远程机器,召回(retract)远端的Aglet,或暂停(deactive),唤醒(active)Aglet,以及清除(dispose)Aglet等。见下图。 2018/11/19 史忠植 高级人工智能

82 Aglet 生命周期模型 Fundamental operations: Creation Cloning Dispatching
Retraction Activation and deactivation Disposal Dispose Context A Context B Clone Dispatch Aglet Aglet Retract Create Deactivate Activate Disk storage Class File 2018/11/19 史忠植 高级人工智能

83 Aglet的生命周期模型 2018/11/19 史忠植 高级人工智能

84 Aglet之间的通信 Aglet与Aglet之间的通信,则可用消息传递的方法来传递消息对象。此外,基于安全上的考虑,Aglet并非让外界直接存取其信息,而是透过一个代理(proxy)提供相应的接口与外界沟通(见图4)。这样做的好处,Aglet的所在位置会透明化,也就是Aglet想要与远端的Aglet沟通时,只在本地主机上的上下文环境中产生对应远端Aglet的代理,并与此代理沟通即可,不必直接处理网络连接与通讯的问题。 2018/11/19 史忠植 高级人工智能

85 Aglet基本通信模型 2018/11/19 史忠植 高级人工智能

86 Aglet Workbench Aglet Workbench是一可视化环境,它被用来建立使用移动Agent的网络应用。它提供的工具包括:移动Agent Aglet框架,ATP, JDBC,JoDax, Tazza, Tahiti,Fiji等。 2018/11/19 史忠植 高级人工智能

87 Aglet的程序包 Com.ibm.aglet: Com.ibm.aglet.event: Com.ibm.aglet.system
Com.ibm.aglet.util: Com.ibm.aglet.patterns: 2018/11/19 史忠植 高级人工智能

88 Aglet中的设计模板 模板就是从系统中抽象提取出来的一些具有共性的东西,以便于重用。这一观念现已被许多行业在设计复杂系统时有效地采用。模板通常是用意图,动机,适合场合,参与者,合作性和结论等多个成分来描述。对于Agent系统,设计模板只要有三大类,每一大类中又包括一些子类。 2018/11/19 史忠植 高级人工智能

89 巡行模板(travelling) 巡行是移动Agent的本性,巡行样式处理移动时各方面的问题,如路由服务和服务质量。其子类有:
巡行路线(itinerary)模板:负责到达目的地的路由,它维护着所有目的地的列表,定义了路由策略,并能处理异常情况。 发送(forwarding)模板:提供发送所有的或者特定的Agent到远端机器的机制。 标签(ticket)模板:负责管理服务质量,权限等为题。 2018/11/19 史忠植 高级人工智能

90 任务模板(task) 它主要负责任务的分解,以及怎样把任务分派给不同的Agent去执行。其子类有:
主从(master-slave)模板:一种基本的样式,提供允许主Agent把任务委派给从Agent,从Agent移动到指定的目的地,完成指定的任务后返回结果的机制。 规划(plan):用工作流的方式策划,来让多个任务顺序或者并行地在多个Agent上执行。 2018/11/19 史忠植 高级人工智能

91 交互模板(interaction) 它提供定位Agent的机制以及方便Agent间交互的一些机制。其子类有: 会议(meeting)模板
寄存柜(locker)模板 信使(messenger)模板 服务设施(facilitator)模板 组织化的群体(organized group)模板 2018/11/19 史忠植 高级人工智能

92 Aglet安全性 Aglet系统中的安全主要涉及主机对Aglet的攻击,Aglet之间的攻击,Aglet对主机的攻击,以及来自底层网络的攻击。Aglet Workbench目前主要支持前面两种攻击的预防。以下简要分析Aglet系统的安全对策。 2018/11/19 史忠植 高级人工智能

93 Aglet安全性 对用户和域的认证: 数据完整性检查: 另外还有类似jdk安全模型的授权。 2018/11/19 史忠植 高级人工智能

94 Aglet API : Aglet Class Create a customized aglet: Overriden methods:
import com.ibm.aglet.*; Public class MyFirstAglet extends Aglet{ //put aglet’s methods here } Overriden methods: public void onCreation(Object init){ //do some initialization here… public void run() { //do something here; }//main entry point //e.g. call dispatch(new URL(“atp://some.host.com//context”)); The aglet class is the key class in the Aglet API. It is the abstract class that aglet developer can use as base class when creating customized aglets. The aglet class defines methods for controlling its own life cycle: methods for cloning, dispatching, deactivating ,and disposing of itself. It also defines methods that are supposed to be overridden by programmer in order to customize the aglet’s behavior. These methods are systematically invoked by the system when certain events take place—remember that aglet programming model is event-based. Now look at some methods in aglet class. First we start with importing the aglet package, and then define the MyFirstAglet class, which inherits from the Aglet class. For example, we want our aglet to perform some specific initialization when it is created, we can override the “onCreation” method. When an aglet has been created or when it arrives in a new context, it’s given its own thread of execution through a system invocation of its “run” method. We can look on this invocation as a means of giving the aglet a degree of autonomy. The run method is called every time when an aglet arrives at or is activated in a new context, you can say it becomes the main entry point for the aglet’s thread of execution. By overriding this method, we can customize the aglet’s autonomous behavior. For example, we want the aglet to dispatch itself to a remote context, then we can call the dispatch method, with the URL of the remote host as the argument. This URL should specify the host and domain names of the destination context and the protocol(atp) to be used for transferring the aglet over network. URL can also include the name of the remote context. If no context name specified, it will move into the default context. 2018/11/19 史忠植 高级人工智能

95 Aglet API :Aglet Class What happens when “dispatch”?
State Object Serialization Transfer Deserialization and re-create state Byte Code Host Host Sending Receiving What happens to aglet when dispatch() is called? Basically the aglet will disappear from your machine and will reappear in the same object state at the specified destination. A special technique called object serialization is used to preserve the state information of the aglet. It makes a sequential byte representation of the aglet. It’s passed to the underlying transfer layer, which brings the aglet over the network. Here the aglet actually transferred is byte code and state information The transferred bytes are deserialized to recreate the aglet’s state. State Byte Code Host Host 2018/11/19 史忠植 高级人工智能

96 Aglet API : AgletProxy Why AgletProxy? How to get a proxy?
Acts as a shield object that protects an aglet from malicious aglets 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 AgletContext.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. The agletproxy interface acts as the handle of an aglet and provides a common way of accessing the aglet. Because an aglet class has several public methods that should not be accessed directly from other aglets for security reasons, any aglets that wants to communicate with other aglets must first obtain the proxy and then interact through this interface. IN other word, aglet proxy acts as a shield object that protects an aglet from malicious aglets. Another important role of the Agletproxy interface is to provide the aglet with location transparency. If the actual aglet resides at a remote host, the proxy forwards the requests to the remote host and returns the result to the local host. Creating an aglet is one way to get a proxy. The AgletContext.createAglet method will return the proxy of the newly created aglet. Other methods that return proxies include AgletContext.retractAglet, AgletProxy.clone, and AgletProxy.dispatch. Proxies of existing aglets can also be obtained in the following ways: Aglet.getProxy – AgletContext.getAgletProxies— AgletContext.getAgletProxy Get an aglet proxy via message passing. An agletProxy object can be put into a message object as an argument and sent to the aglet locally or remotely Put an agletproxy object into a context property by using the agletcontext.setProperty method and share the proxy object. 2018/11/19 史忠植 高级人工智能

97 Aglet API : AgletContext
An aglet context is the equivalent of a place. An aglet uses AgletContext interface to: 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); An aglet context is the equivalent of a place. An aglet spends most of its life in an aglet context. It is created in the context, it goes to sleep there, and it dies there. When it travels in a network, it moves from context to context. In other word, the context is a uniform execution environment for aglets. An aglet uses AgletContext interface to get information about its environment and to send message to the environment, including other aglets currently active in that environment. This interface provides means for maintaining and managing running aglets in an environment where the host system is secured against malicious aglets The aglet class has a method for gaining access to its current context: 2018/11/19 史忠植 高级人工智能

98 Aglet API : Message Class
Aglets communicate by exchanging objects of the Message class. “kind” field: distinguishes messages Message 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 msg) Void sendOnewayMessage(Message msg) 2018/11/19 史忠植 高级人工智能

99 Aglet API : Message Class
handleMessage 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.sendReply(“Yina”); //Return its name } else return false; //No, I did not handle this message } 2018/11/19 史忠植 高级人工智能

100 Aglet API : AgletID Class
Identity: Globally unique Throughout lifetime AgletID object Hides the implementation-specific representation Immutable Use : AgletID aid=proxy.getAgletID(); proxy=context.getAgletProxy(aid); 2018/11/19 史忠植 高级人工智能

101 Anatomy of an Aglet Creation & Disposal Clone Mobility Persistence
– Dispatch and Retract Persistence – Activate and Deactive 2018/11/19 史忠植 高级人工智能

102 Creation public final AgletContext Aglet.getAgletContext()
//Example: getAgletContext().createAglet(getCodeBase(),”SomeAglet”,null); Methods that can be overridden protected Aglet.Aglet() Public void Aglet.onCreation(Object init) Public void Aglet.run() To do anything with an aglet we must first create it by instantiating it from an aglet class or cloning an existing aglet. Firstly we take a look at create. Remember that aglet is created in a context, where it will spend most of its life. You can look on a context as a uniform environment for the aglet, no matter the aglet is executing on a PC with Windows or on a UNIX workstation, it’s guaranteed a fixed set of services from the context. One of the services, which we are going to demonstrate, is instantiation of new aglets from a given aglet class. For an aglet to instantiate new aglets it needs to access its current context first, by calling the getAgletContext method. This method has three arguments. The first one, which defines the code base of the aglet, is a URL, which specifies the base URL of the aglet class file. In other words, the directory that contains the aglet’s code, where the directory might be a remote one. If this argument is null, it is the local host’s aglet search path to be specified, as a similar way to Java’s class path. The second is the name of the aglet class(code), and the third consists of a possible initialization argument . Note that do not attempt to instantiate an aglet directly from its constructor by using the new statement in Java. All aglets instances must be properly initialized after instantiation. Although the aglet context will control the creation of new aglet, there are several hooks that programmer can use to customize the behavior of the aglet during its creation. That is, there are some methods we can override to implement the desired behavior. Here are three of particular interest here, the aglet’s constructor, on Creation, and run. As I mentioned earlier, these methods are automatically invoked by the context during the creation of the aglet. Now we use the collaboration diagrams to illustrate this mechanism. First, the createAglet method in the aglet context is called. The top most horizontal bar represents its execution. During the execution, createAglet will create an instance of the given aglet class, which is seen as an invocation of the aglet’s constructor. When the aglet instance has been constructed, on Creation is invoked, and when that has been executed, run is invoked. createAglet() Aglet() onCreation run() 2018/11/19 史忠植 高级人工智能

103 Disposal public final void Aglet.dispose();
public void Aglet.onDisposing(); Dispose() onDisposing() run() 2018/11/19 史忠植 高级人工智能

104 Event Event Types: Delegation-Based Event Mode CloneEvent
MobilityEvent PersistencyEvent Delegation-Based Event Mode CloneListener CloneAdapter MobilityListener MobilityAdapter PersistencyListener PersistencyAdapter 2018/11/19 史忠植 高级人工智能

105 Cloning Public final Object Aglet.clone()
Public final 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(CloneEvent event) 2018/11/19 史忠植 高级人工智能

106 Cloning (continued) run() original onCloning() onCloned() onClone()
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){ public void onCloned(CloneEvent e){ } ); } public void run() { if (! _theClone) { //the original runs here… try{ clone(); } catch (Exception e) { System.out.println(e.getMessage()); } else {//the clone runs here…} run() original onCloning() onCloned() onClone() clone run() 2018/11/19 史忠植 高级人工智能

107 Mobility -- Dispatching -- Retracting Origin Destination Local Remote
run( ) Origin dispatch( ) onDispatching( ) onArrival( ) Destination run( ) retractAglet( ) Local onArrival( ) run( ) run( ) Remote onReverting( ) 2018/11/19 史忠植 高级人工智能

108 Persistence Persistence Aglet Context Activate Deactivate Before After
run( ) Before deactivate( ) onDeactivating( ) onActivation( ) After run( ) 2018/11/19 史忠植 高级人工智能

109 Inside Aglets … Architecture Overview Aglet API Aglet Runtime Layer
Services and User-defined aglets Aglet API Aglet Runtime Layer Core Framework Management Components CacheManager SecurityManager PersistanceManager Communication API Communication Layer 2018/11/19 史忠植 高级人工智能

110 Communication Layer Communication API Agent Transfer Protocol(ATP)
An ATP request consists of : a request line, header fields, content. Four standard request method: Dispatch Retract Fetch Message ATP ATP Host Host HTTP HTTP Tunneling of ATP 2018/11/19 史忠植 高级人工智能

111 Aglet Security Principal Permissions Protection Policy & Authority
Context & Server Network Domain Permissions Protection Policy & Authority Aglet owner Context owner Network Domain owner 2018/11/19 史忠植 高级人工智能

112 MAGE 比较 Phase Agent Platform AgentBuilder Jack Zeus MAGE Analysis
AgentBuilder Jack Zeus MAGE Analysis Completeness: ★★★   ★★★ ★★★★ ★★★★★ Applicability: Complexity: Reusability Design ★★ Development ★★★★★★ Deployment ★★★ ★★★ ★★ 2018/11/19 史忠植 高级人工智能

113 应急联动与社会综合服务系统GEIS 城市应急联动 和社会综合服务系统 RDBMS ODBMS 主体网格智能平台AGrIP 有无线通信系统
联动中心终端设备 RDBMS ODBMS IFR… IVR CTI 呼叫管理中间件 支撑平台 RMS… 业务汇聚 MIS MAP CAD 中心辅助系统 其它… 防汛 医疗 市政 公安 专业应用系统 数据库系统 调度 大屏 监控 GPS 外部系统 指挥决策系统 指挥控制… 情报管理 预案管理 2018/11/19 史忠植 高级人工智能

114 GEIS系统结构 2018/11/19 史忠植 高级人工智能

115 成果应用亚洲宽带—异文化协作 NTT Communication (日本) Kyoto京都大学(日本) Wakayama和歌山大学(日本)
合作单位: NTT Communication (日本) Kyoto京都大学(日本) Wakayama和歌山大学(日本) Osaka大阪大学(日本) JST日本科技公司(日本) 中国科学院计算技术研究所(中国) 北京大学(中国) 2018/11/19 史忠植 高级人工智能

116 成果应用(2) 亚洲宽带—异文化协作 1 2 3 AMS DF Server Client Client MTS
成果应用(2) 亚洲宽带—异文化协作 MTS User Agent User Agent Agent Platform Chinese Academy of Science AMS DF 1 2 3 Kyoto U/Wakayama U Synchronous Collaboration Tool Synchronous Collaboration Tool P2P Collaboration Platform Asynchronous Collaboration Tool Machine Translation Morphological Analysis RDF DB User Management Asynchronous Collaboration Tool 2018/11/19 史忠植 高级人工智能 Server Client Client

117 成果应用-配电网故障恢复决策系统 恢复策略
2018/11/19 史忠植 高级人工智能

118 成果应用-战争仿真 决策训练 决策分析 武器体系 战略层 指挥训练 方案分析 武器系统 战役层 战术层 合成训练 合成分析 技能训练
武器运用 武器工程 技术层 “人” 2018/11/19 “方案” 史忠植 高级人工智能 “武器” 对象

119 成果应用--- 电子商务系统结构 Application Services SearchAgent BargainAgent
InfoAgent DF Agent AMS Agent RMA Agent Agent Platform Management MAGE JavaBean JSP Servlet Web Interface Agent Browser Users Resources DataBase Strategies Models Information 2018/11/19 史忠植 高级人工智能

120 成果应用--- 电子商务示范1 2018/11/19 史忠植 高级人工智能

121 成果应用--- 电子商务示范2 2018/11/19 史忠植 高级人工智能


Download ppt "高级人工智能 第十四章 分布智能 (二) 史忠植 中国科学院计算技术所 2018/11/19 史忠植 高级人工智能."

Similar presentations


Ads by Google