# Exploration of Swarm Dynamics Emerging from Asymmetry
## 4 Measures to Quantify the Swarm Dynamics
### Fitness Function Candidates
#### 4.3.7 Fitness Function G  
The behaviors of swarms in SC can be seen as a kind of nonlinear dynamic system. We assume inherent asymmetry might exist in the system dynamics. Therefore, this concept was woven into a form of fitness function. The FF is related to the instability or the unpredictiveness.  
Let the state of system be denoted using a vector \(\vec{x}\), which represents the agent positions in the two-dimension:  
\[\vec{x}_{i}=\left[x_{1i},x_{2i}\right]^{T}. \tag{18}\]  
Hence, the system state vector is defined as:  
\[\vec{X}=\left[\vec{x}_{1}^{T}\ \vec{x}_{2}^{T}\ldots\vec{x}_{N}^{T}\right]^{T}. \tag{19}\]  
Namely, \(\vec{X}\in R^{m}\), \(m=2N\), \(N\) is the number of agents. As \(\vec{X}\) time-evolves, it can be written as \(\vec{X}(t)\).  
A Lyapunov exponent \(\lambda\) is often used to determine if a dynamical system is chaotic. Lyapunov exponent is defined as:  
\[\lambda=\frac{1}{T}\sum_{t=1}^{T}\log_{10}\left|\frac{\Delta X(t)}{\Delta X(t -1)}\right| \tag{20}\]A Lyapunov exponent indicates the slope \(\lambda\) when the expansion of system state locus is approximated by an exponential function \(e^{\lambda t}\). Thus the stability of the system can be determined by the following expressions.  
\[\lambda > 0\Rightarrow\text{unstable (chaotic)} \tag{21}\] \[\lambda = 0\Rightarrow\text{critical}\] (22) \[\lambda < 0\Rightarrow\text{stable} \tag{23}\]  
As Lyapunov exponent is computed for each dimension of the state vector \(\vec{X}\), \(m\) Lyapunov exponents \(\{\lambda_{1},\ \lambda_{2},\ldots,\lambda_{m}\}\) (Lyapunov spectrum) are obtained for \(m\) dimensions. We used the maximum \(\lambda_{max}\) as a measuring index because it determines the convergence of solution locus along time evolution of system.  
From this, the fitness function is  
\[\phi=c\left(e^{\lambda_{max}}-b\right) \tag{24}\]  
Here, an exponential function is used so that the fitness function only takes positive values. In addition, the constants \(c\) and \(b\) were introduced as a magnification coefficient and an offset constant, respectively, and set \(c=1000\) and \(b=1\) empirically because the expression \(e^{\lambda_{max}}\) itself gives values around \(1\) and the difference is small (the order of \(10^{-3}\)). We have introduced these correcting constants because if these parameters were not involved (i.e., \(c=1\) and \(b=0\)) in the beginning, the difference in fitness values between the individuals was too small to be discriminated in optimization process. If the magnification factor \(c\) is larger, it may be easier to discriminate the fitness difference between individuals. On the other hand, when it is too large, the probability that the individuals with low fitness cannot be selected. So we have chosen a moderate value whose order is similar to that of the averaged fitness values from the case these parameters were not involved. The constant \(b\) has been introduced to remove the offset before magnifying by \(c\). This value should be positive but not exceed the averaged offset value, from the case these parameters were not involved, in order to keep fitness values greater than zero.