Ant Colony Optimization - Ant Movement

I am trying to implement ant colony optimization. Tried to link to this article: Improved optimization of ant colonies for paper navigation paper . Since I did not have answers to these questions, I was stuck in half of my implementation. Therefore, I ask specific questions related to the ant colony:

  • What I have done so far is to set up a 2d array map with a value 0for the border around the map, as well as for obstacles.

  • Obstacles are generated in a random position, inserting 0in random order [row, column] in this array.

  • I placed the source where all the ants begin the journey to be from the lower left corner. And I put the destination in the upper right corner.

  • We wrote code to draw a map visually using the Graphics function in VB.Net, and it works great. The gradient display of the pheromone gradient is shown on the map (i.e. a whiter shade for more pheromone deposition on the map, otherwise a dark shade)

My current pseudo implementation code will look like this:

for each ant from 1 to colonysize
  create an ant and insert it to the ant_array
  set the ant current position to the starting position in the map
end for

for each rows in map array
  for each column in map array
    if it is first row or first column or last row or last column(these holds the boundary), then...
       assign 0 as value to <row,column> in the map array
    otherwise,
       assign INITIAL_PHEROMONE_FACTOR as value to <row,column> in the map array 
    end if
  end for
end of

for 5 random locations in map(ie. <row, column> )
  insert 0 as value to denote obstacle
end for

for 1 to TOTAL_NUMBER_OF_ITERATIONS
  for 1 to TOTAL_ANTS_IN_COLONY

     find the neighbors of the current ant in top, right, bottom and left positions

     choose randomly a neighboring position from the above 
     check whether that location has an obstacle or is a boundary (ie. if it has 0 as value in array map)
     if so, 
    repeat the above two steps of randomly chosing another neighboring position which was not already considered
     otherwise, continue to the next line..


     set the neighbor position we have selected above as the current position of the ant
     save this position to the ant local path storage

     if the current position of this ant is the destination location, 
    then end program

  end for

  evaporate pheromones in the map at a constant factor
  deposit pheromones on the current location of all the ants


  draw the visual representationg of the map
end for

Here is a screenshot of what I have done so far:

enter image description here

. , google, , . . , ant , , ? ? , .

. . , , , , .

, . . . psuedo , .

+1
1

Ant :

  • ant. , Ant .
  • , , Ant, .
  • ant, Ant , , , , . - Ant , / .
  • Ant , , , , . Ant , Ant .
  • , , .
  • 3 , .

, .

, !

, . Ant , . , Ant , .

+2

Source: https://habr.com/ru/post/1539987/


All Articles