# 智能算法:蚁群优化算法(TSP问题) **Repository Path**: letere/ant ## Basic Information - **Project Name**: 智能算法:蚁群优化算法(TSP问题) - **Description**: 用Java实现蚁群优化算法,来解决TSP问题 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 8 - **Forks**: 1 - **Created**: 2021-01-03 - **Last Updated**: 2025-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 一、算法介绍 参考文章:https://zhuanlan.zhihu.com/p/404181189 #### 1.1 三个重要式子 + (1)每条路选中概率 + 其中**alpha**和**beta**参数自定义 + **alpha**为信息因子占的权重,权重过高,蚂蚁选中已走的路概率越高,开始走新路概率低 + **beta**为两点距离的权重(能见度),权重过高,蚂蚁优先走两点最短距离的路 ```java rate = Math.pow(pheromoneMatrix[currentCity][city], ALPHA) * Math.pow(1.0 / distanceMatrix[currentCity][city], BETA); ``` + (2)信息素更新 + 信息素更新包括:**信息素挥发**以及**信息素新增** + 蚂蚁走完一遍所有城市后,就开始先计算挥发,再计算新增 ```java //信息素挥发 for(int i=0; i route = ant.getRoute(); for(int i=0; i