cbx.dynamics.CBOMemory#

class cbx.dynamics.CBOMemory(f, lamda_memory=0.4, sigma_memory=None, **kwargs)[source]#

Bases: CBO

Consensus-based optimization with memory effects (CBOMemory) class

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

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

  • 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.

  • y (array_like, shape (N, d)) – The initial positions of the particles. For a system of \(N\) particles, the i-th row of this array y[i,:] represents the or an approximation of the historical best position \(y_i\) of the i-th particle.

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

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

  • lamda (float, optional) – The decay parameter \(\lambda\) 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.

  • lamda_memory (float, optional) – The decay parameter \(\lambda_{\text{memory}}\) of the system. The default is 1.0.

  • sigma_memory (float, optional) – The parameter \(\sigma_{\text{memory}}\) of the noise model. The default is 1.0.

References

pre_step()[source]#

The pre-step function. This function is used in meth:step before the inner step is performed. This function can be overwritten by subclasses to perform any pre-steps before the inner step.

Parameters:

None

Returns:

None

inner_step()[source]#

Performs one step of the CBOMemory algorithm.

Parameters:

None

Return type:

None

compute_consensus()[source]#

Updates the weighted mean of the particles.

Parameters:

None

Return type:

None

update_best_cur_particle()[source]#

Updates the best current particle and its energy based on the minimum energy found in the energy matrix.

Parameters:

None

Returns:

None