This demonstration auto-generates a simulation grid randomly (see Informal Explanation tab for more details).
Physarum Polycephalum, a single cell organism, collects together to create food-gathering structures that rival the complexity and efficiency of artificial networks. However, while planning a transportation system may take days or longer for mankind, slime mold can do it in hours without any centralized intelligence. Leveraging these collections of cells and their use of pheromones (chemical messengers) to optimize their internal structure, researchers have modeled transportation systems, wireless networks, and many other artificial systems (Emergence). This simulation demonstrates a computational model for slime mold, one example of an emergent self-organizing complex adaptive system.
If a mathematical / computational model can capture the internal optimizing behavior of Physarum Polycephalum, computers could also perform rapid network optimization just as quickly or even faster than the natural organism. This could help engineers create "smarter" transportation systems, computer networks, etc. This HTML5 canvas-based display demonstrates a possible computational model for Physarum Polycephalum.
Following the Cellular Potts Model explored in Niklas B. Semmler's Emergent Networks: A Slime Mold Simulation, this simulation runs off of a chemical field using "pheromones" like actual slime mold. However, instead of cells giving off these chemical messengers, this model approximates the same phenomenons by having the simulation obstacles and food give off the chemical signals themselves. Therefore, this simulation uses the following chemical attractors and repellents:
The energy of the organism equals the sum of the pheromone values at the spaces occupied by the mold. Thus, each step in the simulation effectively looks at each space S and randomly selects a neighboring space N. The simulation then tries copying the contents of N into S and, if the energy of the organism decreases by copying the contents of that cell, the copy is made. Otherwise, the copy is only made with a probability.
Finally, this model of slime mold also tries to maintain an ideal volume that depends on the number of pieces food the mold has connected to. This keeps the mold from simply growing to occupy the entire simulation grid without trying to optimize itself.
The simulation grid is randomized and then a food source and slime mold cell are placed at the center of the grid.
This simulation progresses through Markov Chain Monte Carlo and the Metropolis Algorithm with the goal of reducing organism energy or, in other words, the sum of the pheromones at the spaces occupied by the mold. The simulation pheromones are defined as the following:
The slime mold energy function also incurs a volume adjustment. Given a linear function which relates "ideal volume" to the number of food sources the mold has connected to, the energy of a mold increases when it extends beyond its ideal volume and decreases when it is below it.
This instance of MCMC runs having each space S randomly select a neighbor N before trying copying the state of N into S. If the energy decreases by the move, the copy is accepted. Otherwise, the move is accepted by probability as is typical in the Metropolis Algorithm.
The simulation starts with a randomized grid before a starting food source and slime mold cell are placed at the center of the grid.
Source code open source and available at http://github.com/Samnsparky/mcmc-slime-mold.