2009-8-20 史忠植 高级人工智能 1
第十章 分布式人工智能多主体环境 MAGE
史忠植中国科学院计算技术所
2009-8-20 史忠植 高级人工智能 2
内容提要
MAGE简介主体开发平台运行平台应用
2009-8-20 史忠植 高级人工智能 3
多主体环境 MAGE
MAGE系统作为构造多主体系统的平台,同时以构件组装的方法作为多主体系统的设计方法 。
屏蔽底层的细节。
较好的可扩展性,可以根据需求自己定制具有特定功能的主体 。
支持主体之间的并发性 。
主体的程序设计方法( AOP) 的一种探索。
2009-8-20 史忠植 高级人工智能 4
MAGE agent architecture
Agent
Sensor
Capabilities
Function Module
Interface
Agent
Knowledge
Base
Agent
Kernel
Communicator
Reasoning
Scheduling
Planing
Negotiation
Function
Component
2009-8-20 史忠植 高级人工智能 5
主体结构通信器主体通信语言解析器主体内核功能功能模块界面调度器主体描述语言解析器
C o m m u n i c a t o r
A gen t
M s g - In M s g - O u t
A C L P a r s e r
A g e n t K e r n e l
F u n c t i o n
1
F u n c t i o n
m
A C L M s g
D a t a
S c h e d u l e r
F u n c t i o n M o d u l e
I n t e r f a c e
A D L P a r s e r
2009-8-20 史忠植 高级人工智能 6
Agent Kernel Zhongzhi Shi
2009-8-20 史忠植 高级人工智能 7
MAGE agent life cycle
2009-8-20 史忠植 高级人工智能 8
主体工作流程 (1)
BEGIN
初始化主体内部数据;
读入 ADL脚本并进行分析,建立内部数据库;
装入功能模块,并启动相应执行线程;
初始化通信模块;
向 Facilitator发送注册信息;
2009-8-20 史忠植 高级人工智能 9
主体工作流程( 2)
REPEAT
接收线程:
检查消息队列;
如果消息队列为空,等待一段时间后继续检查;
消息解析,获取消息类型;
IF (消息是系统命令 ) THEN
直接由主体内核解释器执行;
ELSE
放入消息缓冲区等待相应的执行功能模块取走 。
2009-8-20 史忠植 高级人工智能 10
主体工作流程( 3)
发送线程
按照主体通信语言的格式封装需要发送的消息;
送交底端线程发送;
ENDREPEAT
END
2009-8-20 史忠植 高级人工智能 11
主体构建
—— multiple methods of agent generation
MAGE provide four methods of agent
generation
Behavior templates(Directly extends basic Agent
class of MAGE)
Agent Description Language (ADL)
Clone
FSM
2009-8-20 史忠植 高级人工智能 12
Plenty of behavior templates
What is behavior template? Why does MAGE provide so
many templates?
MAGE provides plenty of behavior templates for
developer to build their application
Agent behavior scheduling model
2009-8-20 史忠植 高级人工智能 13
Behavior templates
2009-8-20 史忠植 高级人工智能 14
Syntax of ADL(1)
<Agent>,:= <Definition>
<Local Address>
<Acquaintance Addresses>
<Extra Classes>
<Capabilities>
<Environment Variables>
<Sessions>
<Definition>,:= <Agent Name>
<Description >
<Agent Name>,:= "[Name]"
<agent> = <agent_name>
<Description>,:= "[Description]"
BEGIN
<description>
END
<Local Address>,:= "[Local Address]"
<agent> = <host_name>:<port>
2009-8-20 史忠植 高级人工智能 15
Syntax of ADL(2)
Acquaintance Addresses>,:= "[Acquaintance Address]"
BEGIN
{<acquaintance> = <host_name>:<port>}*
END
<Extra Classes>,:= "[Extra Classes]"
BEGIN
{<Class>}*
END
<Class>,:= Instance = <instance name>
CONSTRUCTOR = <constructor>
<Capabilities>,:= "[Capabilities]"
BEGIN
{<Capability>}*
END
<Capability>,:= NAME = <capability_name>
TYPE = <capability_type>
CMDLINE = <capability_command_line>
SOURCE = <capability_source>
<capability_type>,:= 0 | 1 | 2
2009-8-20 史忠植 高级人工智能 16
Syntax of ADL(3)
<Environment Variables>,:= "[Environment Variables]"
BEGIN
{<Variable>}*
END
<Variable>,:= <Variable Type> <variable_name>[ = <initial_value>]
<Variable Type>,:= int|boolean|char|string|float
<Sessions>,:= "[SESSIONS]"
BEGIN
{<Session>}*
END
<Session>,:= SESSION
<Java Sentences>
END SESSION
2009-8-20 史忠植 高级人工智能 17
主体间通信结构
Soft B U S
A gent
1
A gent
2
A gent
n
F aci l i t at or
2009-8-20 史忠植 高级人工智能 18
主体通信语言( ACL)
ACL
通信模块
并发对话机制
S oc k et Int erf ac e
O u tg o i n g M e s s a g e Bu ff e r
In c o m i n g M e s s a g e Bu ff e r
S en di ng T hread
S erv er
T hread
Cl i en t
T hread
Me s s ag e
T hread
T i m er
Rec ei v er
T hread
F i l ter
T hread
Me s s ag e
S en di ng
F un c ti on
S A CL P ars er
A dd r es s
B oo k
T o M es s ag e
Di s pa tc he r
A ge nt k ernel
A ge nt Com m un i ty
2009-8-20 史忠植 高级人工智能 19
ACL constructing
2009-8-20 史忠植 高级人工智能 20
MAGE platform
MAGE
主体
Agent
Management
System
Directory
Facilitator
主体Agent
Message Transport System (MTS)
Software
Agent
Library
Function
Component
Other Agent Platforms
Message Transport System (MTS)
2009-8-20 史忠植 高级人工智能 21
Agent-Oriented SE
work flow of MAGE
Agent
Generation
System
GenerationRequirement Analyze
System Design
WorkFlow of MAGE
2009-8-20 史忠植 高级人工智能 22
面向主体软件设计
—— Agent-oriented software design with a GUI
Agent-oriented software design
Agent model
Inter-operation model
Graphic tool for agent-oriented software
design,
2009-8-20 史忠植 高级人工智能 23
AUML扩展 UML来描述多主体系统在 AUML中,我们引入了四种面向主体的图来描述一个多主体系统:
本体图:定义用来描述世界状态用到的实体以及它们之间的关系 。
主体系统结构图:描述多主体系统的结构 。
协议图:描述主体之间的交互协议 。
角色图:描述主体在交互中扮演的角色。
2009-8-20 史忠植 高级人工智能 24
本体图主体系统结构角色图协议图主体类型图主体交互系统配置图系统结构图分布图类图本体协作图结构图
AUML
UML
2009-8-20 史忠植 高级人工智能 25
GUI of XMIDE
2009-8-20 史忠植 高级人工智能 26
MAGE in AgentCities
2009-8-20 史忠植 高级人工智能 27
Friendly GUI and powerful function for
management
Friendly GUI
Powerful function for management
Start New Agent,Suspend,Resume,Migrate Agent,Clone
Agent,Kill Agent,Kill Container,Wait,Wake Up,Send
Message,Install a new MTP,Uninstall a MTP,View AP
Description,Manage Installed MTPs,Add Platform via AMS AID、
Add Platform via URL,Refresh AP Description,Remove Remote
Platform,Refresh Agent List,Close RMA Agent,Exit this
Container,Shut Down Agent Platform
2009-8-20 史忠植 高级人工智能 28
GUI of MAGE
2009-8-20 史忠植 高级人工智能 29
Debugging tools
MAGE aims at building applications and integrating
all kinds of applications.
MAGE provides many debugging tools for application
developer.
DummyAgent
Sniffer
……
2009-8-20 史忠植 高级人工智能 30
DummyAgent
2009-8-20 史忠植 高级人工智能 31
Sniffer
2009-8-20 史忠植 高级人工智能 32
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
2009-8-20 史忠植 高级人工智能 33
GUI of DF
2009-8-20 史忠植 高级人工智能 34
AAP and AAF
What is Agent Application Pattern (AAP)?
What is Agent Application Framework (AAF)?
The relations between them?
Why does MAGE provide them?
AAP management GUI
2009-8-20 史忠植 高级人工智能 35
GUI for AAP management
2009-8-20 史忠植 高级人工智能 36
2009-8-20 史忠植 高级人工智能 37
FIPA inter-operation protocol library
What is inter-operation protocol?
Why does MAGE provide these protocols?
MAGE provides protocols such as:
FipaRequestInitiatorBehaviour
FipaRequestResponderBehaviour
FipaQueryInitiatorBehaviour
FipaQueryResponderBehaviour
FipaContractNetInitiatorBehaviour
FipaContractNetResponderBehaviour
ContractNetInitiator
……
2009-8-20 史忠植 高级人工智能 38
AAF,reasoning service
Reasoning
Description logic
Description logic based reasoning machine
Working pattern
2009-8-20 史忠植 高级人工智能 39
DLRM
2009-8-20 史忠植 高级人工智能 40
移动主体
Mobility in MAGE platform
Supports user-defined content language and
ontology.
Inter-operation between MAGE and other agent or
non-agent software.
……
2009-8-20 史忠植 高级人工智能 41
Agent 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
2009-8-20 史忠植 高级人工智能 42
Agent 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)
bornAgent,deadAgent,suspendedAgent,resumedAgent、
changedAgentPrincipal,newMTP,deadMTP
Demonstrate
View APDescription
Manage installed MTPs
PlatformFrame
2009-8-20 史忠植 高级人工智能 43
AgentPlatforms
This node includes all platforms,local platform or
remote platforms
Demonstrate
Add platform via AMS AID
Add platform via URL
Add a container to a remote platform
Start a tool from a remote container
Communication between platforms
2009-8-20 史忠植 高级人工智能 44
Mage 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 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.
2009-8-20 史忠植 高级人工智能 45
电子商务平台 Virtual
Market
基于主体的自动谈判
2009-8-20 史忠植 高级人工智能 46
Web信息智能管理系统 WISE
基于主体的信息收集、分析与管理
2009-8-20 史忠植 高级人工智能 47
远程教育系统实现教学过程中的主动服务功能
2009-8-20 史忠植 高级人工智能 48
群体智能仿真系统实现了异构、分布的个体之间交互的模拟
…
Internet/
Intranet
第十章 分布式人工智能多主体环境 MAGE
史忠植中国科学院计算技术所
2009-8-20 史忠植 高级人工智能 2
内容提要
MAGE简介主体开发平台运行平台应用
2009-8-20 史忠植 高级人工智能 3
多主体环境 MAGE
MAGE系统作为构造多主体系统的平台,同时以构件组装的方法作为多主体系统的设计方法 。
屏蔽底层的细节。
较好的可扩展性,可以根据需求自己定制具有特定功能的主体 。
支持主体之间的并发性 。
主体的程序设计方法( AOP) 的一种探索。
2009-8-20 史忠植 高级人工智能 4
MAGE agent architecture
Agent
Sensor
Capabilities
Function Module
Interface
Agent
Knowledge
Base
Agent
Kernel
Communicator
Reasoning
Scheduling
Planing
Negotiation
Function
Component
2009-8-20 史忠植 高级人工智能 5
主体结构通信器主体通信语言解析器主体内核功能功能模块界面调度器主体描述语言解析器
C o m m u n i c a t o r
A gen t
M s g - In M s g - O u t
A C L P a r s e r
A g e n t K e r n e l
F u n c t i o n
1
F u n c t i o n
m
A C L M s g
D a t a
S c h e d u l e r
F u n c t i o n M o d u l e
I n t e r f a c e
A D L P a r s e r
2009-8-20 史忠植 高级人工智能 6
Agent Kernel Zhongzhi Shi
2009-8-20 史忠植 高级人工智能 7
MAGE agent life cycle
2009-8-20 史忠植 高级人工智能 8
主体工作流程 (1)
BEGIN
初始化主体内部数据;
读入 ADL脚本并进行分析,建立内部数据库;
装入功能模块,并启动相应执行线程;
初始化通信模块;
向 Facilitator发送注册信息;
2009-8-20 史忠植 高级人工智能 9
主体工作流程( 2)
REPEAT
接收线程:
检查消息队列;
如果消息队列为空,等待一段时间后继续检查;
消息解析,获取消息类型;
IF (消息是系统命令 ) THEN
直接由主体内核解释器执行;
ELSE
放入消息缓冲区等待相应的执行功能模块取走 。
2009-8-20 史忠植 高级人工智能 10
主体工作流程( 3)
发送线程
按照主体通信语言的格式封装需要发送的消息;
送交底端线程发送;
ENDREPEAT
END
2009-8-20 史忠植 高级人工智能 11
主体构建
—— multiple methods of agent generation
MAGE provide four methods of agent
generation
Behavior templates(Directly extends basic Agent
class of MAGE)
Agent Description Language (ADL)
Clone
FSM
2009-8-20 史忠植 高级人工智能 12
Plenty of behavior templates
What is behavior template? Why does MAGE provide so
many templates?
MAGE provides plenty of behavior templates for
developer to build their application
Agent behavior scheduling model
2009-8-20 史忠植 高级人工智能 13
Behavior templates
2009-8-20 史忠植 高级人工智能 14
Syntax of ADL(1)
<Agent>,:= <Definition>
<Local Address>
<Acquaintance Addresses>
<Extra Classes>
<Capabilities>
<Environment Variables>
<Sessions>
<Definition>,:= <Agent Name>
<Description >
<Agent Name>,:= "[Name]"
<agent> = <agent_name>
<Description>,:= "[Description]"
BEGIN
<description>
END
<Local Address>,:= "[Local Address]"
<agent> = <host_name>:<port>
2009-8-20 史忠植 高级人工智能 15
Syntax of ADL(2)
Acquaintance Addresses>,:= "[Acquaintance Address]"
BEGIN
{<acquaintance> = <host_name>:<port>}*
END
<Extra Classes>,:= "[Extra Classes]"
BEGIN
{<Class>}*
END
<Class>,:= Instance = <instance name>
CONSTRUCTOR = <constructor>
<Capabilities>,:= "[Capabilities]"
BEGIN
{<Capability>}*
END
<Capability>,:= NAME = <capability_name>
TYPE = <capability_type>
CMDLINE = <capability_command_line>
SOURCE = <capability_source>
<capability_type>,:= 0 | 1 | 2
2009-8-20 史忠植 高级人工智能 16
Syntax of ADL(3)
<Environment Variables>,:= "[Environment Variables]"
BEGIN
{<Variable>}*
END
<Variable>,:= <Variable Type> <variable_name>[ = <initial_value>]
<Variable Type>,:= int|boolean|char|string|float
<Sessions>,:= "[SESSIONS]"
BEGIN
{<Session>}*
END
<Session>,:= SESSION
<Java Sentences>
END SESSION
2009-8-20 史忠植 高级人工智能 17
主体间通信结构
Soft B U S
A gent
1
A gent
2
A gent
n
F aci l i t at or
2009-8-20 史忠植 高级人工智能 18
主体通信语言( ACL)
ACL
通信模块
并发对话机制
S oc k et Int erf ac e
O u tg o i n g M e s s a g e Bu ff e r
In c o m i n g M e s s a g e Bu ff e r
S en di ng T hread
S erv er
T hread
Cl i en t
T hread
Me s s ag e
T hread
T i m er
Rec ei v er
T hread
F i l ter
T hread
Me s s ag e
S en di ng
F un c ti on
S A CL P ars er
A dd r es s
B oo k
T o M es s ag e
Di s pa tc he r
A ge nt k ernel
A ge nt Com m un i ty
2009-8-20 史忠植 高级人工智能 19
ACL constructing
2009-8-20 史忠植 高级人工智能 20
MAGE platform
MAGE
主体
Agent
Management
System
Directory
Facilitator
主体Agent
Message Transport System (MTS)
Software
Agent
Library
Function
Component
Other Agent Platforms
Message Transport System (MTS)
2009-8-20 史忠植 高级人工智能 21
Agent-Oriented SE
work flow of MAGE
Agent
Generation
System
GenerationRequirement Analyze
System Design
WorkFlow of MAGE
2009-8-20 史忠植 高级人工智能 22
面向主体软件设计
—— Agent-oriented software design with a GUI
Agent-oriented software design
Agent model
Inter-operation model
Graphic tool for agent-oriented software
design,
2009-8-20 史忠植 高级人工智能 23
AUML扩展 UML来描述多主体系统在 AUML中,我们引入了四种面向主体的图来描述一个多主体系统:
本体图:定义用来描述世界状态用到的实体以及它们之间的关系 。
主体系统结构图:描述多主体系统的结构 。
协议图:描述主体之间的交互协议 。
角色图:描述主体在交互中扮演的角色。
2009-8-20 史忠植 高级人工智能 24
本体图主体系统结构角色图协议图主体类型图主体交互系统配置图系统结构图分布图类图本体协作图结构图
AUML
UML
2009-8-20 史忠植 高级人工智能 25
GUI of XMIDE
2009-8-20 史忠植 高级人工智能 26
MAGE in AgentCities
2009-8-20 史忠植 高级人工智能 27
Friendly GUI and powerful function for
management
Friendly GUI
Powerful function for management
Start New Agent,Suspend,Resume,Migrate Agent,Clone
Agent,Kill Agent,Kill Container,Wait,Wake Up,Send
Message,Install a new MTP,Uninstall a MTP,View AP
Description,Manage Installed MTPs,Add Platform via AMS AID、
Add Platform via URL,Refresh AP Description,Remove Remote
Platform,Refresh Agent List,Close RMA Agent,Exit this
Container,Shut Down Agent Platform
2009-8-20 史忠植 高级人工智能 28
GUI of MAGE
2009-8-20 史忠植 高级人工智能 29
Debugging tools
MAGE aims at building applications and integrating
all kinds of applications.
MAGE provides many debugging tools for application
developer.
DummyAgent
Sniffer
……
2009-8-20 史忠植 高级人工智能 30
DummyAgent
2009-8-20 史忠植 高级人工智能 31
Sniffer
2009-8-20 史忠植 高级人工智能 32
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
2009-8-20 史忠植 高级人工智能 33
GUI of DF
2009-8-20 史忠植 高级人工智能 34
AAP and AAF
What is Agent Application Pattern (AAP)?
What is Agent Application Framework (AAF)?
The relations between them?
Why does MAGE provide them?
AAP management GUI
2009-8-20 史忠植 高级人工智能 35
GUI for AAP management
2009-8-20 史忠植 高级人工智能 36
2009-8-20 史忠植 高级人工智能 37
FIPA inter-operation protocol library
What is inter-operation protocol?
Why does MAGE provide these protocols?
MAGE provides protocols such as:
FipaRequestInitiatorBehaviour
FipaRequestResponderBehaviour
FipaQueryInitiatorBehaviour
FipaQueryResponderBehaviour
FipaContractNetInitiatorBehaviour
FipaContractNetResponderBehaviour
ContractNetInitiator
……
2009-8-20 史忠植 高级人工智能 38
AAF,reasoning service
Reasoning
Description logic
Description logic based reasoning machine
Working pattern
2009-8-20 史忠植 高级人工智能 39
DLRM
2009-8-20 史忠植 高级人工智能 40
移动主体
Mobility in MAGE platform
Supports user-defined content language and
ontology.
Inter-operation between MAGE and other agent or
non-agent software.
……
2009-8-20 史忠植 高级人工智能 41
Agent 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
2009-8-20 史忠植 高级人工智能 42
Agent 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)
bornAgent,deadAgent,suspendedAgent,resumedAgent、
changedAgentPrincipal,newMTP,deadMTP
Demonstrate
View APDescription
Manage installed MTPs
PlatformFrame
2009-8-20 史忠植 高级人工智能 43
AgentPlatforms
This node includes all platforms,local platform or
remote platforms
Demonstrate
Add platform via AMS AID
Add platform via URL
Add a container to a remote platform
Start a tool from a remote container
Communication between platforms
2009-8-20 史忠植 高级人工智能 44
Mage 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 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.
2009-8-20 史忠植 高级人工智能 45
电子商务平台 Virtual
Market
基于主体的自动谈判
2009-8-20 史忠植 高级人工智能 46
Web信息智能管理系统 WISE
基于主体的信息收集、分析与管理
2009-8-20 史忠植 高级人工智能 47
远程教育系统实现教学过程中的主动服务功能
2009-8-20 史忠植 高级人工智能 48
群体智能仿真系统实现了异构、分布的个体之间交互的模拟
…
Internet/
Intranet