cbx.dynamics.CBO#

class cbx.dynamics.CBO(f, **kwargs)[source]#

Bases: CBXDynamic

Consensus-based optimization (CBO) class

This class implements the CBO algorithm as described in [1]. The algorithm is a particle dynamic algorithm that is used to minimize the objective function \(f(x)\).

Parameters:
  • x (array_like, shape (N, d)) – The initial positions of the particles. For a system of \(N\) particles, the i-th row of this array x[i,:] represents the position \(x_i\) of the i-th particle.

  • f (objective) – The objective function \(f(x)\) of the system.

  • dt (float, optional) – The parameter \(dt\) of the system. The default is 0.1.

  • lamda (float, optional) – The decay parameter \(\lambda\) of the system. The default is 1.0.

  • alpha (float, optional) – The heat parameter \(\alpha\) of the system. The default is 1.0.

  • noise (noise_model, optional) – The noise model that is used to compute the noise vector. The default is normal_noise(dt=0.1).

  • sigma (float, optional) – The parameter \(\sigma\) of the noise model. The default is 1.0.

References

inner_step()#

This function is used in meth:step to perform the inner step. This function implements the actual update of the dynamic and is therfore the most important function in the dynamics class. This function should be overwritten by subclasses to perform any inner steps.

Parameters:

None

Returns:

None