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.
ConsensusBasedX.ParticleDynamic
— TypeParticleDynamic
Fields:
method<:CBXMethod
, the optimisation method.Δt::Float64
, the time step.
ParticleDynamicCache
ParticleDynamic
requires a cache, ParticleDynamicCache
. This can be constructed with:
ConsensusBasedX.construct_particle_dynamic_cache
— Functionconstruct_particle_dynamic_cache(
config::NamedTuple,
X₀::AbstractArray,
particle_dynamic::ParticleDynamic,
)
A constructor helper for ParticleDynamicCache
. Calls ConsensusBasedX.construct_method_cache
to construct the corresponding CBXMethodCache
.
The full reference is:
ConsensusBasedX.ParticleDynamicCache
— TypeParticleDynamicCache
It is strongly recommended that you do not construct ParticleDynamicCache
by hand. Instead, use ConsensusBasedX.construct_particle_dynamic_cache
.
Fields:
mode
should be set toParticleMode
.parallelisation<:Parallelisations
, the parallelisation mode.method_cache<:CBXMethodCache
, a cache for themethod
field ofParticleDynamic
.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.
ConsensusBasedOptimisation
The ConsensusBasedOptimisation
struct (of type CBXMethod
) defines the details of the consensus-based optimisation method (function evaluations, consensus point...).
ConsensusBasedX.ConsensusBasedOptimisation
— TypeConsensusBasedOptimisation
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.
ConsensusBasedOptimisationCache
ConsensusBasedOptimisation
requires a cache, ConsensusBasedOptimisationCache
(of type CBXMethodCache
). This can be constructed with:
ConsensusBasedX.construct_method_cache
— Functionconstruct_method_cache(
config::NamedTuple,
X₀::AbstractArray,
method::CBXMethod,
particle_dynamic::ParticleDynamic,
)
A constructor helper for CBXMethodCache
.
Note that this method is called automatically by ConsensusBasedX.construct_particle_dynamic_cache
.
The full reference is:
ConsensusBasedX.ConsensusBasedOptimisationCache
— TypeConsensusBasedOptimisationCache{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 computelogsums
.logsums::Vector{T}
, a normalisation factor forweights
.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 off
evaluations.evaluations::Vector{Int}
, the current number off
evaluations.
ConsensusBasedSampling
The ConsensusBasedSampling
struct (of type CBXMethod
) defines the details of the consensus-based sampling method (function evaluations, covariance matrix...).
ConsensusBasedX.ConsensusBasedSampling
— TypeConsensusBasedSampling
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 toCBS_mode = :sampling
, andλ = 1
corresponds toCBS_mode = :minimise
.
ConsensusBasedSamplingCache
ConsensusBasedSampling
requires a cache, ConsensusBasedSamplingCache
(of type CBXMethodCache
). This can be constructed with ConsensusBasedX.construct_method_cache
.
The full reference is:
ConsensusBasedX.ConsensusBasedSamplingCache
— TypeConsensusBasedSamplingCache{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 computelogsums
.logsums::Vector{T}
, a normalisation factor forweights
.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 off
evaluations.evaluations::Vector{Int}
, the current number off
evaluations.exp_minus_Δt::Float64
, the time-stepping parameter.noise_factor::Float64
, the noise multiplier.