On the Improvement of the Heuristic Algorithm for Packing Circles into a Circle of Minimum Radius - Zadorozhnyi, Bohdan; Mitsa, Oleksandr; Stetsyuk, Petro (Kìbernetika ta komp'ûternì tehnologìï (Online), 2023)
The article is devoted to investigation of a heuristic algorithm for solving the competitive problem "Circles Dense packing into a circle of minimum radius" and development of its improved version using Shor's r-algorithm with step dichotomy. The heuristic algorithm was developed by Bohdan Zadorozhnyi, a third-year student of Uzhhorod National University. The program implemented on its basis took second place in the competition and used less time than the maximum time, which, according to the competition, was allocated for a one-time launch of the program for 50 competitive tasks. The article describes the research results of how the Shor r-algorithm can be used to improve efficiency of the heuristic algorithm. The algorithm for improving the heuristic solution is implemented according to the following scheme. We start from the best arrangement of circles found by the heuristic algorithm. Then, we perform the following four stages of the algorithm: Stage 1. We set a rather large value of the initial step (we determine it depending on the input data or simply choose it as a large step); Stage 2. We run the r-algorithm from the starting point and find the local minimum of the corresponding nonlinear programming problem; Stage 3. If the local minimum found guarantees a smaller radius of the outer circle, then the local minimum point becomes the starting point; the local minimum found does not guarantee a smaller radius of the outer circle, then the size of the step h is reduced by half. Stage 4. If the step value is greater than the specified value, then we proceed to Stage 2. Otherwise, we finish work of the algorithm with solution improvement. Python 3.9.5 programming language and NumPy 1.24.2 library were used for software implementation of both algorithms. For 50 competitive tests and different number of iterations of the heuristic algorithm (10, 20, 30, 40 and 50 iterations), the analysis of the obtained results was conducted according to three parameters: the number of points obtained, program execution time and the number of exchanges of circles in one iteration of the heuristic algorithm. For most of the competitive tests, the refined algorithm allows you to get better results in points, in particular, in most cases the improvement is up to 2 points, and in some cases – from 3 to 6 points. The biggest improvements (6 points) are seen in tests, where the circles have the same or close radii. Here, the heuristic algorithm works not so effectively, therefore, for such tests, due to the algorithm with refinement, it is possible to significantly improve the results of competitive tasks in terms of points. Keywords: circle packing, heuristics, r-algorithm, Python 3.9.5, NumPy 1.24.2.