# Development of a Power and Communication Bus Using HIL and Computational Intelligence
## 5 HIL-Based Optimization Method for Bus Prototyping
### Particle Swarm Optimization  
The particle swarm optimization is a population-based stochastic optimization technique [31; 32], which is inspired by simulation of the social behaviour reflected in flocks of birds, bees and fish that adapt their movements in order to seek the best food sources as well as to avoid predators [31; 33]. This type of optimization approach is also viewed as a parallel evolutionary computation technique.  
Numerically, the basic PSO algorithm can be formulated in vector notation, as is proposed in [34]. The velocity \(\mathbf{v}_{k}\) is updated using its current value and a term which attracts the particle towards its own previous best position \(\mathbf{p}_{1}^{*}\) and globally the best position \(\mathbf{p}_{2}^{*}\) in the whole swarm:  
\[\mathbf{v}_{k+1}=a\mathbf{v}_{k}+b_{1}\mathbf{r}_{1}\otimes(\mathbf{p}_{1}^{* }-\mathbf{p}_{k})+b_{2}\mathbf{r}_{2}\otimes(\mathbf{p}_{2}^{*}-\mathbf{p}_{k }), \tag{15}\]  
while the particle position \(\mathbf{p}_{k}\) is dynamically actualized using its current value and the newly computed velocity \(\mathbf{v}_{k+1}\):  
\[\mathbf{p}_{k+1}=c\mathbf{p}_{k}+d\mathbf{v}_{k+1}, \tag{16}\]  
where the symbol \(\otimes\) denotes element-by-element vector multiplication, \(a\) is the momentum factor, also known as the inertia weight, coefficients \(b_{1}\) and \(b_{2}\) are used to describe the strength of attraction (cognitive and social attraction coefficients, respectively), \(c\) and \(d\) are black-box tuning parameters, vectors of random numbers \(\mathbf{r}_{1}\) and \(\mathbf{r}_{2}\) that are useful for good state space exploration (they are usually obtained using the generator of pseudo-random numbers with uniform distribution in the range of 0 to 1).  
In this algorithm, the cost function in the form of (10) was used. The PSO algorithm characterizes three main parameters--population size, self-adjustment weight and minimal neighbours' fraction. To have a reliable comparison between algorithms, the same total number of cost function evaluations is necessary (\(\
abla\)), hence the max iteration is calculated using the simple equation:  
\[\mathrm{SwarmSize}=\bigg{[}\frac{\Psi}{\mathrm{MaxIter}+1}\bigg{]}. \tag{17}\]  
The self-adjustment weight parameter can be in the range from 0.5 to 3.5 with step 1.0, where a default value is 1.49. Considering a stability analysis provided by [PERSON] et al. [35], [PERSON] and [PERSON] [36] or [PERSON] and [PERSON] [37], it is decided to relate the self-adjustment weight (\(b_{1}\)) and social adjustment weight (\(b_{2}\)) as follows:  
\[b_{2}=4.05-b_{1}. \tag{18}\]  
This technique was chosen to test the parameters of the algorithm with different configurations; some researchers use PSO with fixed parameters where self-adjustment weight (\(b_{1}\)) and social adjustment weight (\(b_{2}\)) are set to 2 [33; 38]. The adopted methodology used close values at \(b_{1}=2.5\) and at \(b_{1}=2.5\), where \(b_{2}\) is calculated to 1.55 and 2.55. Interpolating results from Section 6, the authors conclude that the decision was the right one. The interpolated quality parameters of PSO also suggest that the default value of \(b_{1}\) is closer to optimal than 2.