# Virtual Pheromone Based Network Flow Control For Modular Robotic Systems
## 3 Virtual Pheromone Based Network Flow Control
### Virtual Pheromone-Based Routing Algorithm  
In nature, ants lay their pheromone on the trail. Ants use pheromone as implicit communication to search for the optimal path between food sources and their nest. At the beginning, ants randomly spread their pheromone out during their searching and exploration. Ants instinctively select their paths based on the pheromone concentration--the highest probability is selected. The more ants on a path, the higher the pheromone concentration on that direction, and the higher the pheromone concentration, the higher possibility the number of ants selecting this way. There might exist multiple paths between food sources and the nest but the path with the highest pheromone concentration becomes an optimal path as it is highly selected by ants. The pheromone concentration on an existing path is automatically evaporated over time, thus ants can search for new food sources when less food available on the existing food sources. In general, number of ants travelling on a path is proportional to the pheromone concentration of such a path. Therefore, ant pheromone-based path formation and selection is done in a distributed fashion. Inspired from ant pheromone-based path formation and selection, we develop a routing algorithm using virtual pheromone for selecting and creating communication paths in modular robotics. On a robotic module, a data packet is considered as a virtual ant when received in or sent out from a physical communication channel, thus virtual pheromone of such a virtual ant is accumulated on such a physical channel of the robotic module. The more virtual ants going through a physical channel, the higher virtual pheromone concentration accumulated on it. To maintain the balance of the overall virtual pheromone on a module, increasing pheromone concentration on one physical channel leads to decreasing pheromone concentration on other channels. Hence, virtual pheromone concentration becomes the key factor for physical channel selection on a robotic module: the higher pheromone concentration on a physical channel, the higher possibility the channel being selected as the communication path. A simple scenario of selecting a physical communication channel is illustrated in Figure 3.  
Assuming a module with \(N\) neighbouring modules connected on \(N\) physical channels, an analytical model of virtual pheromone on a physical communication channel \(i\) is composed of the following fundamental parameters:  
_The pheromone deposition rate \(d\)_: A virtual ant passing through a physical communication channel \(i\) leaves an amount of virtual pheromone on the channel. Consequently, the pheromone concentration \(C_{i}\) of such a channel is adjusted:  
\[C_{i}(t_{2})=C_{i}(t_{1})+(N-2)d \tag{7}\]  
with \(N>2\) is the condition for virtual pheromone to operate on each channel. The pheromone concentration of the other channels \(C_{j}\) is re-adjusted accordingly:  
Figure 3: An example of an intersection module receiving a data packet—corresponding to a virtual ant—and uses the probabilistic switching based on the virtual pheromone concentration to decide which directional channel is selected to forward this packet. \[C_{j\
eq i}(t_{2})=C_{j}(t_{1})-d \tag{8}\]  
Note that \(N-2\) is the number of physical communication channels with the pheromone concentration \(C_{j\
eq i}\) on the module, except for the receiving channel and the forwarding channel selected based on the pheromone concentration \(C_{i}\)  
_The pheromone evaporation rate \(e\):_ Similar to ant pheromone concentration, the virtual pheromone concentration on a physical communication channel automatically evaporates over time, leading to flexibility of communication path selection. Obviously, the evaporation rate must be smaller than the deposition rate in order to maintain the physical communication channel: \(e<<d\). \[C_{i}(t+\Delta t)=C_{i}(t)-(N-2)e \tag{9}\]  
Evaporation only occurs when the virtual pheromone concentration is different from the initial state.