如今,多agent 系统(multi-agent system,简称MAS)被广泛用于开发各种应用系统.当前,开放、动态、难控的计算平台要求软件系统能够根据系统自身及其环境状态信息及其改变,动态地调节自身的行为,即具备一定的上下文感知能力.然而,现有工作并未就如何向既有的MAS 应用系统引入上下文感知能力提出有效的解决方案.依照关注分离原则,结合面向上下文程序设计技术(context-oriented programming,简称COP)、反射技术(reflection)以及代码植入技术(code instrumentation),提出了一套MAS 系统上下文感知增强框架和底层支撑技术.开发人员可以在既有应用源码不可得的情况下,自动地将指定agent 类型转换为(扩展为)具有上下文感知能力的agent 类型.此外,利用底层运行支撑环境,系统管理员可以在系统运行时刻动态地调整指定agent 的上下文感知行为.
Multi-Agent system (MAS) is widely used to develop applications in different domains. Currently, the computing platform is becoming more and more open, dynamic, and uncontrollable. Hence, software systems are required to adapt to the changing states of themselves and their running environments. In other words, systems should be context-aware. However, the way to enhance existing MAS applications with context-awareness is not well addressed by existing works. In this paper, based on the Separation of Concerns principle, the study combines context-oriented programming (COP), reflection, as well as code instrumentation technologies in a way to introduce context-awareness to existing MAS applications. With the proposed approach, agents of an existing MAS application are transformed to context-aware ones, even if the source code is unavailable. In addition, with the help of the underlying runtime environment, the administrator can dynamically adjust the context-aware behaviors of a specified agent (or a group of agents) at runtime.