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. It also implements Consensus-Based Sampling (CBS), as introduced in J. A. Carrillo, F. Hoffmann, A. M. Stuart, and U. Vaes (2022).

Basic minimisation

The main functionality of ConsensusBasedX.jl is function minimisation via CBO. 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)

Basic sampling

ConsensusBasedX.jl also provides CBS. The package exports sample, which behaves exactly as minimise.

For instance, if D = 2, you can sample exp(-αf) by running:

out = sample(f, D = 2, extended_output=true)
out.sample

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

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