Dispersive Flies Optimisation ( DFO )

Dispersive Flies Optimisation (DFO) is a global optimisation algorithm that is inspired by observing behaviour of swarming flies in the real world. The algorithm is going through a defined search space and it’s trying to find the most optimal value, which will converge the flies towards their target. We use the DFO to benchmark different test functions for our optimisation.


The swarming behaviour of the flies optimisation is based on a value called ‘fitness’. This value judges how optimal the data is and based on the value of the ‘fitness’, it will attract the swarm of flies towards the new found optimal position. During the test of finding the most optimal fitness value, the algorithm is also applying random values to disburse the flies across the search space and away from the best fitness value. This is an attempt to further explore the search space and perhaps find a better potential fitness value.


Together with Terry, we implemented the algorithm that was given to us in the lab, using C++ in OpenFrameworks. The whole visualisation part of this algorithm was a bit unclear to me in the lab, but after digging through the program and by implemented it ourselves, it made much more sense. Especially when it’s applied in two dimensions. ( shown in the gif below )


The conclusion of implementing the algorithm was that we managed to successfully create a program that basically creates a way for us to measure the performance of each fitness function. So to experiment with this program further we need to assign it to a specific problem.


During the lecture we discussed how the DFO works based on this mathematical formula:


What this translate to in words:


New current fly position = best neighbour position + randomNumber( 0, 1 ) x ( best fly position - current fly position )


This is how it would look in code:


for (int d = 0; d < dim; d++) {
         temp[d] = flies[chosen].getPos(d) + ofRandom(0,1) * (flies[bestIndex].getPos(d) - flies[i].getPos(d));
}


What we're doing in this loop is that we're calculating where the current fly needs to go based on the position on the best nearest fly, the best fly in the swarm and based by its own position.
Depending on the dispersive random value, the flies will be dispersed from their current position to explore more of the search space, as mention earlier. The dispersive value is also to make sure that none of the flies get stuck in a local minima in order to find the globally optimised position.


Output : Programmed in C++ with OpenFrameworks using the sphere function.
As you can see the fitness is decreasing. This is just a short gif but I found it very interesting to test different functions and see how the behaviour changed.


DFO.gif


Possible usages:


I see this being used in many different fields of study, for example in games where you can for example use it for pathfinding.
Another useful application for this type of behaviour would be in image processing where you can possibly identify specific colours within an image or a video by using all the pixels as your search space to for example find specific colour areas or specific coloured objects.

For my own personal interest I would love to use swarm behaviour to interact with the user in VR. I believe that it would be a powerful effect to use a natural phenomenon inside a virtual world, and I will most likely develop this further using the Unity game engine.

Resources:

Original paper & source code:
http://doc.gold.ac.uk/mohammad/DFO/



Comments

Popular posts from this blog

Physical Computing, Final Project

Image alignment & finding symmetry with DFO