Esempio n. 1
0
    // evaporation of pheromones
    protected void EvaporatePheromones(int antIndex)
    {
        double decreaseFactor = 1.0 - rho;

        for (int i = 0; i < cities.Count; i++)
        {
            int j = Ants[antIndex].GetCityOfTour(i);
            int l = Ants[antIndex].GetCityOfTour(i + 1);

            Pheromones.DecreasePheromoneAs(j, l, decreaseFactor);
            Pheromones.DecreasePheromoneAs(l, j, decreaseFactor);
        }
    }
Esempio n. 2
0
    // evaporation of pheromones
    protected void EvaporatePheromones()
    {
        double decreaseFactor = 1.0 - rho;

        for (int i = 0; i < cities.Count; i++)
        {
            for (int j = i + 1; j < cities.Count; j++)
            {
                Pheromones.DecreasePheromoneAs(i, j, decreaseFactor);
                Pheromones.DecreasePheromoneAs(j, i, decreaseFactor);
            }
        }
    }