Single-Objective Optimizers

These are standard optimization techniques for finding the optima of a single objective function.


Single-objective optimization where the search-space is continuous. Perfect for optimizing various common functions.

  • pyswarms.single.global_best - classic global-best Particle Swarm Optimization algorithm with a star-topology. Every particle compares itself with the best-performing particle in the swarm.
  • pyswarms.single.local_best - classic local-best Particle Swarm Optimization algorithm with a ring-topology. Every particle compares itself only with its nearest-neighbours as computed by a distance metric.
  • pyswarms.single.general_optimizer - alterable but still classic Particle Swarm Optimization algorithm with a custom topology. Every topology in the pyswarms.backend module can be passed as an argument.


Single-objective optimization where the search-space is discrete. Useful for job-scheduling, traveling salesman, or any other sequence-based problems.

  • pyswarms.discrete.binary - classic binary Particle Swarm Optimization algorithm without mutation. Uses a ring topology to choose its neighbours (but can be set to global).


Benchmark Functions

These functions can be used as benchmarks for assessing the performance of the optimization algorithm.


A quick and easy to use tool for the visualization of optimizations. It allows you to easily create animations and to visually check your optimization!


Deprecated since version 0.4.0: Use pyswarms.utils.plotters instead!

Various environments that allow you to analyze your swarm performance and make visualizations!

  • pyswarms.utils.environments.plot_environment - an environment for plotting the cost history and animating particles in a 2D or 3D space.