## Materials and Methods
### GA-adaptive Template Matching
#### 2.4.3 Genetic Algorithm Optimization  
Optimization is the selection of the best element from a set of available alternatives according to some criteria. In a more formal way, given an objective function \(f:S\to R\) which links the search space of feasible solutions to the corresponding utility or cost, the optimization process seeks to find the element \(x_{o}\in S\) such that \(f(x_{o})\leq f(x)\)\(\forall\)\(x\in S\) (minimization) or such that \(f(x_{o})\geq f(x)\)\(\forall\)\(x\in S\) (maximization). Fixing a target for convenience, in the simplest case, an optimization problem corresponds to the minimization of a cost function over a search space obtained by constraining the overall Euclidean space. Or, \(\underset{x\in S}{\operatorname{argmin}}f(x)\). From a mathematical point of view, the minimization of a function typically involves derivatives. Then, the more a function is complex (e.g., defined on a wide multidimensional support, non-continuous, or with non-continuous derivatives, featuring many local minima, etc. ), the harder is the computation of such derivatives, so that the optimization may become very tricky in practical cases. Furthermore, the optimization is very likely to get stuck into local minima in the vicinity of an initial guess value for the optimum location (local optimization), \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(\mathbf{t}\) & \(\mathbf{s}\) & \(\rightarrow\) & \(\mathbf{r}\) & SAD & SSD \\ \hline
0 & 1 & & 0 & 1 & 1 \\
0 & 0 & & 0 & 0 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Correlation \(r\), Sum of Absolute Differences (SAD) and Sum of Squared Differences (SSD) comparison for binary images. with no guarantees (unless particular properties of the cost function i.e., convexity) that the result corresponds to the actual global minimum (global minimization). In general, the assessment of the performance of an optimizer can be expressed in terms of:  
* Exploration: the optimizer discovers a wide region of the search space,
* Exploitation: the optimizer \"pounds the pavement\" on a limited but promising region,
* Reliability: repeatability of the fund solution. It is important to highlight that exploration and exploitation are competing properties. Local optimizers show very good exploitation at the expense of a very poor exploration. On the contrary, a good global optimizer should sacrifice exploitation to gain in exploration and speed. This is usually obtained taking advantage of heuristic or meta-heuristic techniques implementing some form of stochastic optimization. An important category of global population-based metaheuristic optimization algorithms is the Evolutionary. An evolutionary algorithm (EA) uses mechanisms inspired by biological evolution, such as reproduction, mutation, recombination, and selection. Candidate solutions to the optimization problem play the role of individuals in a population, and the cost function determines the quality of a solution. A \"direct search\" is performed to find the best individuals within the population according to their quality. These best individuals are then selected to determine the offspring, namely the new trial solutions, which will substitute lower quality individuals. The most famous EA is the Genetic Algorithm, developed by [PERSON] introduced genetic algorithms in 1960 based on the concept of [PERSON]'s theory of evolution. The GA evolutionary cycle starts initiating a population randomly and evaluating the quality of each individual on the basis of his genotype. The best individuals are then selected to produce via modification the new offspring, while the worst are discarded. Modifications are stochastically triggered operators such as the crossover (the offspring is a random mix of the genotypes of their parents) or the mutation (the offspring features new genes which were not present in the parents). The first is important to ensure exploitation, while the second guarantees exploration of the search space of all possible genotypes.