Binary particle swarm optimization (BPSO) adapts particle swarm optimization to decisions represented by 0s and 1s. A particle’s position is a bit string rather than a vector of continuous values. This makes BPSO a candidate when each variable is a binary choice, as in feature selection. section 9.3
A BPSO update keeps the swarm’s cooperative search but changes how positions are chosen:
- Evaluate particle positions and use each particle’s best-known position and the best-known position among its neighbors to guide the search. section 9.3 section 9.8
- Update velocity as a real-valued quantity, then pass it through a sigmoid function to obtain a value between 0 and 1. section 9.3
- For each bit, compare that value with a random number between 0 and 1 to choose its next position. A value of 0.3 means a 30% chance that the updated bit is 1—not a 30% chance that its current value flips. section 9.3
Check the representation before choosing a variant
A Python comparison uses PySwarms to train a neural network on penguin measurements with global-best, local-best, and binary PSO. In the reported run, their accuracies are 99.1%, 69.1%, and 43.8%, respectively. Binary PSO is a poor match here because the network parameters are continuous; its availability as an optimizer does not make every search space binary. section 9.7
Choose BPSO for a binary encoding, not merely because a problem is discrete: permutation-based PSO is another variant for discrete search. When experimenting, tune inertia and cognitive and social coefficients to balance exploration and exploitation, and check whether the representation matches the variables being optimized. section 9.3 section 9.8
