ARKIMEDZ

Posts Art About

Simulating Physarum polycephalum

Physarum polycephalum has been found to solve shortest path problems with when one more food sources are available in its vicinit. Its growth was shown to mimic the Tokyo rail transport network when the food sources were at the location of train stations. It also showed some form of ‘memory’ by remembering and anticipating changes to its environment.

Paper - Characteristics of pattern formation …

The paper assumes that it is impossible for Physarum to have global knowledge, but we don’t know for sure. Theoretically it does seem illogical for something that only grows cell-by-cell to have some sort of a nervous system to acquire, store or process global knowledge. But some experiments have shown that they can ‘remember’ changes to their environment - how would that be possible without global knowledge?

Almost all of these simulations are in 2D, what would they look like in 3D?

The paper also specifies that there are certain modifications that have been left out of the paper like: - hazardous stimuli

Ideas:

Algorithm (source)

Sage Jenson made some changes to the algorithm as described in physarum - Sage Jenson: - Removed the constraint that only one agent can occupy a single pixel - Added a contagion behavior based on which an infected agent lays down a trail of infection - similar to the ant-pheromone simulations.

2022-09-10

Starting off

Diffusion kernel, which Github Co-pilot did a pretty good job in creating

Adding Decay

2022-09-11

Added FL, F and FR sensing to the agents. I’m seeing clustering but not patterns really

Github co-pilot is continuing to amaze me! I typed “draw sensors” and copilot wrote the code for it in a second! Loving it!

Displaying the params now. But I’m not getting any patterns as described in the paper!

One hunch that I have is that I’m only allowing the agents to move in a discrete direction (rounding off the position’s x and y values) - I may have to allow the agnets to move on the non-discretized values while the attractant deposit and diffusion still happen on a discrete grid.

Ok, I tried that but all I’m seeing is clustering and no patterns

There was a bug in my code where the agents were never rotating right! Fixed and and seeing patterns immediately :)

2022-09-13

I removed the boundary conditions and started to run the simulation for longer time frames. But invariably, I’m getting the same ‘window frame’ pattern each time. Because the agents are crowding around the edges each time, I think that there’s something wrong with my boundary removal logic

It could be that, or the fact that it’s a rectangular ‘wrapping’ grid instead of a sphere.

2022-09-14

There always seems to be some affinity for the conrners without or without boundary conditions

But for some runs, I am seeing a circular formation with boundary conditions enabled. I think that the ideal way (to simulate real world) would be to insantiate the agents in a circle instead of a square so that most agents never reach the boundary in any direction.

This closely resembles Figure 9 in the paper.

2022-09-16

Experimenting with pre-pattern stimuli. Added several areas where the chemoattractant is deposited artifically every cycle.

2022-09-22

Struggling with performance. Using chrome profiler:

The default P5.js functions are the bottleneck atm. I don’t really need to create Vectors as I’m not using most of the functionality of Vectors - I could create an array of numbers [x, y] and use that instead.

There are a few ideas that I have

I’m looping 30 time in each draw call (and, so, drawing only every 30 steps) but it’s still too slow. I need to speed up things further. Exporting logic to Rust/Wasm will require quite a bit of effort. I’m going to start with using web workers and see where it gets me.