# A Diagnostics of Conveyor Belt Splices
## 5 Methodology
### Genetic Algorithm  
The genetic algorithm is a simulated process of evolution that contains the main features seen in biology [33]. From an implementation point of view, GA is a metaheuristic optimization technique. This concept has been introduced by [PERSON]'s thesis [34] and then developed in large part by [PERSON] [35; 36]. Typically, optimization problems are given as follows:  
**Problem 1**.: _Find an \(x_{0}\in\mathbf{X}\) such that \(f\) is minimal in \(x_{0}\), where \(f:\mathbf{X}\rightarrow\mathbb{R}\) is an arbitrary real-valued function; i.e., \(f(x_{0})=\min_{x\in\mathcal{X}}f(x)\)._  
Sometimes it is very difficult to obtain strict global solution, so in practice we want to find values \(x\) that minimize the objective function \(f\). One can write down the elementary structure of GA (Algorithm 1) as follows:  
```
Compute initial population \(B_{0}\); Whilte stopping condition not fulfilled \(\mathbf{DO}\) BEGIN select individuals for reproduction; create offspring by crossing individuals; occasionally mutate some individuals; compute new generation; END
```  
**Algorithm 1**structure of GA  
The main loop of GA performs the transition from one generation to the next using four basic components:  
* Selection: Selection of individuals for reproduction with respect to their fitness defined with objective function.
* Crossover: Generation of offspring based on the information pulled from two individuals.
* Mutation: Random deformation of the chromosomes with a certain probability. This serves for generating genetic diversity, and as an effect, local minima can be avoided.
* Sampling: The procedure which computes a new generation from the previous one and its offspring.  
For the described application, GA was used to evolve the vector of 24 values corresponding to the shift of each channel to the right, expressed in samples. The number of total generations was set to 200, with a stall limit of 20 generations. Each population consisted of 450 individuals. The algorithm used the roulette method for the selection of individuals for reproduction and intermediate crossover function with a weight ratio equal to 0.8. The gene mutation probability was set to 0.01%. The lower and upper bound for channel shift was defined as 1/6 of initial channel length.  
The fitness function is defined to be the sum of RMS errors between each channel in the current state of synchronization, and the median of all channels calculated in this state. This means that the more cohesively channels are synchronized, the lower the value of error. In fitness function, we use median instead of often used mean because it is less susceptible to outliers (i.e., edge channels that very often take a different shape than most) or to dissimilar shapes of individual channels (the worse the splice quality the worse the mean value describes the trend across the channels in comparison to the median).  
The results of the GA-based synchronization of channels are presented in Figure 14. Residual errors are low and channels are positioned very cohesively, especially for correctly made splices. Faulty splices are also synchronized very well, but it is more difficult to observe the synchronization quality just by looking at the result. The matrix of synchronized signals is not much longer than the original (about 15% for the correctly made splice, about 20% for the faulty splice).