Example #1
0
 protected void UpdateMinPath(IGraph graph)
 {
     var isChanged = false;
     foreach (var ant in Ants)
     {
         if (ant.VisitedVetecies.First() == ant.VisitedVetecies.Last() && ant.VisitedVetecies.Count != 1)
         {
             var path = graph.CalculatePath(ant.VisitedVetecies);
             if (path < MinPathLength)
             {
                 MinPathLength = path;
                 Result = ant.VisitedVetecies;
                 CurrentIterationNoChanges = 0;
                 isChanged = true;
             }
         }
         if (!isChanged)
         {
             CurrentIterationNoChanges++;
         }
     }
 }
Example #2
0
 public Mark(Path path)
 {
     Path = path;
     Pheromone = new Pheromone();
 }