# Decentralized Bioinspired Non-Discrete Model
## 4 Aggregation Evaluation Metrics  
At this point a complete model of the swarm's aggregation properties has been proposed where its performance is dependent on several free variables identified in previous sections. It is now possible to construct a vector \(\vec{\theta}\) to represent the condition state of the system in a real higher-dimensional vector space. Theta is defined in (12)  
\[\vec{\theta}\equiv\left(\begin{array}{c}P\\ v_{max}\\ \Delta t\\ C_{e}\\ C_{d}\end{array}\right) \tag{12}\]  
To quantitatively evaluate the aggregation capabilities of the swarm in each simulated scenario 4 metrics were introduced based on the qualitative synopsis of the metrics for estimating robot aggregation efficiency presented by [PERSON] in [PERSON] (2016). [PERSON] (2016) provided several methods to test aggregation efficiency, of those the 4 following metrics were derived:  
1. The center of mass of the nodes in an aggregate must coincide with the center of mass for the targeted task.
2. The smallest circle enclosing all the nodes in a task, must have an area equal to the area of the task.
3. The average distance between one node to all nodes in an aggregate must be equal for every node in said aggregate.
4. The number of nodes that are inside the area of a task must be the number of nodes required for that task.  
The combination of these criteria ensures that the swarm will have aggregated with the right number of nodes (metric 4), at the right places (metric 1), with the appropriate distribution at each place (metrics 2 and 3). These prescribed metrics are the criteria by which each simulation can be objectively compared. To quantitatively express each statement, a cost function has been developed for each metric. The ideal value of the cost function is zero for any scenario. Equations (13)-(15) and (17) are the cost functions of metrics 1, 2, 3, and 4, respectively.  
\[\vec{Cm}_{T}(\vec{\theta})\equiv\frac{1}{n_{T}R_{T}}\sum_{i=0}^{n_{T}}\vec{p}_ {i} \tag{13}\]  
\[A(\vec{\theta})\equiv\frac{1}{\pi R_{T}^{2}}\bigwedge_{i=0}^{n_{T}}|\vec{Cm}_{ T}-\vec{p}_{i}|-1 \tag{14}\]  
\[V_{T}(\vec{\theta})\equiv\frac{1}{n_{T}R_{T}}\sum_{i=0}^{n_{T}}(d_{i}-d)^{2} \tag{15}\]  
where \(d_{T}\) of task T is defined as:  
\[d_{T}\equiv\frac{1}{n_{T}}\sum_{i=1}^{n_{T}-1}|\vec{p}_{T}-\vec{p}_{i}| \tag{16}\]  
\[N(\vec{\theta})\equiv\frac{N_{current}^{T}}{n_{T}}-1 \tag{17}\]  
where \(n_{T}\) represents the total number of nodes that should be in task \(T\) and \(N_{current}^{T}\) represents the number of nodes that currently are within the area of task \(T\).  
Using these parameters it is possible to define a final cost function \(C(\vec{\theta})\geq 0\) seen in (19) such that, applying it to a particular time in a running simulation, a cost value is obtained. 0 is the ideal cost, while the cost function increases quadratically.  
\[C(\vec{\theta})\equiv a_{1}V_{T}(\vec{\theta})^{2}+a_{2}|\vec{C}m_{T}(\vec{ \theta})|^{2}+a_{3}A(\vec{\theta})^{2}+a_{4}N(\vec{\theta})^{2} \tag{18}\]  
\[C(\vec{\theta})=\begin{pmatrix}V_{T}(\vec{\theta})^{2}\\ |\vec{C}m_{T}(\vec{\theta})|^{2}\\ A(\vec{\theta})^{2}\\ N(\vec{\theta})^{2}\end{pmatrix}\cdot\begin{pmatrix}a_{1}\\ a_{2}\\ a_{3}\\ a_{4}\end{pmatrix}=\vec{a}\cdot\vec{C}(\vec{\theta}) \tag{19}\]  
where \(\vec{a}\) is an arbitrary vector of real constants.  
Summing the cost for all the tasks in the simulation will provide the final cost of the system. The terms in the cost function are squared to achieve this quadratically increasing cost value in case of slight variation of the initial terms.