Sunday, 2 February 2014

Programming swarm intelligence

Incidentally, exploring swarm intelligence isn't terribly difficult if you know a bit of programming... when I was experimenting with it, I just used VBA and Excel.  The trick is knowing object oriented programming and using it to create multiple entities that can interact in a virtual environment - e.g., by position on a 2 dimensional matrix.  Excel's main advantage is that its easy to dump the results out into a worksheet to examine and graph, though I wouldn't use it for any computationally heavy project.  Because the behavior of your entities is based on simple rules, the programming can be as basic as checking if the block in an array at the position ahead or behind is occupied, and then altering behavior accordingly... or assessing the values of the other members of the swarm and modifying its status in response. 

It would be nice if I could point to a bespoke programming environment for programming and experimenting with these concepts... I suspect with some looking I could find one, but it would probably be locked away in some university comp sci lab. I did find reference to this book which has a chapter on swarm intelligence and some pseudocode to start people out with however.

Swarm Intelligence and Data Mining


Some years ago, I experimented with swarm intelligence as a way to search out optimal solutions for non-linear problems.  The idea behind this is that rather than taking a straight computational approach, you use a swam of entities that 'search' the computational space for the optimal solution, each entity following a set of search rules and communicating with the other entities in order to quickly find the best result.  Its used for problems where there may be multiple 'sorta right' answers and where its easy to get an answer that is better than the others, but not the best possible answer. Think of problems such as the travelling salesman problem, where the is one best solution, but it could take a long time to find it, and there are lots of suboptimal solutions that look right (better than most) but aren't the best.

The inspiration for this approach is taken directly from nature... ants are an obvious type of animal that uses swarm intelligence, as are flocking birds and schooling fishes.  Using simple rules of proximity, they maintain a structure and move as a unit (or in the case of ants, move towards a goal) without an overarching intelligence.  On this video below, look at the way these grunts change their movement and shift direction together as I swim through the school...  they do it almost automatically, with no pauses to reassess their location and speed.  Imagine trying to do this if you were driving in a 'swarm' of cars... without the instinct to automatically judge neighbors distance and adjust speed and direction, it would be a disaster.






Monday, 27 January 2014

Creatures of the deep



They don't really seem real, resting there in the Nautilus tank at The Deep. At first I thought they might be part of a static display, they looked that artificial... then one lifted off and started drifting in the water.  I quickly turned on my camera and started filming, hoping that in the dim light I could capture some of this graceful unreal motion.  By chance, he swam under a beam of light, providing this short clip, before drifting back into darkness. 

Amazing.

Thursday, 9 January 2014

Rock Lobster


There are moments you really hope the camera is working...