Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt colony simulation - optimizing the path
    primarykey
    data
    text
    <p>I am trying to build a simple ant colony simulation. The world is grid of squares; each one of them can consist of some level of pheromone and any number of ants. There are 2 types of pheromone: food pheromone and nest pheromone. Ants know nothing about the environment, but ants that return to nest follow nest pheromone (in the sense that they almost always choose to move to the cell with the maximum pheromone level, among all nearby cells) and leave food pheromone, and vice versa.</p> <p>From time to time the ants make random moves not in the direction of maximum pheromone. Each tick of the simulation the ant checks the level of the pheromone in 8 nearby cells, and if the pheromone level in the current cell is less then the maximum of pheromone level in all nearby cell, it adds some pheromone. </p> <p>The current simulation works pretty well, but the path found is not the optimal one. I have 2 problems that I don't know how to solve:</p> <ol> <li>How do I simulate the fact that the diagonal move is longer than the non-diagonal move (up,down left or right)?</li> </ol> <p><img src="https://i.stack.imgur.com/1Hal9.jpg" alt="In the current situation, black path and blue path are equal in length. In realty, however, blue path is shorter."></p> <ol> <li>How should I simulate the diffusion of the pheromone? Right now, the pheromone evaporates over time but there is no diffusion. I have tried to transfer some amount of the pheromone from each cell, each tick of the simulation, to the 8 nearby cells, but the result was a total mess - the whole environment was full with pheromone - I think it was because of the mechanism the ants use to adjust the pheromone level.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload