Adaptive Neighborhood Heuristics for Simulated Annealing over Continuous Variables

Simulated annealing has been applied to a wide range of problems: combinatorial and continuous optimizations. This work approaches a new class of problems in which the objective function is discrete but the parameters are continuous. This type of problem arises in rotational irregular packing problems. It is necessary to placemultiple items inside a container such that there is no collision between the items, while minimizing the items occupied area. A feedback is proposed to control the next candidate probability distribution, in order to increase the number of accepted solutions. The probability distribution is controlled by the so called crystallization factor. The proposed algorithm modifies only one parameter at a time. If the new configuration is accepted then a positive feedback is executed to result in larger modifications. Different types of positive feedbacks are studied herein. If the new configuration is rejected, then a negative feedback is executed to result in smaller modifications. For each non-placed item, a limited depth binary search is performed to find a scale factor that, when applied to the item, allows it to be fitted in the layout. The proposed algorithm was used to solve two different rotational puzzles. A geometrical cooling schedule is used. Consequently, the proposed algorithm can be classified as simulated quenching.


Introduction
Simulated annealing has been applied to a wide range of problems: combinatorial and continuous optimizations.This work approaches a new class of problems in which the objective function is discrete but the parameters are continuous.This type of problem arises in rotational irregular packing problems.It is necessary to place multiple items inside a container such that there is no collision between the items, while minimizing the items occupied area.A feedback is proposed to control the next candidate probability distribution, in order to increase the number of accepted solutions.The probability distribution is controlled by the so called crystallization factor.The proposed algorithm modifies only one parameter at a time.If the new configuration is accepted then a positive feedback is executed to result in larger modifications.Different types of positive feedbacks are studied herein.If the new configuration is rejected, then a negative feedback is executed to result in smaller modifications.For each non-placed item, a limited depth binary search is performed to find a scale factor that, when applied to the item, allows it to be fitted in the layout.The proposed algorithm was used to solve two different rotational puzzles.A geometrical cooling schedule is used.Consequently, the proposed algorithm can be classified as simulated quenching.This work is structured as follows.Section 2 presents some simulated annealing and simulated quenching key concepts.In section 3 the objective function with discrete values and continuous parameters is explained.Section 4 explains the proposed adaptive neighborhood based on the crystallization factor.Section 5 explains the computational experiments and section 6 presents the results.Finally, section 7 rounds up the work with the conclusions.

Background
Simulated annealing is a probabilistic meta-heuristic with a capacity of escape from local minima.It came from the Metropolis algorithm and it was originally proposed in the area of combinatorial optimization [9], that is, when the objective function is defined in a discrete domain.The simulated annealing was modified in order to apply to the optimization of multimodal functions defined on continuous domain [4].The choices of the cooling schedule and of the next candidate distribution are the most important decisions in the definition of a simulated annealing algorithm [13].The next candidate distribution for continuous variables is discussed herein.
In the discrete domain, such as the traveling salesman and computer circuit design problems, the parameters must have discrete values; the next point candidate x k+1 corresponds to a permutation in the list of cities to be visited, interchanges of circuit elements, or other discrete operation.In the continuous application of simulated annealing a new choice of the next point candidate must be executed.Bohachevsky et al. [1] proposed that the next candidate x k+1 can be obtained by first generating a random direction vector u, with |u| = 1, then multiplying it by a fixed step size Δr, and summing the resulting vector to the current candidate point x k .
Brooks & Verdini [2] showed that the selection of Δr is a critical choice.They observed that an appropriate choice of this parameter is strictly dependent on the objective function F(x), and the appropriate value can be determined by presampling the objective function.
The directions in [1] are randomly sampled from the uniform distribution and the step size is the same in each direction.In this way, the feasible region is explored in an isotropic way and the objective function is assumed to behave in the same way in each direction.But this is not often the case.The step size to define the next candidate point x k+1 should not be equal for all the directions, but different directions should have different step sizes; i.e. the space should be searched in an anisotropic way.Corana et al. [4] explored the concept of anisotropic search; they proposed a self-tuning simulated annealing algorithm in which the step size is configured in order to maintain a number of accepted solutions.At each iteration k, a single variable of x k is modified in order to obtain a new candidate point x k+1 , and iterations are subdivided into cycles of n iterations during which each variable is modified.The new candidate point is obtained from x k in the following form Where v is a uniform random number in [−1, 1], and Δr i is the step size along direction e i of the i-th axis.The anisotropy is obtained by choosing different values of Δr i for all the directions.The step size is kept fixed for a certain number of cycles of variables, and the fraction of accepted moves in direction e i is calculated.If the fraction of accepted moves generated in the same direction is below 0.4, then the step size Δr i along e i is decreased.It is assumed that the algorithm is using too large steps along e i thus causing many moves to be rejected.If the fraction is between 0.4 and 0.6 the step size is left unchanged.If the fraction is above 0.6 then Δr i is increased.It is assumed that the step size is too small thus causing many moves to be accepted.This procedure may not be the best possible to process the different behavior of the objective function along different axes.Ingber [7] proposed that the random variable should follow a Cauchy distribution with different sensitivities at different temperatures.The maximum step size is kept constant during the algorithm and it allows escaping from local minima even at low temperatures.The parameter space can have completely different sensitivities for each dimension, therefore the use of different temperatures for each dimension is suggested.This method is often referred to as very fast simulated re-annealing (VFSR) or adaptive simulated annealing (ASA).The sensitivity of each parameter is given by the partial derivative of the function with relation to the i-th dimension [3].

Integer objective function with float parameters
Irregular packing problems arise in the industry whenever one must place multiple items inside a container such that there is no collision between the items, while minimizing the area occupied by the items.It can be shown that even restricted versions of this problem (for instance, limiting the polygon shape to rectangles only) are NP complete, which means that all algorithms currently known for optimal solutions require a number of computational steps that grow exponentially with the problem size rather than according to a polynomial function [5].Usually probabilistic heuristics relax the original constraints of the problem, allowing the search to go through points outside the space of valid solutions and applying penalization to their cost.This technique is known as external penalization.The most adopted penalization heuristic for external solutions of packing problems is to apply a penalization based on the overlapping area of colliding items.While this heuristic leads to very computationally efficient iterations of the optimization process, the layout with objective function in minimum value may have overlapped items [6].
Fig. 1 shows an example in which the cost function is the non-occupied space inside the container.As this space can change only by adding or removing areas of items, the cost function can assume only a finite set of values, becoming discontinuous.This particularity of the primal problem makes it difficult to evaluate the sensibility of the cost function related to the optimization variables.Recently, researchers used the collision free region (CFR) concept to ensure feasible layouts; i.e. layouts in which the items do not overlap and fit inside the container [11].This way, the solution has discrete and continuous components.The discrete part represents the order of placement (a permutation of the items indexes -this permutation dictates the order of placements) and the translation that is a vertex from the CFR perimeter.The continuous part represents the rotations (a sequence of angles of rotations to be applied to each item).The translation parameter is converted to a placement point at the perimeter of the CFR for its respective item.Fig. 2 shows the connection between the CFR and the translation parameter.Notice that the rotation parameter is cyclic in nature.All arithmetic operations concerning this parameter is performed in modulus 1 (so they always remain inside the interval [0, The wasted area that represents the cost function assumes only discrete values, while its variables (the rotations for each item) are continuous.To solve this type of problem, Martins & Tsuzuki [10] proposed a simulated quenching with a new heuristic to determine the next candidate that managed to solve this type of problem.

Scale factor
The objective function is the wasted space in the container and is discrete, depending on which items have been placed.In order to improve the sensibility of the cost function, intermediate levels can be generated by scaling one of the unplaced items, and attempting to insert the reduced version of the item into the layout.Hence, for each unplaced item, a scale factor between [0, 1] is applied, and the algorithm attempts to place the item, if it fits, the scaled area of the item is subtracted from the objective function.Scale factor was determined by a finite fixed depth binary search, restricted to the interval [0, 1].

Adaptive neighborhood
The proposed algorithm is shown in Fig. 3.The main modification is shown in the inner loop, where the choice is to swap two items in the placement sequence (discrete parameters) or to modify the rotation or translation of an item (continuous parameter).
The main concept is that rejected solutions do not contribute to the progress of the optimization process.Therefore, the distribution of the step size for each individual continuous parameter is adapted in order to increase the number of accepted solutions.This  is accomplished by the adoption of a feedback on the proposed algorithm.The next candidate is generated by the modification of a single parameter, adding to it a summation of c i random numbers with a uniform distribution.
where i is the index of the modified parameter and c i is its crystallization factor.The resulted modification follows a Bates distribution [8, sec.26.9] centered on 0 with amplitude 1 /2.Its standard deviation is given by 1 /2 Adaptive Neighborhood Heuristics for Simulated Annealing over Continuous Variables For c i = 1, as all operations on parameters are performed in modulus 1; the modification is the equivalent of taking a completely new parameter uniformly distributed in the interval [0, 1[.As c i increases, the expected amplitude of the modification decreases.When at a given iteration, the modification applied to a parameter leads to a rejected solution; the probability distribution (crystallization factor) for that specific parameter is modified in order to have its standard deviation reduced (resulting in lower modification amplitude), this is the negative feedback.When the modification leads to an accepted solution, the distribution (crystallization factor) for that parameter is modified to increase its standard deviation (resulting in larger modification amplitude), this is the positive feedback.Different positive feedbacks are studied in this work (see Table 1).As can be seen, the higher the crystallization factor for a given parameter, the smaller the modification this parameter will receive during the proposed algorithm.The parameter is said to be crystallized.

Computational experiments
Crystallization factor c i controls the standard deviation of the Bates distribution.When a solution is rejected, a negative feedback is applied and the corresponding c i is increased, causing a decrease in the parameter standard deviation.Accordingly, positive feedback is applied when a solution is accepted, increasing c i .In the studied problems, placement was restricted to vertexes of the CFR and thus the only continuous parameter is the rotation.Adopted negative feedback consists of incrementing the crystallization factor.For the positive feedback, the four different strategies in Table 1 were tested.The convergence of the algorithm is reached when, at a given temperature, all accepted solutions are equivalent to the best found.This is the global stop condition of the algorithm in Fig. 3.Although a solution as good as the final one is found in less iterations, allowing the algorithm to reach the global convergence is the only generic way to ensure that a solution is the best.The local stop condition shown in Fig. 3 is reached when a predefined number of solutions are accepted.

Problem instances
All problem instances studied here have a solution in which all items can be fitted in the container.Two puzzles cases were considered: Tangram and Larger First Fails (LF Fails).
Tangram is a classic problem and LF Fails consists of a problem which cannot be solved using the larger first heuristic.This heuristic determines that the larger items are placed always ahead of the smaller ones.Fig. 4 shows possible solutions to these problems.

Results and discussion
The algorithm was implemented in C++ and compiled by GCC 4.4.4.Computational tests were performed using an i7 860 processor with 4GB RAM.Each case was evaluated 100 times.The proposed algorithm is a simulated quenching algorithm which has the following parameters: • T 0 : Initial temperature.
• N acc : Number of accepted solutions at a given temperature.
Value of T 0 is calculated such that the number of rejected solutions at initial temperature is approximately 10% of the total number of generated solutions.Parameter α is set to 0.99 and N acc is 800.

Influence of the feedback strategy
Table 2 shows results obtained using each of the proposed feedback strategy, for each problem instance.For the Tangram problem, it can be observed that strategy A has a low convergence percentage, when compared to other feedback strategies, 0.09 less than the rate obtained using the feedback C method.In the case of the LF fails puzzle, results showed similar performance and convergence rate.
Fig. 5 shows the minimum, maximum and average costs explored by the proposed algorithm loop for the LF Fails, for all feedback strategies.The cost function discrete behavior is observable, and it is possible to notice that the global minimum is reached only at low temperatures.In all graphics, the optimum layout was found.One can note that, in Fig. 5.(b) and Fig. 5.(c), the best solution (cost equals zero) was found before reaching convergence.Variation of cost is shown in Fig. 6 and all graphs are very similar independently of the used positive feedback.The rotation crystallization factor for the largest item is displayed in Fig. 7. Possibility of accepting a higher cost solution is lower at low temperatures.As temperature   temperatures.Independently of the used positive feedback, the proposed algorithm reached local minima at lower temperatures, but successfully escaped from them.Cost variance is displayed in Fig. 10.The rotation crystallization factor evolution is shown in Fig. 11, for one of the large triangles.It is possible to observe, when adopting feedback strategies A and C, that there are two distinguishable levels.The final level, at lower temperatures, is very high, indicating that the rotation parameter of the item is crystallized.Again, feedback A is more stable when compared to the others, showing that is less exploratory.As the convergence rate is very poor, the scale factor should be used.Fig. 12 shows the specific heats obtained.In the Tangram casem, it seems that a peak is present.However, further investigations need to be done.

Influence of the binary search
Binary search is used to improve the sensibility of the discrete objective function, aiming to obtain a higher percentage of convergence for puzzle problems.Its application is not necessary in the case of the LF Fails problem, as almost all executions converged.As a 10 −1. 5  10 −1 consequence, the binary search was employed only in the Tangram problem.The fixed search depth was set to 1. Table 3 shows the results of the tests.Comparing with the results obtained in Table 2, the convergence rate is observed to be considerably higher when binary search is adopted, reaching 98% in the best case.Drawback is the large number of iterations needed to converge, resulting in longer execution times, approximately 3.5 times higher.As with the previous tests, feedback strategy A obtained less optimum solutions.
The behavior of the optimization process is illustrated through cost function (energy) histograms of the search while the temperature diminishes.For a given temperature, a gray-level histogram of the distribution of the cost function at that temperature is plotted.
The resulting graph shows a plot of cost histograms (horizontal bars) and temperature (dots) versus the number of iterations.Darker horizontal bars in the histogram, indicate a higher frequency of occurrence of a particular level of energy at a given temperature.

Conclusion
This work proposed a new simulated quenching algorithm with adaptive neighborhood, in which the sensibility of each continuous parameter is evaluated at each iteration increasing the number of accepted solutions.The proposed simulated quenching was successfully applied to other types of problems: robot path planning [14] and electrical impedance tomography [12].The placement of an item is controlled by the following simulated quenching parameters: rotation, translation and sequence of placement.

Figure 3 .
Figure 3.The proposed algorithm.Different types of positive feedbacks are studied in this work.

Figure 4 .
Figure 4. (a) Unique solution for problem LF Fails.(b)-(d) Solutions for the Tangram problem.

Figure 5 .
Figure 5. Minimum, maximum and average costs for the LF Fails with different feedbacks.(a) Feedback A. (b) Feedback B. (c) Feedback C. (d) Feedback D.

10 − 1 Figure 7 .
Figure 7. Crystallization factor for the largest item of the LF Fails problem, with different feedbacks.(a) Feedback A. (b) Feedback B. (c) Feedback C. (d) Feedback D.

Figure 8 .
Figure 8. Specific heat for the LF Fails with different feedbacks.(a) Feedback A. (b) Feedback B. (c) Feedback C. (d) Feedback D.
5Figure2.Consider that the container is rectangular and items P 1 , P 2 , P 3 and P 4 are already placed.Item P 5 is the next to be placed and to avoid collisions; it is placed at its CFR boundary.Its translation parameter has a value of 0.5.Both figures have P 4 placed at different positions, and consequently P 5 is also placed in different positions although the translation parameter is the same.

Table 1 .
Feedback strategies.CF i : Crystallization factor for item i.

Table 2 .
Statistics for the LF fails and Tangram puzzles.The columns respectively represent the adopted problem instance, the feedback method, number of iterations to converge, number of iterations to reach the minimum, time in seconds to converge, and the percentage of runs that converged to the global optimum.