Low-level interface

Internally, the minimise routine relies on two constructs: the ParticleDynamic and a CBXMethod.

ConsensusBasedXLowLevel

ConsensusBasedX.jl defines the ConsensusBasedXLowLevel submodule for the convenience of advanced users. It can be imported by

using ConsensusBasedX, ConsensusBasedX.ConsensusBasedXLowLevel

ParticleDynamic

The ParticleDynamic struct defines the evolution in time of particles, and is agnostic of the specific method in question. Its functionality currently serves ConsensusBasedOptimisation, but can be extended to other methods.

ParticleDynamicCache

ParticleDynamic requires a cache, ParticleDynamicCache. This can be constructed with:

The full reference is:

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

ConsensusBasedOptimisation

The ConsensusBasedOptimisation struct (of type CBXMethod) defines the details of the consensus-based optimisation method (function evaluations, consensus point...).

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

ConsensusBasedOptimisationCache

ConsensusBasedOptimisation requires a cache, ConsensusBasedOptimisationCache (of type CBXMethodCache). This can be constructed with:

Note that this method is called automatically by ConsensusBasedX.construct_particle_dynamic_cache.

The full reference is:

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

ConsensusBasedSampling

The ConsensusBasedSampling struct (of type CBXMethod) defines the details of the consensus-based sampling method (function evaluations, covariance matrix...).

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

ConsensusBasedSamplingCache

ConsensusBasedSampling requires a cache, ConsensusBasedSamplingCache (of type CBXMethodCache). This can be constructed with ConsensusBasedX.construct_method_cache.

The full reference is:

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