Sunday, November 16, 2008

Hill-Climbing On Boid Swarm Configurations


I implemented a rather silly hill-climbing algorithm that I used on my boid density domain to find a configuration of boid parameters that will produce a flock of a desired density.

The algorithm is as follows:

  1. Generate a bunch of random points around the best solution in the boid 4-dimensional parameter space (number of agents, alignment factor, avoidance factor, cohesion factor)

  2. Check each one to see what the actual density is for that configuration

  3. If the density is closer to the goal density than the best solution, then this solution is the new best solution and go back to step 1

  4. If at any time a solution is found that is within the error bounds, stop


I made a video of this process (11MB).

This is pretty stupid. This will serve as a good starting point or framework for later more complex algorithms. I really need to use some kind of search with memory, so that I can predict where I should hill-climb next... or some kind of machine learning technique like k-nearest neighbor or kernel density estimation. Also, I hope to have some more search algorithms, such as simulated annealing, applied to this problem. At least now I have a nice little framework going so plugging in new algorithms should be rather simple.

No comments:

Post a Comment