Download - Space-aware Coordination in RespecT
Space-aware Coordination in ReSpecT
Stefano Mariani Andrea Omicini{s.mariani, andrea.omicini}@unibo.it
DISIAlma Mater Studiorum—Universita di Bologna
WOA 2013Torino, Italy
2 December 2013
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 1 / 42
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 2 / 42
Motivations & Goals
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 3 / 42
Motivations & Goals
The Need for Spatial Coordination
Spatial issues are fundamental in many sorts of complex software systems,including intelligent, multi-agent, adaptive, and self-organising ones[Beal et al., 2011].
Spatial coordination
Understanding the basic mechanisms of spatial coordination is afundamental issue for coordination models and languages in order togovern situated interaction in the spatio-temporal fabric.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 4 / 42
Motivations & Goals
Goal of the Work
In this work we aim at
devising out
the fundamental abstractionsthe basic mechanismsthe linguistic constructs
required to generally enable and promote space-aware coordination
defining their embodiment in terms of
the tuple centre coordination mediumthe ReSpecT coordination language
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 5 / 42
Motivations & Goals
Outline of the Work
Along this line, we
discuss the issues of spatial coordination
devise out the general requirements for space-aware coordinationmedia
introduce the specific notion of space-aware tuple centre
show how the ReSpecT coordination language can be extended so asto support space-aware coordination
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 6 / 42
Space-aware Coordination Media
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 7 / 42
Space-aware Coordination Media Spatial issues
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 8 / 42
Space-aware Coordination Media Spatial issues
Situatedness & Awareness I
Spatial coordination requires
spatial situatedness
spatial awareness
of the coordination media
This translates in a number of technical requirements
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 9 / 42
Space-aware Coordination Media Spatial issues
Situatedness & Awareness II
Situatedness
A space-aware coordination abstraction should at any time be associatedto an absolute positioning, both physical and virtual
In fact,
software abstractions may move along a virtual space – typically, thenetwork – which is usually discrete
whereas physical devices move through a physical space, which ismostly continuous
However, software abstractions may also be hosted by mobile physicaldevices, thus share their motion.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 10 / 42
Space-aware Coordination Media Spatial issues
Situatedness & Awareness III
Awareness
The position of the coordination medium should be available to thecoordination laws it contains in order to make them capable of reasoningabout space—so, to implement space-aware coordination laws.
Also, space has to be embedded into the working cycle of the coordinationmedium:
a spatial event should be generated within a coordination medium,conceptually corresponding to changes in space
then, such events should be captured by the coordination medium,and used to activate space-aware coordination laws
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 11 / 42
Space-aware Coordination Media Space-aware tuple centres
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 12 / 42
Space-aware Coordination Media Space-aware tuple centres
Tuple Centres
Technically, a tuple centre is a programmable tuple space, i.e., a tuplespace whose behaviour in response to (coordination) events can beprogrammed so as to specify and enact any coordination policy[Omicini and Denti, 2001b, Omicini, 2007].
General-purpose coordination media
Tuple centres can then be thought as general-purpose coordinationabstractions, which can be suitably forged to provide specific coordinationservices.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 13 / 42
Space-aware Coordination Media Space-aware tuple centres
Space-aware Tuple Centres I
The location of a tuple centre is obtained through the notion ofcurrent place
i.e., the absolute position of the computational device where thecoordination medium is running, or the domain name of node hostingthe tuple centre
Motion is conceptually represented by two sorts of spatial events:
leaving from a starting placestopping at an arrival place
in any sort of space / place
Analogously to (coordination) operation and time events, it ispossible to specify reactions triggered by spatial events—the so-calledspatial reactions
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 14 / 42
Space-aware Coordination Media Space-aware tuple centres
Space-aware Tuple Centres II
Space-aware coordination policies
As a result, a spatial tuple centre
can be programmed to react to motion in either a physical or a virtualspace
so as to enforce space-aware coordination policies.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 15 / 42
Spatial ReSpecT
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 16 / 42
Spatial ReSpecT Basic ReSpecT
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 17 / 42
Spatial ReSpecT Basic ReSpecT
ReSpecT I
ReSpecT tuple centres
ReSpecT tuple centres are based on first-order logic (FOL), which isadopted both for the communication language (logic tuples), and for thebehaviour specification language (ReSpecT) [Omicini and Denti, 2001a].
Basically, reactions in ReSpecT are defined as Prolog-like facts(reaction specification tuples) of the form
reaction(Activity , Guards , Reactions )
A reaction specification tuple specifies the list of the operations(Reactions ) to be executed when a given event occurs (calledtriggering event, caused by an Activity ) and some conditions on theevent hold (Guards evaluate to true).
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 18 / 42
Spatial ReSpecT Basic ReSpecT
ReSpecT II
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 19 / 42
Spatial ReSpecT Language extension
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 20 / 42
Spatial ReSpecT Language extension
Spatial Observation Predicates
current place(@S ,?P ) succeeds if P unifies with the position of the nodewhich the tuple centre belongs to
event place(@S ,?P ) succeeds if P unifies with the position of the nodewhere the triggering event was originated
start place(@S ,?P ) succeeds if P unifies with the position of the nodewhere the event chain that led to the triggering event wasoriginated
The node position can be specified as either
S =ph its absolute physical position
S =ip its IP number
S =dns its domain name
S =map its geographical location—as typically defined by mapping serviceslike Google Maps
S =org its organisational position—that is, a location within anorganisation-defined virtual topology
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 21 / 42
Spatial ReSpecT Language extension
Spatial Guard Predicates
at(@S ,@P ) succeeds when the tuple centre is currently executing at theposition P , specified according to S
near(@S ,@P ,@R ) succeeds when the tuple centre is currently executing atthe position included in the spatial region with centre P andradius R , specified according to S
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 22 / 42
Spatial ReSpecT Language extension
Spatial Event Descriptors
from(?S ,?P ) matches a spatial event raised when the device hosting thetuple centre starts moving from position P , specifiedaccording to S .
to(?S ,?P ) matches a spatial event raised when the device hosting thetuple centre stops moving and reaches position P , specifiedaccording to S .
As a result, the following are admissible reaction specification tuplesdealing with spatial events:
reaction(from(?Space ,?Place ), Guards , Reactions ).
reaction(to(?Space ,?Place ), Guards , Reactions ).
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 23 / 42
Spatial ReSpecT Language extension
Spatial Extension
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 24 / 42
Spatial ReSpecT Virtual Machine extension
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 25 / 42
Spatial ReSpecT Virtual Machine extension
Extended Event Model I
The first fundamental extension to the event model is clearly depictedin Table II: a new sort of spatial 〈Activity〉 is introduced
! In particular, the notion of 〈Situation〉 activity is extended with the twospatial activities from( 〈Space〉 〈Place〉 ), to( 〈Space〉 〈Place〉 )
Another issue is represented by spatial qualification of events, that is,making all ReSpecT events featuring spatial properties—in the sameway as for temporal properties in [Omicini et al., 2005]
! This is represented by the 〈Space:Place〉 property featured by 〈Cause〉– and 〈StartCause〉, of course –, as shown in Table III, where theextended ReSpecT event model is depicted.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 26 / 42
Spatial ReSpecT Virtual Machine extension
Extended Event Model II
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 27 / 42
Spatial ReSpecT Virtual Machine extension
Extended Transition System I
The operational semantics of a ReSpecT tuple centre is expressed bya transition system over a state represented by the labelled tripleOpE ,SitE〈Tu,Re,Op〉OutE
n [Casadei and Omicini, 2009]—abstractingaway from the specification tuples Σ
OutE is automatically emptied by emitting the outgoing events
In the same way, OpE and SitE are automatically extended whenevera new incoming (either operation or situation) event enters a tuplecentre
! In particular, SitE is added new environment events by the associatedtransducers [Casadei and Omicini, 2009], new time events by the flowof time [Omicini et al., 2005], and also new spatial events wheneversome sort of motion takes place
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 28 / 42
Spatial ReSpecT Virtual Machine extension
Extended Transition System II
The behaviour of a ReSpecT tuple centre is modelled by a transitionsystem composed of four different transitions[Casadei and Omicini, 2009]: reaction (−→r ), situation (−→s),operation (−→o), log (−→l)
! Quite intuitively, spatial events are handled – in the same way as timeand environment events – by the situation transition, which triggersReSpecT spatial reactions
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 29 / 42
Expressiveness via Examples
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 30 / 42
Expressiveness via Examples
Spheric Broadcasting I
Requirements:
a message has to be locally spread in the environment (e.g. networkof nodes), so as to be perceived only by nearby agents
you want to do so through a distributed, collaborative disseminationprocess
the distance defining “locally” can be thought of as a “straight-line”radius, identifying a three-dimensional sphere around the point wherethe message is firstly created
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 31 / 42
Expressiveness via Examples
Spheric Broadcasting II
1 % 1) Get agent message
2 % 1.1) Delete garbage tuple
3 ...
4 % 1.2) Check range then forward
5 reaction( out(spheric(Msg,Radius )),
6 (operation,completion),
7 ( current_place(ph,RecPos), % Current position
8 start_place(ph,SendPos), % Starting position
9 in_range(RecPos,SendPos,Radius), % Prolog computation
10 start_source(Sender), start_time(Time),
11 out(msg(Msg,Sender,Time )),
12 rd(neighbours(Nbrs)), List of neighbours
13 out(forward(Nbrs,Msg,Radius )) )).
14 % 2) Forward to every neighbour
15 % 2.1) Delete garbage tuple
16 ...
17 % 2.2) Neighbour list not empty
18 reaction( out(forward ([Nbr|Nbrs],Msg,Radius )),
19 internal,
20 ( Nbr ? out(spheric(Msg,Radius )), % Forward
21 out(forward(Nbrs,Msg,Radius )) )). % Iterate
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 32 / 42
Expressiveness via Examples
Spheric Broadcasting III
Given a virtual topology is reified in the tuple neighbours, we getthat any message embedded in a spheric tuple is autonomouslyspread solely to Radius-reachable neighbouring tuple centres
This is made possible by the start place/1 observation predicate,inspecting the place where the first spheric broadcast request wasissued—regardless of the number of tuple centre hops taken toforward the request
“Basic”, spatial-coordination mechanisms
? What if we replace current place(ph,RecPos) withcurrent place(dns,RecPos)?
? What if we replace start place with event place?
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 33 / 42
Expressiveness via Examples
Monitored Motion I
Requirements:
you have an autonomous mobile device – e.g. a simplewheel-equipped robot – that has to reach a given destination
this implies that the mobile device should
start moving when asked to do somonitor its own position so as to understand when given destination isreached, if obstacles are on its way, etc.finally stop when due
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 34 / 42
Expressiveness via Examples
Monitored Motion II
1 % 1) Compute motion vector then start moving
2 reaction( out(move(Dest,TStep )), (operation,completion),
3 ( current_place(ph,Here), current_time(Now),
4 Check is Now+TStep,
5 direction(Dest,Here,Vec), % Prolog computation
6 out_s( ... ), % Schedule monitoring (Reaction 2)
7 current_target(_@Node), % Get node id
8 motion_dev@Node <- env(dir,Vec), % Set direction
9 motion_dev@Node <- env(engine, ’on’) )). % Move on
10 % 2) Monitor destination arrival
11 reaction( time(Check), internal, % Time to check
12 ( current_place(ph,Here),
13 rd(move(Dest,TStep )),
14 ( check(Here,Dest), % Prolog computation
15 current_target(_@Node), % Get node id
16 motion_dev@Node <- env(engine, ’off’)
17 ; % Prolog ’if-then-else ’
18 current_time(Now), Check is Now+TStep,
19 out_s( ... ) ))). % Schedule monitoring (Reaction 2)
20 % 3) Arrival clean-up
21 reaction( to(Dest), internal, in(move(Dest,_ )) ). % Dest. reached
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 35 / 42
Conclusion, Ongoing & Future Work
Outline
1 Motivations & Goals
2 Space-aware Coordination MediaSpatial issuesSpace-aware tuple centres
3 Spatial ReSpecTBasic ReSpecTLanguage extensionVirtual Machine extension
4 Expressiveness via Examples
5 Conclusion, Ongoing & Future Work
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 36 / 42
Conclusion, Ongoing & Future Work
Conclusion
Spatial situation is a requirement for many advanced applicationscenarios
Coordination models should be enhanced to handle situatedinteraction
Coordination media should be enhanced to address all the need ofspace-aware coordination
Tuple centres can be extended to become space-aware coordinationmedia
ReSpecT can be extended to enable space-aware coordination policies
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 37 / 42
Conclusion, Ongoing & Future Work
Ongoing & Future Work
Implementation of space-aware ReSpecT tuple centres completed
ReSpecT tuple centres provided as coordination media of theTuCSoN coordination middleware [TuCSoN, 2013]
Android version in beta version
Experiments on Android devices and mobile computers
Spatial transducers for a range of diverse mobile sensors & devices
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 38 / 42
References
References I
Beal, J., Michel, O., and Schultz, U. P. (2011).
Spatial computing: Distributed systems that take advantage of our geometricworld.
ACM Trans. Auton. Adapt. Syst., 6(2):11:1–11:3.
Casadei, M. and Omicini, A. (2009).
Situated tuple centres in ReSpecT.
In Shin, S. Y., Ossowski, S., Menezes, R., and Viroli, M., editors, 24th AnnualACM Symposium on Applied Computing (SAC 2009), volume III, pages1361–1368, Honolulu, Hawai’i, USA. ACM.
Omicini, A. (2007).
Formal ReSpecT in the A&A perspective.
Electronic Notes in Theoretical Computer Science, 175(2):97–117.
5th International Workshop on Foundations of Coordination Languages andSoftware Architectures (FOCLASA’06), CONCUR’06, Bonn, Germany,31 August 2006. Post-proceedings.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 39 / 42
References
References II
Omicini, A. and Denti, E. (2001a).
Formal ReSpecT.
Electronic Notes in Theoretical Computer Science, 48:179–196.
Declarative Programming – Selected Papers from AGP 2000, La Habana, Cuba,4–6 December 2000.
Omicini, A. and Denti, E. (2001b).
From tuple spaces to tuple centres.
Science of Computer Programming, 41(3):277–294.
Omicini, A., Ricci, A., and Viroli, M. (2005).
Time-aware coordination in ReSpecT.
In Jacquet, J.-M. and Picco, G. P., editors, Coordination Models and Languages,volume 3454 of LNCS, pages 268–282. Springer-Verlag.
7th International Conference (COORDINATION 2005), Namur, Belgium,20–23 April 2005. Proceedings.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 40 / 42
References
References III
TuCSoN (2013).
Home page.
http://tucson.unibo.it/.
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 41 / 42
Space-aware Coordination in ReSpecT
Stefano Mariani Andrea Omicini{s.mariani, andrea.omicini}@unibo.it
DISIAlma Mater Studiorum—Universita di Bologna
WOA 2013Torino, Italy
2 December 2013
Mariani, Omicini (DISI, Alma Mater) Space-aware ReSpecT WOA 2013, 2/12/2013 42 / 42