=Paper= {{Paper |id=Vol-1664/w16 |storemode=property |title=Multi-paradigm Coordination for MAS: Integrating Heterogeneous Coordination Approaches in MAS Technologies |pdfUrl=https://ceur-ws.org/Vol-1664/w16.pdf |volume=Vol-1664 |authors=Stefano Mariani,Andrea Omicini |dblpUrl=https://dblp.org/rec/conf/woa/MarianiO16 }} ==Multi-paradigm Coordination for MAS: Integrating Heterogeneous Coordination Approaches in MAS Technologies== https://ceur-ws.org/Vol-1664/w16.pdf
        Multi-paradigm Coordination for MAS:
 Integrating Heterogeneous Coordination Approaches
                in MAS Technologies

                           Stefano Mariani                                                  Andrea Omicini
    DISI, A LMA M ATER S TUDIORUM–Università di Bologna                DISI, A LMA M ATER S TUDIORUM–Università di Bologna
              via Sacchi 3, 47521 Cesena, Italy                                   via Sacchi 3, 47521 Cesena, Italy
                  Email: s.mariani@unibo.it                                        Email: andrea.omicini@unibo.it


    Abstract—Open distributed multi-agent systems featuring                 Subjective coordination [1] represents instead the dual
autonomous components demand coordination mechanisms for                approach – typically adopted in the (distributed) artificial
both functional and non-functional properties. Heterogeneity of         intelligence field [7] – where coordination issues are directly
requirements regarding interaction means and paradigms, stem-           tackled by the agents themselves, determining their best course
ming from the diverse nature of components, should not affect           of (inter-)action in the attempt to achieve their own goals.
the effectiveness of coordination. Along this line, in this paper we
share our pragmatical experience in the integration of objective
                                                                        Thus, the burden of coordination is here distributed among
and subjective, synchronous and asynchronous, reactive and pro-         coordinables, expressing their autonomy w.r.t. coordination
active coordination approaches within two widely-adopted agent-         commitments through their own deliberation process.
oriented technologies (JADE and Jason), enabling coordinating               Clearly, respecting agents’ autonomy is a foremost issue in
components to dynamically adapt their interaction means based
                                                                        the design of coordination models for MAS, be them objective
on static preference or run-time contingencies.
                                                                        or subjective. Also, the issue of autonomy emerges while
                                                                        designing other facets of coordination model and technologies,
                      I.   I NTRODUCTION                                corresponding to the aforementioned classification criteria.
    Open and distributed multi-agent systems (MAS) featur-                  Enforcing a reactive programming style for handling in-
ing autonomous components demand efficient coordination                 teractions – as typically done in the context of event-based
mechanisms for both functional and non-functional properties.           systems and actor-based frameworks – often leads to the
Heterogeneity of requirements regarding interaction means               problem of inversion of control—namely, the fact that the flow
and paradigms – e.g. message-passing vs. shared space, syn-             of interactions determines when the interacting components
chronous vs. asynchronous, proactive vs. reactive, etc. – stem-         should act and what they should do, thus definitely wipe out
ming from the heterogeneous nature of components – e.g.                 pro-activeness of components. Also, on a lower level, the
software agents vs. physical devices – implies that coordination        management of the component control flow is taken out from
should be effective despite heterogeneity.                              the programmers’ hands, and left to the framework. In the
    Coordination approaches in the literature can be classified         overall, inversion of control results in a blatant example of
according to diverse criteria, such as the means through which          violation of the component autonomy.
interaction happens – e.g. messages vs. tuples –, synchronism               Adopting a synchronous semantics for interaction primi-
of interaction primitives, enforced programming style—e.g.              tives invocation, without adequate mediating abstractions un-
reactive, such as with actors, vs. pro-active, such as with             coupling the invoker flow of control from the (possibly)
agents. The most general classification distinguishes coordina-         suspensive semantics of the primitive, is another way to violate
tion approaches as either objective or subjective [1], depending        the components autonomy. A typical example can be observed
on who is responsible for the ”burden of coordination”: the             in any L INDA-like coordination model [8], where interacting
coordinable, or the coordination medium—following the meta-             components are usually bound to withstand the outcomes of
model and the terminology proposed in [2].                              the coordination process—e.g. getting stuck whenever a getter
                                                                        primitive finds no matching tuple in the shared space.
    Objective coordination [1] refers to the approach – typi-
cally stemming from the software engineering research field –               Accordingly, in this paper we share our pragmatical ex-
where coordination-related concerns are encapsulated within             perience in integrating objective and subjective, synchronous
dedicated abstractions, such as coordination artefacts [3] (the         and asynchronous, reactive and pro-active coordination ap-
medium), offering coordination as a service to coordinables             proaches, enabling participating components to (deliberatively)
[4]. Thus, coordination abstractions take responsibility for            dynamically adapt their interaction means based on static
coordination, by steering agent societies – that is, ensemble           preference or run-time contingencies – while still having their
of cooperating/competing agents – towards the achievement               autonomy preserved –, in the context of two widely adopted
of social (shared) goals, through the suitable management of            agent-oriented technologies, that is, JADE [9] and Jason [10],
the dependencies between agents’ activities [5], [6]—despite            featuring their own subjective coordination mechanisms, and
agent’s individual goals, yet without harming their autonomy.           adopting the TuCSoN middleware as the provider of objective



                                                                   91
coordination. The goal is to provide MAS designers and               noting that method action() is executed from the beginning
programmers with a flexible development framework capable            every time: there is no way to “stop-then-resume” a behaviour
of seamlessly supporting multi-paradigm coordination, where          during its execution.
agents deliberatively choose which coordination paradigm and
interaction means to adopt for the current interactions—and,             The ACC is the middleware service in charge of asyn-
more importantly, where such a choice does not affect nega-          chronous message passing among agents: each agent has its
tively the other interactive, or non-interactive, activities they    own mailbox where incoming communications are silently
are (possibly, concurrently) undertaking.                            put, waiting to be explictly (pro-actively) considered by the
                                                                     receiving agent—for the sake of preserving its autonomy.
    The remainder of the paper is organised as follows. Sec-         When and how to process the mailbox is up to the agent’s
tion II describes how the subjective coordination paradigm           own deliberation:
may be instantiated within a message-based setting, also
wr.t. synchronism and programming style, by discussing the              •    method receive() attempts to asynchronously re-
concrete cases of JADE (Subsection II-A) and Jason (Subsec-                  trieve the first message, or a message compliant with a
tion II-B). Section III describes how the objective coordination             given message template, from the mailbox—returning
paradigm may be implemented within a tuple-based setting,                    nothing in case no message is found
by discussing the TuCSoN approach (Subsection III-A). Sec-              •    method blockingReceive(), as the name sug-
tion IV describes our solution for enabling multi-paradigm                   gests, attempts to synchronously retrieve the first mes-
coordination, by briefly describing TuCSoN4JADE (Subsec-                     sage, or a message compliant with a given message
tion IV-A) – already presented in [11], but useful here for                  template, from the mailbox—waiting until a message
comparison and generalisation purposes – and by thoroughly                   is eventually found
discussing TuCSoN4Jason (Subsection IV-B)—also, an exam-
ple showcasing effectiveness of multi-paradigm coordination is       Clearly, the first method preserves the autonomy of the agent
provided in Subsection IV-C. Finally, Section V briefly reports      no matter what. The same does not hold for the second one,
on some similar works by fellow researchers, while Section VI        because deciding to wait for a specific interaction potentially
summarises the work, and outlines future improvements.               hinders the ability of the agent to remain responsive to other
                                                                     interactions—although based on a deliberate choice of the
    II.   M ESSAGE - BASED S UBJECTIVE C OORDINATION                 agent itself.
    In this section we briefly describe the approach to subjec-          The reason is that method blockingReceive() sus-
tive coordination adopted by two agent development frame-            pends the agent as a whole, not only the calling behaviour.
works well-known within the MAS community: JADE (Sub-                Thus, the JADE Programmers Guide itself [12] suggests
section II-A) and Jason (Subsection II-B).                           the adoption of the following programming pattern: call
                                                                     receive() instead of blockingReceive(), then call
                                                                     method block() – of the Behaviour class – if no message
A. Subjective Coordination in JADE
                                                                     is found, so as to suspend only the calling behaviour—which
    JADE (Java Agent DEvelopment Framework) [9] is a Java-           will be automatically resumed by JADE upon reception of any
based framework and infrastructure to develop and deploy             message. Therefore, if programmers want their agents’ auton-
open, distributed, agent-based applications in compliance with       omy preserved while subjectively coordinating, they should
FIPA standard specifications for interoperable intelligent MAS.      abide to the “block-then-resume” pattern just described.
In JADE, autonomy of agents is supported by the behaviour ab-           Besides plain message passing, JADE provides to program-
straction, whereas coordination adopts the subjective paradigm       mers a number of ready-to-use FIPA interaction protocols,
thanks to an asynchronous message-passing layer – the Agent          such as the Contract Net [13] and the general-purpose Achieve
Communication Channel (ACC) – on top of which FIPA inter-            Rational Effect [14], in the form of a callbacks framework:
action protocols are implemented and provided to developers—
as a callbacks framework.                                               •    programmers declare which FIPA protocol their inter-
    A behaviour can be logically interpreted as “an activity                 acting agents should commit to, by instantiating the
to perform with the goal of accomplishing a task”. Thus,                     corresponding Java object
different courses of actions of a JADE agent are encapsulated           •    then, they implement the actual body of the callback
into distinct behaviours the agent executes simultaneously.                  methods corresponding to each interaction (message
More technically, JADE behaviours are Java objects, which                    to be received or sent) as expected according to the
are executed pseudo-concurrently within a single Java thread                 specific FIPA protocol adopted
by a built-in non-preemptive round-robin scheduler. During
JADE agent initialisation, behaviours are added to the ready         As any other framework adopting a callback scheme, JADE
queue, ready to be scheduled. Then, method action() of               FIPA protocols promote a reactive programming style, where
the first behaviour – implementing one of the agent’s course of      agents synchronously wait for messages to advance through the
action – is executed. Behaviours switch occurs only when the         protocol stages. Agents’ pro-activeness – so, their autonomy –
method returns; hence, in the meanwhile no other behaviour           is thus limited. Nevertheless, JADE internally implements FIPA
can start execution (non-preemptive scheduler). Behaviours           protocols abiding to the block-then-resume pattern, so that
removal from the ready queue occurs only when the done()             interacting agents stay responsive to concurrent interactions
method returns true; otherwise, the behaviour is re-scheduled        while subjectively coordinating—besides being able to carry
at the end of the queue (round-robin scheduler). It is worth         out non-interactive activities through concurrent behaviours.



                                                                92
    Summing up, JADE support to subjective coordination is                                       ◦    asynchronous, where the caller intention never
provided through asynchronous message passing – respecting                                            gets suspended, and the query result has to
agents’ autonomy thanks to the block-then-resume pattern –                                            be handled reactively through a proper plan
and built-in FIPA protocols—limiting instead autonomy due                                             handling the belief addition event +b
to reactiveness enforced by the callbacks framework.                                             ◦    synchronous, where the caller intention gets
                                                                                                      suspendend until the receiver’s reply becomes
B. Subjective Coordination in Jason                                                                   available—that is, a matching belief appears in
                                                                                                      its belief base
    Jason [10] is both an agent language and an agent runtime
                                                                                                 ◦    timed synchronous, where the synchronism is
system. As a language, it implements a dialect of AgentSpeak
                                                                                                      limited by a finite upper bound on waiting
[15]; as a run-time system, it provides some services needed
                                                                                                      time, whose expiration causes the intention to
to execute a MAS—e.g. agents’ reasoning engine and a non-
                                                                                                      be resumed—and labelled with a timeout
distributed execution platform. Although Jason is entirely
                                                                                                      outcome
programmed in Java, it features BDI agents, so a higher-
level language (the Jason language) is used to program Jason                          It is worth noting that intentions only (not the whole Jason
agents using BDI abstractions. In Jason, autonomy of agents                           agent) are automatically suspended whenever they perform
is supported by plan/intention concurrent execution machinery,                        a (communication) action which cannot complete – e.g. the
whereas coordination adopts the subjective paradigm1 thanks                           request for information following a test-goal attempt –, to
to the asynchronous message passing layer.                                            be resumed as soon as the action obtains its “completion
    Similarly to JADE behaviours, a Jason plan can be con-                            feedback” (see [10], page 86)—e.g. the message conveying the
ceptually interpreted as a course of action to be performed to                        requested information. This mechanism may be interpreted as
accomplish a task. Technically, a Jason plan differs consider-                        the equivalent of JADE block-then-resume pattern, which is
ably from JADE behaviours: (i) it is scheduled for execution as                       automatically handled here by the Jason runtime.
soon as a triggering event occurs, (ii) it is not directly executed                      Summing up, Jason support to subjective coordination
“as is” (in general), but is instantiated as an intention, then                       is provided through both asynchronous and synchronous
executed, (iii) intentions are pseudo-concurrently executed one                       message passing, respecting agents’ autonomy thanks to
action each, according to a round-robin scheduler. Therefore,                         the intention suspension mechanism—unlike JADE, where
whereas in JADE the behaviour is the basic execution step,                            blockingReceive() suspends the agent as a whole.
in Jason the same role is played by the single action, not by
the plan/intention as a whole. Intentions may be suspended –
                                                                                          III.   A RTEFACT- BASED O BJECTIVE C OORDINATION
either by the programmer or by the Jason reasoning engine –
for a number of reasons—e.g. because the agent needs to wait                              In this section we briefly describe the approach to objective
for a message, or an environmental event.                                             coordination adopted by the TuCSoN coordination model and
    Jason agents can in fact exchange beliefs (but also plans                         technology, taken as a reference for artefact-based coordination
and goals), both synchronously and asynchronously through                             and exploited in Section IV as the provider of objective
the same .send() internal action, in the form of messages                             coordination services.
encoded in a KQML-like language, with a very similar se-
mantics. Depending on the illocutionary force determining                             A. Objective Coordination in TuCSoN
the meaning of messages (e.g., askOne vs. tell), their                                    TuCSoN [16] is a Java-based, (logic) tuple-based coordi-
reception causes different events (e.g., test-goal addition vs.                       nation model and infrastructure for open, distributed MAS. It
belief addition) automatically triggering execution of the cor-                       provides objective coordination as service by implementing
respondent plans. It is worth noting that there is no explicit                        and extending the L INDA model [8] with ReSpecT tuple
receive communication primitive involved, here, nor a mailbox                         centres [17], the coordination artefacts [3] encapsulating coor-
to explicitly monitor2 . The basic illocutionary forces concerned                     dination mechanisms and policies, distributed over a network
with exchanging beliefs are:                                                          of TuCSoN nodes.
    •     tell, to share a (list of) belief(s) with a target (list of)                    TuCSoN preserves interacting agents’ autonomy through
          agent(s). Addition of the communicated information                          the Agent Coordination Context (ACC) [18] abstraction—
          to the belief base of the receiver agent, where it waits                    mainly; TuCSoN architecture also contributes, as clarified
          to be pro-actively considered, causes a belief addition                     below by describing TuCSoN “two-steps” execution. ACC are
          event, handled by plans starting with the +b clause                         assigned to agents as they enter a TuCSoN-coordinated MAS,
    •     askOne to query another agent’s belief base—sort                            with the responsibility, among the many others, to uncouple the
          of a “remote test-goal”3 . The internal action askOne                       synchronism of a coordination operation invocation from the
          comes in three flavours:                                                    suspensive semantics of the coordination primitive used – e.g.
    1 While objective coordination could in principle be implemented on top
                                                                                      L INDA in –, by mapping operations to events asynchronously
                                                                                      dispatched to the coordination media (ReSpecT tuple centres).
of Jason Environment Java API for programming MAS (computational)
environments, it is not considered here since no first-class support for                  More precisely, the suspensive semantics of getter prim-
environment abstractions is provided.
    2 Actually, a mailbox exists, but the Jason agent is completely unaware of        itives, as inherited by the L INDA model, implies that if no
it.                                                                                   matching tuple is found the operation waits indefinitely until
    3 Actually, a test-goal is executed on the receiver agent side, thus, if plans    it becomes available. This semantics does not depend on
starting with the +?b clause exist, they are triggered to handle the request.         agent own deliberation: it is set by the coordination model



                                                                                 93
at hand, and is what enables distributed synchronisation and               The simplest and most straightforward solution would
coordination, in the very hand. The synchronism of invocation          be letting JADE agents directly access TuCSoN services,
instead, couples (or uncouples) the fate of a coordination             requiring nothing more than a correct usage of TuCSoN
operation with that of the invoker agent, and is subject to the        API—since both technologies are implemented on top of Java.
agent own deliberation. This means that:                               Nevertheless, direct API access would inevitably hinder JADE
                                                                       agents autonomy while resorting to objective coordination
   •      in case the agent chooses the synchronous invocation         synchronously: their control flow would be coupled to that
          mode, it gets suspended, too, if the operation gets          of the coordination operation requested, so that in case of sus-
          suspended                                                    pension the whole agent would get stuck, not just the invoker
   •      if the asynchronous invocation mode is used, instead,        behaviour. This way, roughly speaking, agents’ deliberate
          suspension policy is confined to the operation, whereas      choice to exploit objective coordination could negatively affect
          the invoker agent can continue performing its activi-        their ongoing subjective coordination activities, as well as any
          ties, pro-actively inspecting the status of the operation    other non-interactive activity in process. This would represent
          when preferred—and eventually getting the result             a glaring example of an artificial dependency (unintentionally)
                                                                       created by a “non-autonomy-preserving” approach to multi-
In order to do so, the execution of any TuCSoN operation               paradigm coordination.
follows two steps:
                                                                          Instead, an appropriate integration between TuCSoN and
   •      the request to carry out a given coordination operation      JADE was achieved in [11] by developing a bridge compo-
          is performed by the agent through its ACC, which             nent in charge of suitably suspending and resuming JADE
          then dispatches the corresponding operation event to         behaviours depending on the outcome of the requested TuC-
          the target tuple centre—invocation step                      SoN coordination operation—besides providing a suitable
                                                                       API wrapping TuCSoN services to JADE agents: the TuC-
   •      the response to the coordination operation invoked is        SoN4JADE bridge4 .
          sent back to the requesting agent by the tuple centre
          through its ACC, as soon as the response is available—           In particular, the bridge is based on the fact that whenever
          completion step                                              any JADE behaviour is re-scheduled its action() method
                                                                       is re-started, thus the synchronous invocation of TuCSoN
Put in other terms, any coordination service provided by               coordination operation is repeated. The whole TuCSoN4JADE
TuCSoN is asynchronous by default; nevertheless, interacting           machinery works because the invocation – through TuC-
agents may deliberately choose the invocation synchronism of           SoN4JADE API method synchronousInvocation() –
each coordination operation—potentially limiting their auton-          transparently checks whether the operation just invoked can be
omy: either synchronous or asynchronous.                               completed: in case the operation result is not available, yet, the
    Summing up, TuCSoN coordination model preserves agent              request is actually dispatched by TuCSoN ACC to the target
autonomy by uncoupling the suspensive semantics of coordina-           tuple centre, and the invoker behaviour is suspended by calling
tion operations from their invocation semantics (synchronism)          method block(). As soon as the operation result becomes
– actually promoting pro-activeness over reactiveness – thanks         available, the bridge component resumes the suspended be-
to the ACC architectural abstraction.                                  haviour and hands off the completion event—so that the second
                                                                       invocation, due to behaviour restart, immediately succeeds.
    IV.    E NABLING M ULTI - PARADIGM C OORDINATION                       Summing up, TuCSoN4JADE lets JADE agents free to
    In this section we describe two software modules enabling          choose, for every single interaction event, which coordination
TuCSoN-based multi-paradigm coordination for JADE and                  paradigm suits their needs best, based on both design-time
Jason agents, namely, TuCSoN4JADE (Subsection IV-A) and                preference and run-time contingencies, without possibly hin-
TuCSoN4Jason (Subsection IV-B) respectively, emphasising               dering other ongoing coordination activities.
the technical solutions adopted to preserve conceptual integrity
of the resulting development framework—especially, w.r.t. au-          B. The case of TuCSoN4Jason
tonomy of agents. Subsection IV-C provides an example about
how a widely spread and well-known coordination scenario,                  In the case of Jason, the main integration issue is to
that is, a Contract Net Protocol based interaction, may benefit        make TuCSoN synchronous invocation semantics compatible
from a multi-paradigm coordination approach.                           with Jason concurrency model based on intentions. In fact,
                                                                       simply wrapping the TuCSoN API into suitable Jason abstrac-
A. The case of TuCSoN4JADE                                             tions, such as internal actions, would inevitably hinder Jason
                                                                       agents autonomy while resorting to objective coordination syn-
    An autonomy preserving integration of JADE and TuCSoN              chronously: their control flow would be coupled to that of the
was already presented in [11], with an emphasis on the impact          coordination operation requested, thus in case of suspension
that technical choices regarding concurrency and communi-              the whole agent would get stuck, not only the invoker intention.
cation aspects have on the opportunities for objective and
subjective coordination integration—also accounting for the               Yet again, agent deliberate choice to exploit objective
conceptual issues of autonomy of interacting agents. There,            coordination negatively affects their ongoing subjective co-
the main issue was making TuCSoN synchronous invocation                ordination activities, thus resulting in another failed attempt
semantics compatible with JADE concurrency model based on
behaviours.                                                              4 http://apice.unibo.it/xwiki/bin/view/TuCSoN/4JADE




                                                                  94
                                                        Figure 1: TuCSoN4Jason architecture



to fully enable multi-paradigm coordination. Thus, an ade-                      The set of internal actions, implemented by the
quate integration between TuCSoN and Jason requires a fine-                 public classes within package t4jn.api extending
grained integration of TuCSoN two-steps execution mecha-                    TucsonInternalActionImpl, is responsible for
nism with Jason intention suspension mechanism, properly                    providing Jason agents with the means to request TuCSoN
suspending/resuming intentions based on coordination oper-                  coordination services, that is, basically, the set of available
ations outcome: the TuCSoN4Jason bridge is the Java library                 coordination primitives. Besides the usual tuple space
providing such integration5 .                                               primitives such as out, rd, and in, primitive getResult
                                                                            deserves special attention: it is responsible for uncoupling
    First of all, we analyse the integration solution provided              the request of a coordination operation from its completion,
by TuCSoN4Jason from the architectural point of view, high-                 handling (automatic) intention suspension when the result of
lighting its main components—Figure 1:                                      a getter primitive (such as in) is not yet available.
   •    a custom agent architecture enabling customisation of
        each Jason agent inner reasoning engine
   •    an operation completion listener enabling TuCSoN to
        couple Jason intention suspension mechanism with its
        invocation semantics
   •    a set of custom internal actions enabling Jason agents
        to request TuCSoN coordination services and inspect
        operations outcome
The custom agent architecture, implemented by class
T4JnArchImpl, is responsible for dispatching coordination
operation requests from Jason agents to the TuCSoN service,
keeping track of pending as well as completed operations (in
collaboration with the other components), and coordinating the
other TuCSoN4Jason components.
     The operation completion listener, implemented by class
TucsonResultsHandler, is responsible for handling no-
tifications of operations completion coming from TuCSoN,
for tracking them within the custom agent architecture, (au-
tomatically) resuming suspended intentions when their result
becomes available, and unifying TuCSoN tuples (the operation
results) with Jason variables.
                                                                                   Figure 2: TuCSoN4Jason flow of interactions
 5 http://apice.unibo.it/xwiki/bin/view/TuCSoN/4Jason




                                                                       95
    Collaboration between components – as depicted in Fig- 1             ...
ure 2 – makes TuCSoN4Jason bridge capable of enabling 23                 // result NOT available
                                                                         if (!(results.containsKey(actionId))) {
autonomy-preserving multi-paradigm coordination for Jason 4                  Circumstance c = ts.getC();
agents, by carefully coupling Jason intention suspension mech- 5             // suspend calling intention
anism with TuCSoN two-step execution of suspensive primi- 67                 Intention i = c.getSelectedIntention();
                                                                             this.suspendIntention = true;
tives.                                                         8             i.setSuspended(true);
                                                                     9       c.addPendingIntention(
    Whenever a TuCSoN operation is requested (message 1), 10                     jason.stdlib.suspend.SELF_SUSPENDED_INT
through Jason custom internal actions, the bridge component 11 12
                                                                                 + i.getId(), i);
                                                                             // track suspended intention
– in particular, the custom agent architecture represented by 13             arch.getSuspendedIntentions().put(actionId, i);
interface T4JnArch – takes care of asynchronously dispatch- 14               mutex.unlock(); // thread-safety
ing the request to TuCSoN (message 1.1) by exploiting TuC- 15  16        }
                                                                             return true;

SoN services devoted to asynchronous operation invocation— 17            ...
not depicted to keep the picture simple. Then it tracks the
pending state of the requested operation (message 1.2) and
                                                                         Figure 3: Suspension of a Jason intention, due to
spawns a dedicated handler for its completion (message 1.3)—
                                                                         getResult() being called with no result available yet
TucsonResultsHandler. As soon as the operation is
ready to be completed, the handler is notified by TuCSoN with
the result (message 2), so that the state of the corresponding
operation can be changed from “pending” to “completed” 12                ...
                                                                         // corresponding action caused suspension
(message 2.1), and, if needed, resume the suspended intention 3          if (this.suspendedIntentions.containsKey(this.actionId)) {
within which TuCSoN4Jason getResult() internal action 4                      Intention suspendedIntention = this.suspendedIntentions
                                                                5                .remove(this.actionId);
was called (message 2.3, Figure 4).                             6            this.mutex.unlock(); // thread-safety
                                                                     7       ... // parse result
    It is worth noting that the notification may happen at any- 8            Circumstance c = this.ts.getC();
time, without prior knowledge on whether getResult() has 9                   // scan pending intentions
either been called or not. Dually, from the Jason agent stand- 10
                                                                11
                                                                             Iterator ik = c.getPendingIntentions().keySet()
                                                                                 .iterator();
point, there is no prior (design-time) knowledge on whether the 12           while (ik.hasNext()) {
operation succeeded until getResult() is (synchronously) 13                      String k = ik.next();
                                                                14               if (k.startsWith(suspend.SUSPENDED_INT)) {
called.                                                         15                   Intention i = c.getPendingIntentions().get(k);
    In fact, any Jason custom internal action has an asyn- 16    17
                                                                                     // find corresponding intention
                                                                                     if (i.equals(suspendedIntention)) {
chronous invocation semantics, that is, it does not wait for 18                          i.setSuspended(false);
operation completion, so that the agent is free to choose when 19                        ik.remove();
                                                                 20                      ... // other reasoner-related stuff
to ask for it whenever it pleases (message 3)—deliberatively. 21                         c.resumeIntention(i);
When doing so, the TuCSoN4Jason bridge checks if the 22                              }
operation result is available (message 3.1): if it is, the agent 23
                                                                 24          }
                                                                                 }

gets it and the current intention can proceed (message 3.2); 25          }
otherwise, the calling intention gets suspended (message 3.3, 26         ...
Figure 3), until the result becomes available.
    Figure 3 shows a code excerpt taken from the                         Figure 4: Resuming a previously suspended intention to due
getResult() custom internal action implementation. There,                its result becoming available
TuCSoN4Jason manipulates the state of the Jason reasoner be-
hind any Jason agent – thanks to T4JnArchImpl extending
Jason AgArch – so as to make it suspend the intention within
which getResult() was called, in case no result is available             choose, for every single interaction event, the coordination
yet. In particular, line 4 retrieves from the reasoner the current       paradigm that best suits their needs, based on both design-
execution context (Circumstance), line 6 gets the current                time preference and run-time contingencies, without hindering
intention (the one where getResult() was called), lines                  any other ongoing coordination activities.
8 − 13 actually suspend the intention.                                       Subjective coordination based on asynchronous message
    Figure 4, instead, shows a code excerpt taken from the               passing, handled with a reactive programming style based on
TucsonResultsHandler() component implementation.                         belief addition events (+b), can be seamlessly and simulta-
There, TuCSoN4Jason manipulates the state of the Jason                   neously exploited by Jason agents while they are objectively
reasoner so as to make it resume the intention within which              coordinating based on either
getResult() was called, as soon as its result becomes
available. In particular, line 4 tracks that such an intention              •    synchronous TuCSoN operations, emulated by fol-
is no longer pending, line 8 retrieves from the reasoner the                     lowing an operation invocation – asynchronous by
current execution context, lines 10 − 15 iterate over pending                    deafult – with an immediate call to getResult()
intentions according to the reasoner state, line 17 finds the
                                                                            •    asynchronous TuCSoN operations handled adopt-
intention to be resumed among the ones being iterated over,
                                                                                 ing a pro-active programming style, e.g. calling
lines 18 − 21 actually resume the intention.
                                                                                 getResult() as part of the Jason plan when the
   Summing up, TuCSoN4Jason lets Jason agents free to                            information is actually needed



                                                                 96
   •    asynchronous TuCSoN operations handled adopt-                  implemented to shield the caller intention. Thus it is stuck too,
        ing a reactive programming style, e.g. calling                 hindering the caller agent from scheduling other intentions in
        getResult() in a separate parallel plan dedicated              the meanwhile—in particular, the “purchase” interaction chain
        solely to handling the operation result—e.g. storing           (4b-5b) cannot carry on until a new call-for-proposals is issued.
        it as a belief, thus triggering belief addition plans,
                                                                           Figure 6 depicts the same scenario, now programmed upon
        or explicitly triggering dedicated plans processing the
                                                                       the TuCSoN4Jason bridge, thus preserving autonomy. Since
        result
                                                                       the rd call is shielded by a proper mechanism within the
                                                                       bridge, the suspensive semantics is confined to the caller inten-
C. Multi-paradigm CNP with TuCSoN4Jason                                tion. This means that only the caller intention is suspended –
    As a simple yet expressive example of multi-paradigm               using the proper mechanisms provided by Jason (see Figure 3)
coordination, we describe a book trading scenario implemented          – whereas other activities can carry on concurrently—e.g., the
as a Jason MAS—the example is included in TuCSoN4Jason                 purchase transaction already in place (4b-5b).
distribution. In particular, we re-interpret the well-known Con-           The wide applicability of the CNP, as well as its suitability
tract Net Protocol (CNP) [13] in a multi-paradigm coordination         for implementation as a multi-paradigm coordination protocol
setting, where part of the protocol relies on synchronous tuple-       – drawing from both objective and subjective, synchronous,
based objective coordination – delivered by TuCSoN – and               and asynchronous approaches – makes the concept of multi-
part on asynchronous message-based subjective coordination—            paradigm coordination quite relevant in the context of agent
built-in in Jason.                                                     development frameworks and coordination technologies—also
    In short, n seller agents advertise their catalogue of books,      making the need for suitable middleware components such as
whereas m buyer agents browse such catalogues looking for              TuCSoN4Jason quite apparent.
books. The whole interaction chain naturally follows FIPA
Contract Net Interaction Protocol [20]: buyers start a call-for-                  V.    D ISCUSSION & R ELATED W ORKS
proposals, sellers reply with actual proposals, buyers choose              In [21], CArtAgO [22] is integrated with three differ-
which one to accept, the purchase is carried out. A fundamental        ent agent development frameworks: Jason, 2APL [23], and
requirement – called concurrency property in the following –           simpA [24]. The approach taken is an example of autonomy-
is that sellers should stay reactive to call-for-proposals even        preserving integration: e.g., in the case of Jason-CArtAgO,
in the middle of a purchase transaction—otherwise they could           Jason intentions suspension mechanism is successfully inte-
lose potential revenues. The book trading scenario is thus taken       grated with CArtAgO artefacts by exploiting CArtAgO agent
here as a paradigmatic example of the practical relevance of           body abstraction. In particular, whenever a Jason agent re-
preserving autonomy while enabling multi-paradigm coordina-            quests execution of an operation on a CArtAgO artefact, the
tion.                                                                  caller intention is automatically suspended until the “effector
    Accordingly, we re-think the CNP by integrating objective          feedback” is received. Thus, nothing can hinder Jason agent
and subjective coordination approaches: tuple-based call-for-          autonomy if they simultaneously operate on artefacts while
proposals with message-based purchase. In fact, since the call-        exchanging messages with other agents.
for-proposals should reach all the sellers, putting a single call-         In [19], integration between JADE and TuCSoN tech-
for-proposals tuple in a shared contract-net space is more effi-       nologies is successfully achieved, allowing JADE agents to
cient than messaging each seller individually. On the contrary,        exploit TuCSoN coordination services as part of the JADE
since the purchase is typically a 1-to-1 interaction, messaging        platform. However, without preserving autonomy. JADE model
can efficiently do the job. As a result, this approach is not just     of autonomy and TuCSoN model of coordination [11] were
conceptually correct, but also more efficient—less messages,           not considered: in fact, if a coordination operation gets sus-
less network operations, etc.                                          pended, the caller behaviour is unavoidably suspended, too,
     For the purpose of comparison, we first attempt to imple-         because of its single thread of control being stuck waiting for
ment the MAS without exploiting TuCSoN4JADE, just directly             operation completion. This inevitably leads to the suspension
calling TuCSoN API from within Jason with Jason internal               of all other behaviours the agent is (possibly) concurrently
actions without further concerns (Figure 5); then we repeat            executing. Roughly speaking, the agent choice to rely on
the same exercise by relying on TuCSoN4Jason (Figure 6).               objective coordination may affect its ongoing subjective co-
As one could expect, the result is that in the former case the         ordination activities. This is a clear example of an artificial
concurrency property – thus, agent autonomy – is lost, whereas         dependency (unintentionally) created by a “non autonomy-
it is preserved as expected in the latter.                             preserving” approach.
    Figure 5 depicts one possible instance of the run-time
                                                                                       VI.   C ONCLUSION & O UTLOOK
interactions between a given seller and a given buyer. In
particular, the seller is replying to a previous call-for-proposals        Enabling multi-paradigm coordination along a number of
(message 3b). Meanwhile, it is also ready to serve new                 orthogonal dimensions of coordination – such as objective
incoming call-for-proposals (3a). Here is the problem: the             vs. subjective stance, synchronism of coordination primitive
suspensive coordination operation rd gets stuck until a call-          invocation, reactiveness of the programming style promoted
for-proposals is issued by a buyer. This is fine: it is exactly        by the API – potentially brings about a wide range of
for this suspensive semantics that the L INDA model works.             communication, synchronisation, namely, coordination-related
What is not-so-fine is that the rd is stuck on a network-level         requirements to be satisfied, whenever the coordinables are
call and no “defensive” programming mechanism has been                 provided with the ability to change the way they exploit



                                                                  97
Figure 5: Non autonomy-preserving approach taken in [19]: rd suspensive semantics extends to the caller behaviour, then to the
caller agent, blocking all its activities.




Figure 6: TuCSoN4Jason autonomy-preserving approach to multi-paradigm coordination: rd suspensive semantics is confined
to the caller intention only, thus the caller agent can carry on its other concurrent intentions.



coordination services at run-time, depending on preference or     MAS [25], where, besides distribution and heterogeneity, also
ever-changing, unpredictable contingencies.                       autonomy and (situated) intelligence typically play a key
                                                                  role: autonomy, for infusing the system with non-functional
   For these reasons, technologies like TuCSoN4Jason and
                                                                  properties such as tolerance to failures, situated intelligence
TuCSoN4JADE may be key-enablers in all those application
                                                                  for improving the system effectiveness by leveraging reasoning
scenarios featuring distributed and heterogeneous components
                                                                  over, e.g., contextual information.
which, on the one hand, heavily depends on communication
and coordination to carry out their duties, on the other hand,        The fact that Jason adopts the BDI model for agents,
may need to adopt diverse coordination paradigms depending        coupled with TuCSoN choice of working with first-order
on both their own capabilities and run-time contingencies.        logic tuples, makes TuCSoN4Jason even more relevant for
Such a sort of scenarios are usually dealt with by pervasive      the aforementioned class of systems.



                                                             98
    In the near future, we plan to further strengthen integration                  [14] Foundation for Intelligent Physical Agents, “FIPA Communicative
between TuCSoN and both Jason and JADE: for the former,                                 Act Library Specification,” http://www.fipa.org/specs/fipa00037/, 6 Dec.
private tuple spaces as belief bases and shared tuple spaces                            2002.
as environmental resources are both directions we wish to                          [15] A. S. Rao, “AgentSpeak(L): BDI agents speak out in a logical
                                                                                        computable language,” in Agents Breaking Away, ser. Lecture Notes in
explore; for the latter, we envision automatic translation back                         Computer Science, W. Van de Velde and J. W. Perram, Eds. Springer,
and forth FIPA ACL messages and first-order logic tuples, as                            1996, vol. 1038, pp. 42–55, 7th European Workshop on Modelling
well as support for tuple-based FIPA interaction protocols.                             Autonomous Agents in a Multi-Agent World (MAAMAW’96),
                                                                                        Eindhoven, The Netherlands, 22-25 Jan. 1996, Proceedings. [Online].
                                                                                        Available: http://link.springer.com/10.1007/BFb0031845
                              R EFERENCES
                                                                                   [16] A. Omicini and F. Zambonelli, “Coordination for Internet application
 [1]   A. Omicini and S. Ossowski, “Objective versus subjective coordination            development,” Autonomous Agents and Multi-Agent Systems, vol. 2,
       in the engineering of agent systems,” in Intelligent Information Agents:         no. 3, pp. 251–269, Sep. 1999, Special Issue: Coordination Mechanisms
       An AgentLink Perspective, ser. Lecture Notes in Computer Science,                for Web Agents. [Online]. Available: http://link.springer.com/10.1023/
       M. Klusch, S. Bergamaschi, P. Edwards, and P. Petta, Eds. Springer               A:1010060322135
       Berlin Heidelberg, 2003, vol. 2586, pp. 179–202. [Online]. Available:
                                                                                   [17] A. Omicini and E. Denti, “From tuple spaces to tuple centres,”
       http://link.springer.com/10.1007/3-540-36561-3 9
                                                                                        Science of Computer Programming, vol. 41, no. 3, pp. 277–294,
 [2]   P. Ciancarini, “Coordination models and languages as software                    Nov. 2001. [Online]. Available: http://www.sciencedirect.com/science/
       integrators,” ACM Computing Surveys, vol. 28, no. 2, pp. 300–302, Jun.           article/pii/S0167642301000119
       1996. [Online]. Available: http://portal.acm.org/citation.cfm?id=234732
                                                                                   [18] A. Omicini, “Towards a notion of agent coordination context,” in
 [3]   A. Omicini, A. Ricci, and M. Viroli, “Coordination artifacts as                  Process Coordination and Ubiquitous Computing, D. C. Marinescu and
       first-class abstractions for MAS engineering: State of the research,”            C. Lee, Eds. Boca Raton, FL, USA: CRC Press, Oct. 2002, ch. 12,
       in Software Engineering for Multi-Agent Systems IV: Research Issues              pp. 187–200.
       and Practical Applications, ser. Lecture Notes in Computer Science,
                                                                                   [19] A. Omicini, A. Ricci, M. Viroli, M. Cioffi, and G. Rimassa,
       A. F. Garcia, R. Choren, C. Lucena, P. Giorgini, T. Holvoet,
                                                                                        “Multi-agent infrastructures for objective and subjective coordination,”
       and A. Romanovsky, Eds. Springer Berlin Heidelberg, Apr.
                                                                                        Applied Artificial Intelligence: An International Journal, vol. 18,
       2006, vol. 3914, pp. 71–90, invited Paper. [Online]. Available:
                                                                                        no. 9–10, pp. 815–831, Oct.–Dec. 2004, special Issue: Best papers
       http://link.springer.com/10.1007/11738817 5
                                                                                        from EUMAS 2003: The 1st European Workshop on Multi-agent
 [4]   M. Viroli and A. Omicini, “Coordination as a service,” Fundamenta                Systems. [Online]. Available: http://www.tandfonline.com/doi/10.1080/
       Informaticae, vol. 73, no. 4, pp. 507–534, 2006, Special Issue: Best             08839510490509036
       papers of FOCLASA 2002. [Online]. Available: http://content.iospress.
                                                                                   [20] Foundation for Intelligent Physical Agents, “FIPA Contract Net In-
       com/articles/fundamenta-informaticae/fi73-4-04
                                                                                        teraction Protocol specification,” http://www.fipa.org/specs/fipa00029/,
 [5]   C. Castelfranchi, “Modelling social action for AI agents,” Artificial            6 Dec. 2002.
       Intelligence, vol. 103, no. 1-2, pp. 157–182, Aug. 1998.
                                                                                   [21] A. Ricci, M. Piunti, L. D. Acay, R. H. Bordini, J. Hübner,
       [Online]. Available: http://www.sciencedirect.com/science/article/pii/
                                                                                        and M. Dastani, “Integrating heterogeneous agent programming
       S0004370298000563
                                                                                        platforms within artifact-based environments,” in 7th International
 [6]   T. W. Malone and K. Crowston, “The interdisciplinary study of                    Joint Conference on Autonomous Agents and Multiagent Systems
       coordination,” ACM Computing Surveys, vol. 26, no. 1, pp. 87–119,                (AAMAS-08), L. Padgham and D. C. Parkes, Eds. Estoril, Portugal:
       1994. [Online]. Available: http://dl.acm.org/citation.cfm?doid=174668            IFAAMAS, 12–16 May 2008, pp. 225–232. [Online]. Available:
 [7]   G. M. O’Hare and N. R. Jennings, Eds., Foundations of Distributed                http://dl.acm.org/citation.cfm?id=1402419
       Artificial Intelligence, ser. Sixth-Generation Computer Technology.         [22] A. Ricci, M. Viroli, and A. Omicini, “CArtAgO: A framework for
       John Wiley & Sons, Apr. 1996. [Online]. Available: http://eu.wiley.              prototyping artifact-based environments in MAS,” in Environments for
       com/WileyCDA/WileyTitle/productCd-0471006750.html                                MultiAgent Systems III, ser. Lecture Notes in Artificial Intelligence,
 [8]   D. Gelernter, “Generative communication in Linda,” ACM Transactions              D. Weyns, H. V. D. Parunak, and F. Michel, Eds. Springer,
       on Programming Languages and Systems, vol. 7, no. 1, pp. 80–112, Jan.            May 2007, vol. 4389, pp. 67–86, 3rd International Workshop
       1985. [Online]. Available: http://dl.acm.org/citation.cfm?doid=2433              (E4MAS 2006), Hakodate, Japan, 8 May 2006. Selected Revised and
 [9]   F. L. Bellifemine, A. Poggi, and G. Rimassa, “JADE–a FIPA-compliant              Invited Papers. [Online]. Available: http://link.springer.com/10.1007/
       agent framework,” in 4th International Conference and Exhibition                 978-3-540-71103-2 4
       on the Practical Application of Intelligent Agents and Multi-Agent          [23] M. Dastani and J.-J. C. Meyer, “A practical agent programming
       Technology (PAAM-99). London, UK: The Practical Application                      language,” in Programming Multi-Agent Systems, ser. Lecture Notes in
       Company Ltd., 19–21 Apr. 1999, pp. 97–108. [Online]. Available:                  Computer Science, M. Dastani, A. El Fallah Seghrouchni, A. Ricci,
       http://jade.cselt.it/papers/PAAM.pdf                                             and M. Winikoff, Eds. Springer, 2008, vol. 4908, pp. 107–123,
[10]   R. H. Bordini, J. F. Hübner, and M. J. Wooldridge, Programming                  5th International Workshop, ProMAS 2007 Honolulu, HI, USA,
       Multi-Agent Systems in AgentSpeak using Jason. John Wiley & Sons,                May 15, 2007 Revised and Invited Papers. [Online]. Available:
       Ltd, Oct. 2007. [Online]. Available: http://eu.wiley.com/WileyCDA/               http://link.springer.com/10.1007/978-3-540-79043-3 7
       WileyTitle/productCd-0470029005.html                                        [24] A. Ricci, M. Viroli, and G. Piancastelli, “simpA: A simple agent-
[11]   S. Mariani, A. Omicini, and L. Sangiorgi, “Models of autonomy and                oriented Java extension for developing concurrent applications,” in
       coordination: Integrating subjective & objective approaches in agent             Languages, Methodologies and Development Tools for Multi-Agent
       development frameworks,” in Intelligent Distributed Computing VIII,              Systems, ser. Lecture Notes in Computer Science. Springer, Jul. 2008,
       ser. Studies in Computational Intelligence, L. Braubach, D. Camacho,             vol. 5118, pp. 261–278, 1st International Workshop, LADS 2007,
       and S. Venticinque, Eds., vol. 570. Springer, 2014, pp. 69–79, 8th               Durham, UK, September 4-6, 2007. Revised Selected Papers. [Online].
       International Symposium on Intelligent Distributed Computing (IDC                Available: http://link.springer.com/10.1007/978-3-540-85058-8 16
       2014), Madrid, Spain, 3-5 Sep. 2014. Proceedings. [Online]. Available:      [25] F. Zambonelli, A. Omicini, B. Anzengruber, G. Castelli, F. L.
       http://link.springer.com/10.1007/978-3-319-10422-5 9                             DeAngelis, G. Di Marzo Serugendo, S. Dobson, J. L. Fernandez-
[12]   F. Bellifemine, G. Caire, T. Trucco, and G. Rimassa, “JADE program-              Marquez, A. Ferscha, M. Mamei, S. Mariani, A. Molesini, S. Montagna,
       mer’s guide,” http://jade.tilab.com/doc/programmersguide.pdf, Telecom            J. Nieminen, D. Pianini, M. Risoldi, A. Rosi, G. Stevenson, M. Viroli,
       Italia S.p.A., Apr. 2010.                                                        and J. Ye, “Developing pervasive multi-agent systems with nature-
                                                                                        inspired coordination,” Pervasive and Mobile Computing, vol. 17,
[13]   R. G. Smith, “The Contract Net Protocol: High-level communication                pp. 236–252, Feb. 2015, Special Issue “10 years of Pervasive
       and control in a distributed problem solver,” IEEE Transactions on               Computing” In Honor of Chatschik Bisdikian. [Online]. Available:
       Computers, vol. C-29, no. 12, pp. 1104–1113, 1980. [Online]. Available:          http://www.sciencedirect.com/science/article/pii/S1574119214001904
       http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=1675516




                                                                              99