# Exploration of Swarm Dynamics Emerging from Asymmetry
## 2 Basic Algorithm of Swarm Chemistry  
SC is an extended version of one of the best-known swarm models, Boids [4], in which the motions of agents are controlled only by three simple interaction rules among agents: cohesion, separation and alignment. The entire set of kinetic rules in Boids are:  
* Straying If there are no other agents within its local perception range, steer randomly. * Cohesion (\(c_{1}\)) Steer to move toward the average position of nearby agents. * Alignment (\(c_{2}\)) Steer toward the average velocity of nearby agents. * Separation (\(c_{3}\)) Steer to avoid collision with nearby agents. * Randomness (\(c_{4}\)) Steer randomly with a given probability. * Self-propulsion (\(c_{5}\)) Approximate its speed to its own normal speed. Algorithm 1 describes the kinetic rules to govern the movement of agents in SC in more detail [9]. \(\vec{x}_{i}\), \(\vec{v}_{i}\), \(\vec{v}_{i}^{\prime}\) and \(\vec{a}_{i}\) are the location, the current velocity, the next velocity, and the acceleration of the \(i\)-th agent, respectively. \(r\) and \(r_{\pm p}\) are random numbers in \([0,\ 1)\) and \([-p,\ +p)\), respectively. The interaction properties of an agent are described by 8 kinetic parameters (KPs) denoted as follows. \[(R,\ V_{n},\ V_{m},\ c_{1},\ c_{2},\ c_{3},\ c_{4},\ c_{5}) \tag{1}\]  
The definitions, units and their possible values are summarized in Table 1. Especially, KP4, KP5 and KP6 are the coefficients for the three effects: cohesion, alignment and separation, respectively. They are used to calculate the acceleration of the agent. So their units should be consistent with that of acceleration, i.e., (Pixel \(\cdot\) Step\({}^{-2}\)). For example, KP4 has a unit of (Step\({}^{-2}\)), because the first term on the right on Line 8 of Algorithm 1,  
\[(\langle\vec{x}\rangle-\vec{x}_{i})\, \tag{2}\]  
has a unit of position, i.e., (Pixel). In Boids, all the parameters are shared over all the agents. In SC, unlike Boids, each agent is assigned a unique set of kinetic parameters, which represents its \"character\". Therefore, a swarm is allowed to have two or more different types of agents. A design parameter of a swarm is described by a recipe (i.e., some sets of KPs). If there are multiple types in a swarm, then it is said to be heterogeneous (otherwise homogeneous). When a swarm has \(M\) types agents, the recipe \(\mathcal{R}\) for it is written as follows. \begin{table}
\begin{tabular}{c c c c c c} \hline
**KP** & **Name** & **Min** & **Max** & **Definition** & **Unit** \\ \hline KP1 (\(\beta_{1}\)) & \(R^{i}\) & 0 & 300 & Radius of local perception range & Pixel \\ KP2 (\(\beta_{2}\)) & \(V_{n}^{i}\) & 0 & 20 & Normal speed & Pixel Step\({}^{-1}\) \\ KP3 (\(\beta_{3}\)) & \(V_{m}^{i}\) & 0 & 40 & Maximum speed & Pixel Step\({}^{-1}\) \\ KP4 (\(\beta_{4}\)) & \(c_{1}^{i}\) & 0 & 1 & Coefficient for cohesive effect & Step\({}^{-2}\) \\ KP5 (\(\beta_{5}\)) & \(c_{2}^{i}\) & 0 & 1 & Coefficient for aligning effect & Step\({}^{-1}\) \\ KP6 (\(\beta_{6}\)) & \(c_{3}^{i}\) & 0 & 100 & Coefficient for separating effect & Pixel\({}^{2}\) Step\({}^{-2}\) \\ KP7 (\(\beta_{7}\)) & \(c_{4}^{i}\) & 0 & 0.5 & Probability of random steering & – \\ KP8 (\(\beta_{8}\)) & \(c_{5}^{i}\) & 0 & 1 & Tendency of self-propulsion & – \\ \hline \end{tabular}
\end{table} 
Table 1: Kinetic parameters (KP) in a recipe to control agent behaviors [9]. Each agent is assigned unique values in its recipe. \[\mathcal{R}= \begin{cases}N_{1}&*(R,\ V_{n},\ V_{m},\ c_{1},\ c_{2},\ c_{3},\ c_{4},\ c_{5})_{1}\\ N_{2}&*(R,\ V_{n},\ V_{m},\ c_{1},\ c_{2},\ c_{3},\ c_{4},\ c_{5})_{2}\\ &\vdots\\ N_{M}&*(R,\ V_{n},\ V_{m},\ c_{1},\ c_{2},\ c_{3},\ c_{4},\ c_{5})_{M},\end{cases}  \tag{3}\]  
where \(N_{j}\) (\(j=1,\ldots,M\)) at the beginning of each row denotes the number of agents that share the same set of KPs.