ConsensusBasedXjl

ConsensusBasedX.jl: Consensus-Based Optimisation in Julia

Stable Dev Build Status Coverage Aqua License: MIT

ConsensusBasedX.jl is a gradient-free stochastic optimisation package for Julia, born out of Consensus.jl and CBXpy. It uses Consensus-Based Optimisation (CBO), a flavour of Particle Swarm Optimisation (PSO) first introduced by R. Pinnau, C. Totzeck, O. Tse, and S. Martin (2017). This is a method of global optimisation particularly suited for rough functions, where gradient descent would fail. It is also useful for optimisation in higher dimensions.

Basic Usage

The main functionality of ConsensusBasedX.jl is function minimisation. It assumes you have defined a function f(x::AbstractVector) that takes a single vector argumemt x of length D = length(x).

For instance, if D = 2, you can minimise f by running:

minimise(f, D = 2)

For more detailed explanations and full-code examples, see the documentation.

Consensus-Based Optimisation

Consensus-based optimisation uses particles to minimise a function $f(x)$. The particles evolve following a stochastic differential equation:

\mathrm{d}X_i(t) = -\lambda \left( X_i - V \right) H \left[ f(X_i) - f(V) \right] \mathrm{d}t + \sqrt{2} \sigma \left| X_i(t) - V(t) \right| \mathrm{d}W_i(t),

where W_i are independent Brownian processes, and where

V(t) = \frac{
\sum\limits_{i} X_i \exp(-\alpha f(X_i))
}{
\sum\limits_{i} \exp(-\alpha f(X_i))
},

is a weighted average of the particle's positions called the consensus point. $\lambda$, $\sigma$, and $\alpha$ are given positive parameters.

Copyright © 2024 Dr Rafael Bailo and Purpose-Driven Interacting Particle Systems Group. MIT License.