ConsensusBasedX.ConsensusBasedOptimisationType
ConsensusBasedOptimisation

Fields:

  • f, the objective function.
  • correction<:CBXCorrection, a correction term.
  • noise<:Noises, a noise mode.
  • α::Float64, the exponential weight parameter.
  • λ::Float64, the drift strengh.
  • σ::Float64, the noise strengh.
ConsensusBasedX.ConsensusBasedOptimisationCacheType
ConsensusBasedOptimisationCache{T}

It is strongly recommended that you do not construct ConsensusBasedOptimisationCache by hand. Instead, use ConsensusBasedX.construct_method_cache.

Fields:

  • consensus::Vector{Vector{T}}, the consensus point of each ensemble.
  • consensus_energy::Vector{T}, the energy (value of the objective function) of each consensus point.
  • consensus_energy_previous::Vector{T}, the previous energy.
  • distance::Vector{Vector{T}}, the distance of each particle to the consensus point.
  • energy::Vector{Vector{T}}, the energy of each particle.
  • exponents::Vector{Vector{T}}, an exponent used to compute logsums.
  • logsums::Vector{T}, a normalisation factor for weights.
  • weights::Vector{Vector{T}}, the exponential weight of each particle.
  • energy_threshold::Float64, the energy threshold.
  • energy_tolerance::Float64, the energy tolerance.
  • max_evaluations::Float64, the maximum number of f evaluations.
  • evaluations::Vector{Int}, the current number of f evaluations.
ConsensusBasedX.ConsensusBasedSamplingType
ConsensusBasedSampling

Fields:

  • f, the objective function.
  • root<:Roots, a mode for the square toor of the covariance.
  • α::Float64, the exponential weight parameter.
  • λ::Float64, the mode parameter. λ = 1 / (1 + α) corresponds to CBS_mode = :sampling, and λ = 1 corresponds to CBS_mode = :minimise.
ConsensusBasedX.ConsensusBasedSamplingCacheType
ConsensusBasedSamplingCache{T}

It is strongly recommended that you do not construct ConsensusBasedSamplingCache by hand. Instead, use ConsensusBasedX.construct_method_cache.

Fields:

  • consensus::Vector{Vector{T}}, the consensus point of each ensemble.
  • consensus_energy::Vector{T}, the energy (value of the objective function) of each consensus point.
  • consensus_energy_previous::Vector{T}, the previous energy.
  • energy::Vector{Vector{T}}, the energy of each particle.
  • exponents::Vector{Vector{T}}, an exponent used to compute logsums.
  • logsums::Vector{T}, a normalisation factor for weights.
  • noise::Vector{Vector{T}}, a vector to contain the noise of one iteration.
  • root_covariance::Vector{Matrix{T}}, the matrix square root of the weighted covariance of the particles.
  • weights::Vector{Vector{T}}, the exponential weight of each particle.
  • energy_threshold::Float64, the energy threshold.
  • energy_tolerance::Float64, the energy tolerance.
  • max_evaluations::Float64, the maximum number of f evaluations.
  • evaluations::Vector{Int}, the current number of f evaluations.
  • exp_minus_Δt::Float64, the time-stepping parameter.
  • noise_factor::Float64, the noise multiplier.
ConsensusBasedX.ParticleDynamicCacheType
ParticleDynamicCache

It is strongly recommended that you do not construct ParticleDynamicCache by hand. Instead, use ConsensusBasedX.construct_particle_dynamic_cache.

Fields:

  • mode should be set to ParticleMode.
  • parallelisation<:Parallelisations, the parallelisation mode.
  • method_cache<:CBXMethodCache, a cache for the method field of ParticleDynamic.
  • D::Int, the dimension of the problem.
  • N::Int, the number of particles per ensemble.
  • M::Int, the number of ensembles.
  • X, the particle array.
  • dX, the time derivative array.
  • Δt::Float64, the time step.
  • root_Δt::Float64, the square root of the time step.
  • root_2Δt::Float64, the square root of twice the time step.
  • max_iterations::Float64, the maximum number of iterations.
  • max_time::Float64, the maximal time.
  • iteration::Vector{Int}, the vector containing the iteration count per ensemble.
ConsensusBasedX.AckleyMethod
Ackley(x::AbstractVector; a = 20, b = 0.2, c = 2π, shift = 0)

The Ackley function in dimension D = length(x) with global minimum at the point $x = (\textrm{shift}, \textrm{shift}, \cdots, \textrm{shift})$:

\[f(x) = a \left[ 1 - \exp \left( -b \sqrt{ \frac{1}{D} \sum_{d=1}^{D} (x_d - \textrm{shift})^2 } \right) \right] + \left[ \exp(1) - \exp \left( \frac{1}{D} \sum_{d=1}^{D} \cos( c (x_d - \textrm{shift}) ) \right) \right] .\]

See also the Wikipedia article.

ConsensusBasedX.QuadraticMethod
Quadratic(x::AbstractVector; shift = 0)

A quadratic function in dimension D = length(x) with global minimum at the point $x = (\textrm{shift}, \textrm{shift}, \cdots, \textrm{shift})$:

\[f(x) = \frac{1}{D} \sum_{d=1}^{D} (x_d - \textrm{shift})^2 .\]

ConsensusBasedX.RastriginMethod
Rastrigin(x::AbstractVector; a = 10, c = 2π, shift = 0)

The Rastrigin function in dimension D = length(x) with global minimum at the point $x = (\textrm{shift}, \textrm{shift}, \cdots, \textrm{shift})$:

\[f(x) = \frac{1}{D} \sum_{d=1}^{D} (x_d - \textrm{shift})^2 + a \left( 1 - \frac{1}{D} \sum_{d=1}^{D} \cos( c (x_d - \textrm{shift}) ) \right) .\]

See also the Wikipedia article.

ConsensusBasedX.construct_method_cacheFunction
construct_method_cache(
  config::NamedTuple,
  X₀::AbstractArray,
  method::CBXMethod,
  particle_dynamic::ParticleDynamic,
)

A constructor helper for CBXMethodCache.

ConsensusBasedX.maximiseMethod
maximise(f; keywords...)
maximise(config::NamedTuple, f)

Maximise the function f using Consensus-Based Optimisation.

Attempts to define x -> -f(x) and calls the minimise routine. This might be better handled directly by the user (see Maximisation).

maximize is an alias for maximise.

See also minimise.

ConsensusBasedX.minimiseMethod
minimise(f; keywords...)
minimise(f, config::NamedTuple)

Minimise the function f using Consensus-Based Optimisation (see Function minimisation).

You must specify the dimension D of the problem. Other paramters (e.g. the number of particles N or the number of ensembles M can also be specified; see Summary of options.

minimize, optimise, or optimize are aliases for minimise.

Examples

minimise(f, D = 2)
config = (; D = 2);
minimise(f, config)
minimise(f, D = 2, N = 20)
config = (; D = 2, N = 20);
minimise(f, config)
ConsensusBasedX.sampleMethod
sample(f; keywords...)
sample(f, config::NamedTuple)

Sample the distribution exp(-αf) using Consensus-Based Sampling (see Distribution sampling).

You must specify the dimension D of the problem. Other paramters (e.g. the number of particles N or the number of ensembles M can also be specified; see Summary of options.

Examples

out = sample(f, D = 2, extended_output = true);
out.sample
config = (; D = 2, extended_output = true);
out = sample(f, config);
out.sample
out = sample(f, D = 2, N = 20, extended_output = true);
out.sample
config = (; D = 2, N = 20, extended_output = true);
out = sample(f, config);
out.sample