# Using Feedback Strategies in Simulated Annealing with Crystallization Heuristic and Applications
## 2 SA with Crystallization Heuristic and Feedback Strategies
### How to Modify the Solution with Continuous Variables
The crystallization factors have a connection with the two phases. During the exploration phase, larger jumps are performed (the parameters have lower crystallization). During the refinement phase, the optimization performs smaller jumps with higher probability (the parameters have higher crystallization). \(\Delta r_{k}\) is fixed for each variable and represents the distribution width. The summation of random numbers creates a Bates distribution [20] defined by the crystallization factor \(c_{k}\). The crystallization factor is controlled by a feedback mechanism shown in Figure 2. If the candidate is accepted, the crystallization factor \(c_{k}\) is reduced and, consequently, the standard deviation of the probability distribution increases. The opposite action happens if the candidate is rejected; consequently, the standard deviation of the probability distribution decreases. Previous versions of SA with the crystallization heuristic limited the maximum value \(c_{\text{max}}\) of the crystallization factor \(c_{k}\). The summation of numbers between \(-1\) and \(1\) can grow to be very large. If a new number between \(-1\) and \(1\) is added to a large number, no modification will happen. This happens because of the computer's internal numerical representation. The approach of SA with the crystallization heuristic proposed herein has no upper limit for the crystallization factor. The numerical issue presented below can be overcome by using a Gaussian distribution. The Gaussian distribution mean is zero, and its standard deviation is defined by  
\[\exp\left(c_{\text{max}}-c_{k}-2\right) \tag{3}\]  
where \(c_{\text{max}}\) is the maximum value for the crystallization factor \(c_{k}\) to use the Bates distribution. If \(c_{k}\) is larger than \(c_{\text{max}}\), the proposed algorithm uses the Gaussian distribution and the value of the exponent is negative in (3). The Gaussian distribution has limits between \(-\infty\) and \(+\infty\); however, as its standard deviation is very small, it produces small numbers with high probability. The crystallization factor controls the standard deviation of the Bates and Gaussian distributions. The Bates distribution has boundaries, and this is used to ensure that \(x^{*}\) is generated under some limits. If \(c_{k}\) grows to be larger and numerical issues might occur, \(x^{*}\) is generated using a Gaussian distribution. Algorithm 2 shows a possible implementation of SA with the crystallization factor. The negative and positive feedback to control the crystallization factor are shown. Only one variable is modified at a time [21; 22]. By modifying just one variable at a time, the algorithm knows that the selected variable's associated crystallization factor \(c_{k}\) must be modified. Usually, the continuous variables have boundaries, and they must be kept inside a domain \([x_{\text{min}},x_{\text{max}}]\). Eventually, the generated candidate goes outside the domain. The decision of what to do when such a situation happens is crucial. The correct decision is to perform a totally new \(x^{*}\) generation, as shown in the Algorithm 2. The incorrect decision is to attribute the nearest variable boundary value to \(x^{*}\). If this is done, the boundary will have a higher probability to be chosen, and the solution distribution will be incorrect. Figure 2: SA provides a feedback to the crystallization factor associated with the modified variable. If the solution is accepted, the crystallization factor is reduced (positive feedback). If the solution is rejected, the crystallization factor is increased (negative feedback).