SARL (programming language)

Last updated

The SARL programming language is a modular agent-oriented programming language. It aims at providing the fundamental abstractions for dealing with concurrency, distribution, interaction, decentralization, reactivity, autonomy and dynamic reconfiguration. [1]

Contents

SARL is platform-independent and agent’s architecture-agnostic. It provides a set of agent-oriented first-class abstractions directly at the language level (see the section on the concepts). Nevertheless, it supports the integration and the mapping of concepts provided by other agent-oriented metamodels. SARL itself exploits this extension mechanism for defining its own extensions (organizational, event-driven, etc.).

An important feature of the SARL programming language is its native support for "holonic multiagent systems," and "recursive agents" (also called "holons").

Overview

The metamodel of SARL is based on four main concepts: Agent, Capacity, Space and Skill. [1] The core metamodel of SARL is presented in Figure 1, and the main concepts are colored in light blue. Each of them are detailed in the following sections, as well as the corresponding piece of SARL code to illustrate their practical use.

Figure 1: The concepts of the SARL programming language. SARLLanguageconcepts.png
Figure 1: The concepts of the SARL programming language.

In SARL, a Multiagent System (MAS) is a collection of Agents interacting together in shared distributed Spaces. Each agent has a collection of Capacities describing what it is able to perform, its personal competences. [2] [3] Each Capacity may then be realized/implemented by various Skills. For understanding the relationship between the concepts of Capacity and Skill, a parallel can be drawn with concepts of Interface and their implementation classes in object-oriented languages. To implement specific architectures (like BDI, reasoning, reactive, hybrid, etc.) developers should develop their own capacities and skills providing the agents with new exploitable features.

Despite its open nature, SARL imposes some fundamental principles to be respected by the various Virtual Machines (VM) that wants to support it. First of all, the implementation of Space must be fully distributed and the execution layer must be abstracted from agents. SARL encourages a massively parallel execution of Agents and Behaviors. SARL is fully interoperable with Java to easily reuse all the contributions provided by the Java community, but also to facilitate the integration and evolution of legacy systems. One of the key principles governing SARL consists in not imposing a predefined way for Agents to interact within a Space. Similarly, the way to identify agents is dependent on the type of Space considered. This allows to define different types of interaction mechanisms and models on Spaces.

The metamodel and the syntax of the SARL programming language have been inspired by the languages like Scala, Clojure, and Ruby. The SARL tools have been developed on top of Xtext, that enables to easily build domain-specific languages that are directly integrated into the Eclipse framework. The complete definition of the SARL syntax is available on GitHub.

Concepts

The SARL programming language is based on an agent-oriented metamodel based on the following concepts.

Emotional software agents

An agent is an autonomous entity having a set of skills to realize the capacities it exhibits. An agent has a set of built-in capacities considered essential to respect the commonly accepted competences of agents, such autonomy, reactivity, proactivity and social capacities. Among these built-in capacities (BIC), is the "behaviors" capacity that determines its global conduct. An agent has also a default behavior directly described within its definition.

A Behavior maps a collection of perceptions represented by Events to a sequence of Actions. An Event is the specification of some occurrence in a Space that may potentially trigger effects by a listener (e.g. agent, behavior, etc.).

These language does not imposes a specific agent’s control loop. The programmer is free to implement any control or authority protocol for their own application scenario, except for the initialization and destruction events. Indeed, when agents are created, the virtual machine that is executing the emotional software program is in charge of creating the agent instances, and installing the skills associated to the built-in capacities into the agent. Then, when the agent is ready to begin its execution, it fires the Initialize event. When the agent has decided to stop its own execution, the virtual machine fires the Destroy event to enable the agent to release any resource it may still hold.

Capacity and Skill

An Action is a specification of a transformation of a part of the designed system or its environment. This transformation guarantees resulting properties if the system before the transformation satisfies a set of constraints. An action is defined in terms of pre- and post-conditions.

A Capacity is the specification of a collection of actions. This specification makes no assumptions about its implementation. It could be used to specify what an agent can do, what a behavior requires for its execution.

A Skill is a possible implementation of a capacity fulfilling all the constraints of this specification. An agent can dynamically evolve by learning/acquiring new Capacities, but it can also dynamically change the Skill associated to a given capacity. [2] [3] Acquiring new capacities also enables an agent to get access to new behaviors requiring these capacities. This provides agents with a self-adaptation mechanism that allow them to dynamically change their architecture according to their current needs and goals.

Context and Space

A Context defines the perimeter/boundary of a sub-system, and gathers a collection of Spaces. In each context, there is at least one particular Space called Default Space to which all agents in this context belong. This ensures the existence of a common shared Space to all agents in the same context. Each agent can then create specific public or private spaces to achieve its personal goals. Since their creation, agents are incorporated into a context called the Default Context. The notion of Context makes complete sense when agents are considered composed or holonic (see below).

A Space is the support of the interaction between agents respecting the rules defined in a Space Specification. A Space Specification defines the rules (including action and perception) for interacting within a given set of Spaces respecting this specification.

Recursive Agent or Emotional software agent

Agents can be composed of other agents to define hierarchical multiagent systems. Each agent defines its own Context, called the Inner Context, and it is part of one or more External Contexts.

Examples

Hello, World!

packagehelloworldimportio.sarl.core.InitializeagentHelloWorldAgent{onInitialize{println("Hello, World!")}}

Exchanging messages between two agents

For illustrating the syntax of the SARL language, the Ping-Pong scheme is coded below. The agent A is sending a message PING to the agent B for determining if it is still alive. The agent B is replying with a PONG message.

First, the two messages must be defined as events (without attribute):

event PING    event PONG

The agent A is defined with

agent A {        uses DefaultContextInteraction, Logging        on Initialize {            emit(new Ping)        }        on Pong {            println("Agent " + occurrence.source + " is alive.")        }    }

In the previous code, the keyword uses enables the agent to use previously-defined capacities: the capacity to interact with other agents inside the default context (DefaultContextInteraction), and the capacity to log messages (Logging). The on keyword permits to define the actions when an occurrence of the specified event is received by the agent A. When the agent A receives the Initialize event, it emits a Ping event to all the existing agents. When the agent A receives the Pong event, it logs a message with the identity of the event's emitter inside.

The agent B is defined with

agent B {        uses DefaultContextInteraction, Logging        on Ping {            println("Agent " + occurrence.source + " wants to know if I'm alive.)            emit(new Pong, Scopes        addresses(occurrence.source))        }    }

When the agent B receives the Ping message, it logs a message and reply with a Pong message. For avoiding a broadcast of the Pong message, the receiver of this message is restricted with the scope corresponding to the address of the Ping's emitter.

Janus Platform: a SARL Run-time Environment

SARL language specifies a set of concepts and their relations. However, the SARL language does not impose a particular execution infrastructure for being platform-independent.

Nevertheless, the Janus Project provides the infrastructure for running SARL agents. Janus is an open source multi-agent platform fully implemented in Java 1.7. It implements all required infrastructure to execute a MAS programmed in the SARL language. The major assumption made at the SARL language level are supported by this run-time environment: fully distributed, parallel execution of agent’s behaviors. Additionally, the Janus platform provides the tools for helping the programmer to deploy its MAS with the automatic discovery of Janus kernels, for instance.

Technically, the Janus platform follows the best practices in current software development, such as Inversion of Control, and profits from new technologies like Distributed Data Structures (In-Memory Data Grid like Hazelcast).

See Also

Related Research Articles

Forth is a procedural, concatenative, stack-oriented programming language and interactive integrated development environment designed by Charles H. "Chuck" Moore and first used by other programmers in 1970. Although not an acronym, the language's name in its early years was often spelled in all capital letters as FORTH. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became de facto standards, and an official technical standard of the language was published in 1994 as ANS Forth. A wide range of Forth derivatives existed before and after ANS Forth. The free and open-source software Gforth implementation is actively maintained, as are several commercially supported systems.

<span class="mw-page-title-main">Unified Modeling Language</span> Software system design modeling tool

The unified modeling language (UML) is a general-purpose visual modeling language that is intended to provide a standard way to visualize the design of a system.

In programming languages, a closure, also lexical closure or function closure, is a technique for implementing lexically scoped name binding in a language with first-class functions. Operationally, a closure is a record storing a function together with an environment. The environment is a mapping associating each free variable of the function with the value or reference to which the name was bound when the closure was created. Unlike a plain function, a closure allows the function to access those captured variables through the closure's copies of their values or references, even when the function is invoked outside their scope.

In object-oriented programming languages, a mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. Mixins are sometimes described as being "included" rather than "inherited".

The Web Services Business Process Execution Language (WS-BPEL), commonly known as BPEL, is an OASIS standard executable language for specifying actions within business processes with web services. Processes in BPEL export and import information by using web service interfaces exclusively.

A modeling language is any artificial language that can be used to express data, information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in the structure of a programming language.

In computer science, a software agent is a computer program that acts for a user or another program in a relationship of agency.

In computer programming, a callback is a function that is stored as data and designed to be called by another function – often back to the original abstraction layer.

In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. Classes, methods, variables, parameters and Java packages may be annotated. Like Javadoc tags, Java annotations can be read from source files. Unlike Javadoc tags, Java annotations can also be embedded in and read from Java class files generated by the Java compiler. This allows annotations to be retained by the Java virtual machine at run-time and read via reflection. It is possible to create meta-annotations out of the existing ones in Java.

<span class="mw-page-title-main">ATLAS Transformation Language</span> Model transformation language

ATL is a model transformation language and toolkit developed and maintained by OBEO and AtlanMod. It was initiated by the AtlanMod team. In the field of Model-Driven Engineering (MDE), ATL provides ways to produce a set of target models from a set of source models.

Kermeta is a modeling and programming language for metamodel engineering.

The Business Process Definition Metamodel (BPDM) is a standard definition of concepts used to express business process models, adopted by the OMG. Metamodels define concepts, relationships, and semantics for exchange of user models between different modeling tools. The exchange format is defined by XSD and XMI, a specification for transformation of OMG metamodels to XML. Pursuant to the OMG's policies, the metamodel is the result of an open process involving submissions by member organizations, following a Request for Proposal (RFP) issued in 2003. BPDM was adopted in initial form in July 2007, and finalized in July 2008.

Knowledge Discovery Metamodel (KDM) is a publicly available specification from the Object Management Group (OMG). KDM is a common intermediate representation for existing software systems and their operating environments, that defines common metadata required for deep semantic integration of Application Lifecycle Management tools. KDM was designed as the OMG's foundation for software modernization, IT portfolio management and software assurance. KDM uses OMG's Meta-Object Facility to define an XMI interchange format between tools that work with existing software as well as an abstract interface (API) for the next-generation assurance and modernization tools. KDM standardizes existing approaches to knowledge discovery in software engineering artifacts, also known as software mining.

The Semantics of Business Vocabulary and Business Rules (SBVR) is an adopted standard of the Object Management Group (OMG) intended to be the basis for formal and detailed natural language declarative description of a complex entity, such as a business. SBVR is intended to formalize complex compliance rules, such as operational rules for an enterprise, security policy, standard compliance, or regulatory compliance rules. Such formal vocabularies and rules can be interpreted and used by computer systems. SBVR is an integral part of the OMG's model-driven architecture (MDA).

Automata-based programming is a programming technology. Its defining characteristic is the use of finite state machines to describe program behavior. The transition graphs of state machines are used in all stages of software development. Automata-based programming technology was introduced by Anatoly Shalyto in 1991. Switch-technology was developed to support automata-based programming. Automata-based programming is considered to be rather general purpose program development methodology than just another one finite state machine implementation.

<span class="mw-page-title-main">ArchiMate</span> Enterprise architecture modeling language

ArchiMate is an open and independent enterprise architecture modeling language to support the description, analysis and visualization of architecture within and across business domains in an unambiguous way.

<span class="mw-page-title-main">IDEF4</span>

IDEF4, or Integrated DEFinition for Object-Oriented Design, is an object-oriented design modeling language for the design of component-based client/server systems. It has been designed to support smooth transition from the application domain and requirements analysis models to the design and to actual source code generation. It specifies design objects with sufficient detail to enable source code generation.

UML state machine, also known as UML statechart, is an extension of the mathematical concept of a finite automaton in computer science applications as expressed in the Unified Modeling Language (UML) notation.

Agent-oriented programming (AOP) is a programming paradigm where the construction of the software is centered on the concept of software agents. In contrast to object-oriented programming which has objects at its core, AOP has externally specified agents at its core. They can be thought of as abstractions of objects. Exchanged messages are interpreted by receiving "agents", in a way specific to its class of agents.

Kotlin is a cross-platform, statically typed, general-purpose high-level programming language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM version of Kotlin's standard library depends on the Java Class Library, but type inference allows its syntax to be more concise. Kotlin mainly targets the JVM, but also compiles to JavaScript or native code via LLVM. Language development costs are borne by JetBrains, while the Kotlin Foundation protects the Kotlin trademark.

References

  1. 1 2 Rodriguez, S., Gaud, N., & Galland, S. (2014). SARL: a general-purpose agent-oriented programming language. In The 2014 IEEE/WIC/ACM International Conference on Intelligent Agent Technology. Warsaw, Poland: IEEE Computer Society Press.
  2. 1 2 Rodriguez S., Gaud N., Hilaire V., Galland S., & Koukam K. (2006). An analysis and design concept for self-organization in holonic multi-agent systems. In the International Workshop on Engineering Self-Organizing Applications (ESOA’06), pages 62–75. Springer-Verlag.
  3. 1 2 Cossentino M., Gaud N., Hilaire V., Galland S. & Koukam K. 2010. ASPECS: an agent-oriented software process for engineering complex systems - how to design agent societies under a holonic perspective. In Int. Journal on Autonomous Agents and Multi-Agent Systems, 2(2):260–304, March 2010. doi: 10.1007/s10458-009-9099-4.