JBotSim : a Tool for Fast Prototyping of Distributed Algorithms in Dynamic Networks

JBOTSIM is a java library that offers basic primitives for prototyping, running, and visualizing distributed algorithms in dynamic networks. With JBOTSIM, one can implement an idea in minutes and interact with it (e.g., add, move, or delete nodes) while it is running. JBOTSIM is well suited to prepare live demonstrations of algorithms to colleagues or students; it can also be used to evaluate performance at the algorithmic level (number of messages, number of rounds, etc.). Unlike most simulation tools, JBOTSIM is not an integrated environment. It is a lightweight library to be used in java programs. In this paper, I present an overview of its distinctive features and architecture.


INTRODUCTION
JBotSim is an open source simulation library dedicated to distributed algorithms in dynamic networks.I developed it with the purpose in mind to make it possible to implement an algorithmic idea in minutes and interact with it while it is running (e.g., add, move, or delete nodes).JBOTSIM can also be used to prepare live demos of an algorithm and show it to colleagues or students, as well as to assess the algorithm performance.It is not a competitor of mainstream tools like NS3 [3], OMNet [7], or The One [6], as it does not aim to implement real-world networking protocols.Quite the opposite, JBOTSIM aims to remain technology-insensitive and to be used at the algorithmic level, in a way closer in spirit to the ViSiDiA project (a general-purpose platform for distributed algorithms).Unlike ViSiDiA, however, JBOTSIM natively supports mobility and dynamic networks (as well as wireless communication).Another major difference with the above tools is that it is a library rather than a software: its purpose is to be used in other programs, whether these programs are simple scenarios of full-fledged software.Finally, JBOTSIM is distributed under the terms of the LGPL licence, which makes it easily extensible by the community.
Whether the algorithms are centralized or distributed, the natural way of programming in JBOTSIM is event-driven: algorithms are specified as subroutines to be executed when particular events occur (appearance or disappearance of a link, arrival of a message, clock pulse, etc.).Movements of the nodes can be controlled either by program or by means of live interaction with the mouse (adding, deleting, or moving nodes around with left-click, rightclick, or drag and drop, respectively).These movements are typically performed while the algorithm is running, in order to visualize it or test its behavior in challenging configurations.
JBotSim comes as a JAR package that can be found on the website [1].Once in the classpath, one can start using the API.Please refer to the long version of this paper for more information regarding installation, first steps, or the API.An online javadoc is also available.Besides its features, the main asset of JBotSim is its simplicity of use.A basic program is shown on Listing 1.It results in a gray surface where nodes can be added, moved, or deleted using the mouse.

OVERVIEW
JBOTSIM consists of a small number of classes, the most central being Node, Link, and Topology.Nodes may or may not possess wireless communication capabilities, sensing abilities, or self-mobility.They may differ in clock frequency, color, communication range, or any other user-defined property.Links between the nodes account for potential communication among them.Link can be directed or undirected, and wired or wireless -in the latter case, JBOTSIM updates the set of links automatically.   1 depicts a highway scenario where three types of nodes are used: vehicles, road-side units (towers), and central servers.This scenario is semi-infrastructured: part of the network is wired and static, the other part is wireless and dynamic.Figure 2 illustrates a purely ad hoc scenario, where swarms of UAVs and robots strive to clean a public park collectively.In this scenario, robots can clean wastes of a certain type (red or blue) only if these are within their sensing range (depicted by a surrounding circle).UAVs detect the wastes and provide their location to the robots.

Distributed vs. centralized algorithms
JBOTSIM supports the manipulation of centralized or distributed algorithms (possibly simultaneously).The natural way to implement a distributed algorithm is by extending the Node class, in which the desired behavior is implemented.Centralized algorithms are not constrained to a particular model, they can take the form of any standard java class (and yet, rely on the API as needed).

Distributed algorithm.
JBOTSIM comes with a default type of node that is implemented in the Node class.This class provides general features for moving or exchanging messages, among others.Distributed algorithms are implemented through extending this class.Listing 2 provides a basic example in which the nodes are endowed with self-mobility.In this example the onClock() method is overridden in order to perform some action (here, moving) periodically.The rest of the code is responsible for setting a random direction at construction time (in radian).
Once this class is defined, new nodes of this type can be added to the topology either manually, e.g. using tp.addNode(), or by telling JBOTSIM that new nodes should, by default, be of this type (setDefaultNodeModel(MovingNode.class)).Several models can be registered, in which case JBOTSIM's GUI displays a selection list when a node is added.

Figure 1 :
Figure 1: A highway scenario composed of vehicles, road-side units, and central servers.

Figures 1
Figures 1 and 2 illustrate two different uses of JBOTSIM.Figure1depicts a highway scenario where three types of nodes are used: vehicles, road-side units (towers), and central servers.This scenario is semi-infrastructured: part of the network is wired and static, the other part is wireless and dynamic.Figure2illustrates a purely ad hoc scenario, where swarms of UAVs and robots strive to clean a public park collectively.In this scenario, robots can clean wastes of a certain type (red or blue) only if these are within their sensing range (depicted by a surrounding circle).UAVs detect the wastes and provide their location to the robots.

Figure 2 :
Figure 2: A swarming scenario, whereby mobiles robots and UAVs collaborate in order to clean a public park.