PYTHON ANT ALGORITHM

Abstract

This study is devoted to the analysis and optimization of the ant colony algorithm for solving the traveling salesman problem, a classic NP-hard combinatorial optimization problem. The primary objective of the work is to experimentally assess the impact of the algorithm’s parameters on the quality and efficiency of the search for approximate solutions, as well as to develop recommendations for their adaptive tuning. The standard Berlin52 graph from the TSPLIB library—containing the coordinates of 52 cities with a known optimal route length of 7542 units—was used as the test dataset. Experiments were conducted in a Python environment using the ACO-Pants library, which implements the ant colony algorithm. A series of 10 runs with fixed parameters was performed: number of ants (20), number of iterations (100), pheromone influence coefficient (α = 1.0), distance coefficient (β = 2.0), and pheromone evaporation rate (ρ = 0.5). The results showed an average deviation from the optimum of 1.85%, with the best found solution being 7675.23 (a deviation of 1.67%). To enhance the algorithm’s efficiency, adaptive mechanisms for dynamic parameter tuning were explored: a linear increase of α (up to 2.0) and a decrease of β (to 3.0), a reduction of ρ (to 0.3), as well as an increase in the number of ants (up to 30). These modifications reduced the average deviation to 1.70% and improved the stability of the solutions. Particular attention was paid to analyzing the balance between exploring new routes and exploiting accumulated data. It was found that increasing the number of ants improves the quality of solutions; however, beyond 30 agents, the efficiency gains diminish. Dynamic adjustment of the parameters prevents premature convergence to local minima and accelerates the search for globally optimal paths. Visualization of the convergence dynamics confirmed a rapid decrease in route length during the first 20 iterations, followed by subsequent stabilization. The practical significance of this work lies in demonstrating the flexibility of the ant colony algorithm for routing tasks in logistics and network planning. The results indicate that ACO outperforms generalpurpose methods (for example, genetic algorithms) in computational efficiency for the TSP. The developed recommendations for parameter tuning can be applied to scale the algorithm to larger graphs. Overall, the study emphasizes the importance of adaptive approaches in metaheuristic optimization and opens up prospects for further improvements through hybridization with other methods.

References

1. Алейник Д.В., Коломиец В.Н., Косникова О.В. Оптимизация логистических сетей на основе тео-

рии графов // Московский экономический журнал. – 2023. – Т. 8, № 11.

2. Гладков Л.А., Кравченко Ю.А., Курейчик В.В., Родзин С.И. Интеллектуальные системы: модели

и методы метаэвристической оптимизации: монография. – Чебоксары, 2024.

3. Курейчик В.В., Курейчик В.М., Родзин С.И. Концепция эволюционных вычислений, инспирирован-

ных природными системами // Известия ЮФУ. Технические науки. – 2009. – № 4 (93). – C. 16-24.

4. Курейчик В.М., Лебедев Б.К., Лебедев О.Б. Поисковая адаптация: теория и практика. – М.: Физ-

матлит, 2006.

5. Курейчик В.В., Курейчик В.М., Родзин С.И. Теория эволюционных вычислений. – М.: Физмат-

лит, 2012. – 260 с.

6. Родзин С.И., Скобцов Ю.А., Эль-Хатиб С.А. Биоэвристики: теория, алгоритмы и приложения.

– Чебоксары, 2019.

7. Лебедев Б.К., Дуккардт А.Н. Комплексный гибридный генетический алгоритм разбиения //

Известия ЮФУ. Технические науки. – 2008. – № 4 (81). – С. 26-32.

8. Лебедев Б.К., Лебедев О.Б. Разбиение на основе гибридной многоуровневой адаптации // Извес-

тия ЮФУ. Технические науки. – 2008. – № 9 (86). – С. 52-60.

9. МакКоннелл Дж. Основы современных алгоритмов. – М.: Техносфера, 2004.

10. Саймон Д. Алгоритмы эволюционной оптимизации: пер. с англ. А.В. Логунова. – М.: ДМК

Пресс, 2020. – 1002 с.

11. Engelbrecht A.P. Fundamentals of Computational Swarm Intelligence. – John Wiley & Sons, Chichester,

UK, 2005.

12. Dorigo M. and Stützle T. Ant Colony Optimization. – The MIT Press, 2004.

13. Goss S., Aron S., Deneubourg J., and Pasteels J. Self-organized shortcuts in the Argentine ant //

Naturwissenschaften. – 1989. – 76 (12). – P. 579-581.

14. Blum C. Ant colony optimization: Introduction trends // Physics of Life Reviews. – 2005. – 2 (4).

– P. 353-373.

15. Федосеева Л.И. Устройство оптимизации кратчайшего пути между вершинами графа на приме-

ре задачи коммивояжера // XXI век: итоги прошлого и проблемы настоящего плюс. – Пенза,

2011. – С. 132-138.

16. Костенко В.А., Плакунов А.В. Алгоритм построения одноприборных расписаний, основанный

на схеме муравьиных колоний // Известия РАН. Теория и системы управления. – 2013. – № 6.

– С. 87-96.

17. Муравьи и Python: ищем самые короткие пути – NTA на vc.ru. – https://vc.ru/newtechaudit/353372-

muravi-i-python-ishem-samye-korotkie-puti (дата обращения: 10.08.2024).

18. Reinelt G. TSPLIB. – 2008. – http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95.

19. Штовба С.Д. Муравьиные алгоритмы // Exponenta Pro. Математика в приложениях. – 2003. – № 4.

– С. 70-75.

20. Вирсански Э. Генетические алгоритмы на Python: руководство: пер. с англ. А.А. Слинкина.

– М.: ДМК Пресс, 2020. – 286 с. – ISBN 978-5-97060-857-9. – URL:

https://e.lanbook.com/book/179496 (дата обращения: 08.02.2025).

Скачивания

Published:

2025-01-30

Issue:

Section:

SECTION I. INFORMATION PROCESSING ALGORITHMS

Keywords:

Муравьиный алгоритм, задача коммивояжёра, метаэвристические алгоритмы, оптимизация, маршрутизация, эвристические методы