Artificial intelligence TSP优化的最大最小蚂蚁系统

Artificial intelligence TSP优化的最大最小蚂蚁系统,artificial-intelligence,evolutionary-algorithm,ant-colony,Artificial Intelligence,Evolutionary Algorithm,Ant Colony,我已经实现了一个蚂蚁系统算法来解决TSP问题,它只获得了比最优旅行(可接受)长约5%的旅行结果。现在我正在尝试实现类似的功能 我实现的算法如下所示: func UpdateMaxMin { // decay pheromone graph.decayPheromone() // get best path from this iteration bestPath = paths[0] for path in paths { bestPat

我已经实现了一个蚂蚁系统算法来解决TSP问题,它只获得了比最优旅行(可接受)长约5%的旅行结果。现在我正在尝试实现类似的功能

我实现的算法如下所示:

func UpdateMaxMin {
    // decay pheromone
    graph.decayPheromone()

    // get best path from this iteration
    bestPath = paths[0]
    for path in paths {
        bestPath = path.length < bestPath.length ? path : bestPath
    }

    // update for only the best path (sometimes use the global best)
    if random(0, 10) > 8 {
        graph.updatePheromone(globalBestPath)
    } else {
        graph.updatePheromone(bestPath)
    }

    // clamp pheromone levels between min and max
    graph.clampPheromone()

    // check for stagnation
    if graph.checkStagnation() {
        // update max
        max = 1 / (rho * globalBestPath.Length)
        // reset all pheromones to max
        graph.SetPheromoneMatrix(max)
    }
}
除此之外,最好的蚂蚁在它们的旅行中在每一条边上沉积的信息素的实际数量通过以下公式计算:

    deposit = 1 / tour.Length
但是,该值太小,无法实际创建一条明显的最佳路径-例如,如果信息素从5开始,在第一次遍历后,它将衰减到2.5,而最佳蚂蚁将在相关边缘上放置约0.001个信息素。即使我将存款乘以蚂蚁的数量,也需要大量的蚂蚁才能产生显著的变化

我的MMA的结果比随机的要好,但比香草AS差得多。MMAS构建的行程约为最佳行程的两倍

有人能指出我的错误(或建议改进)我的算法吗

    deposit = 1 / tour.Length