Boolean Particle Swarm Optimization.

class opytimizer.optimizers.boolean.bpso.BPSO(params: Optional[Dict[str, Any]] = None)

A BPSO class, inherited from Optimizer.

This is the designed class to define boolean PSO-related variables and methods.


F. Afshinmanesh, A. Marandi and A. Rahimi-Kian. A Novel Binary Particle Swarm Optimization Method Using Artificial Immune System. IEEE International Conference on Smart Technologies (2005).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.

Cognitive constant.


Social constant.


Array of local positions.


Array of velocities.

compile(space: opytimizer.core.space.Space) → None

Compiles additional information that is used by this optimizer.

Parameters:space – A Space object containing meta-information.
evaluate(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Evaluates the search space according to the objective function.

  • space – A Space object that will be evaluated.
  • function – A Function object that will be used as the objective function.
update(space: opytimizer.core.space.Space) → None

Wraps Boolean Particle Swarm Optimization over all agents and variables.

Parameters:space – Space containing agents and update-related information.