## 2 Meta-Heuristics and Applications for Image Segmentation
### Simulated Annealing  
Simulated annealing (SA) [31] is a searching algorithm mainly designed for global optimization problems [32].  
The simulated annealing (SA) algorithm is an optimization method inspired by the tempering of metals used since 5000 B.C. and belongs to a class of local search algorithms (LSA) commonly called threshold algorithms (TA).  
To understand the simulated annealing method, it is necessary to understand that this technique is used in the industry to obtain more resistant or more crystalline properties to improve the qualities of materials. This same principle is adapted to a computational algorithm that works by mimicking this process.  
The process consists of \"melting\" the material (heating it to a very high temperature). In this situation, the atoms gain a \"random\" distribution within the material structure, and the system energy is maximal. Then, the temperature is reduced in stages, allowing the atoms to remain in equilibrium in each of these stages (that is, the atoms reach an optimal configuration for that temperature). At the end of the process, the atoms form a highly regular crystalline structure, thus, the material achieves maximum strength, and the system energy is minimal.  
The experiments report that if the process sharply reduces the temperature or if there is not enough time in each stage, the structure of the material is not optimal.  
This algorithm presents three main phases: heating the material to a predetermined temperature, maintaining the temperature that allows the molecules to accommodate in states of minimum energy,and then a slow cooling of the material to allow an increase in the size of the crystals and a reduction of their defects. In each iteration, the algorithm tests the neighbors to find better solutions, considering new solutions with a probability of using that solution even if it is not a better solution.  
Simulated annealing (SA) is a simple trajectory method that starts with a certain state, \(S\). Through a particular process, it generates a neighbor state, \(S\)', to the current environment. If the energy, or evaluation of the state \(S\)', is better than the one of \(S\), the element \(S\) changes to \(S\)'.  
If the evaluation of \(S\)' is worse than that of \(S\), \(S\)' is chosen instead of \(S\), with some probability depending on the differences of the evaluations of both states and the current temperature \(T\). The probability of choosing a worse state instead of the current state allows a local optimum to be left in order to reach the global optimum. In a minimization process, the probability of choosing a worse state is calculated by:  
\[p=e^{-1\cdot\frac{f^{\prime}(i)-f(i)}{T}} \tag{1}\]  
In this work, given a state \(S\), we obtain a neighboring state \(S\)' of the following form:  
\[S^{\prime}(i)=S(i)\pm rand(0,\ 255) \tag{2}\]  
The simulated annealing algorithm has several stages. Each stage corresponds to a lower temperature than the previous stage (this refers to the monotony: after each stage, the temperature goes down and the system cools). Therefore, a criterion of temperature change is required (\"how much time\" is waited at each stage to result in the system achieving its \"thermal equilibrium\").  
If the temperature lowers sufficiently slowly (the temperature parameter and the generation of enough transitions) at each temperature, it can achieve the optimum configuration.  
Recently, [PERSON] et al. [32] used an algorithm similar to simulated annealing to reduce the nonlinearity of Galvo scanners. In that study, they evaluated the algorithm in different frequencies to synthesize the signal. Their method showed better results compared to other methods for the compensation of Galvo scanners.  
Similarly, in 2018 [PERSON] et al. [33], used simulated annealing (SA) to optimize an amplitude modulator showing the efficiency and effectiveness of SA when finding the optimum wavefront shape for focusing light.