Getting Started

Tribes PSO is designed to be extensible without recompiling the core DLL. If all you want to do is optimize a problem using the built in search spaces and particles, simply implement TribesPSO.IObjectiveFunction and pass it to one of the concrete SearchSpace implementations (SingleThreadedGaussianSearchSpace for example) See GaussianBenchmark and RosenbrockBenchmark for examples on how to do this.


Below are some walk through examples of how to use TribesPSO. They will get more in-depth as time goes on

Extending the Code

If you don't like the order in which the particles move or if you want to change the type of particles in a search space, you'll need to provide a new implementation of TribesPSO.SearchSpace. The two method implementations that are required are
  • abstract void Move()
  • abstract Particle GenerateParticleAtPosition(EuclidianVector position)
These two methods determine how the particles move (one at a time, in random order, etc.) and the type of particle that is created whenever a new particle is added to the swarm.

There are also a number of default search space behaviors that can be changed in a child class. For example:
  • bool NeedsToAdapt(int movesSinceLastAdaptation) controls how often the search space adds or removes particles
  • void Adapt() controls which particles are removed and how many new particles are added
  • EuclidianVector GeneratePosition() determines how new particles are placed within the search space
  • void SeedSearchSpace() places the first particle(s) in the search space

If you don't like the movement strategy of the particles, you'll need to provide your own implementation of TribesPSO.Particle. Specifically you'll need to provide an implementation of the CalculateNewPosition method. See HypersphereParticle.cs and IndependentGaussianParticle.cs. You'll also need to provide a new TribesPSO.SearchSpace implementation that creates the new particle via the GenerateParticleAtPosition method.

Last edited Jul 7, 2011 at 2:20 AM by pbaughman, version 9


No comments yet.