Coder Social home page Coder Social logo

rafaelbailo / consensusbasedx.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pdips/consensusbasedx.jl

0.0 0.0 0.0 232 KB

A Julia package for consensus-based optimisation

Home Page: https://pdips.github.io/ConsensusBasedX.jl/

License: MIT License

Julia 100.00%
consensus-based-optimisation julia optimisation particle-swarm-optimisation

consensusbasedx.jl's Introduction

ConsensusBasedXjl

ConsensusBasedX.jl: Consensus-Based Optimisation in Julia

status 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 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).

How to install and use

To install ConsensusBasedX.jl, simply run

using Pkg; Pkg.add("ConsensusBasedX")

in the Julia REPL. You can then load the package in a script or in the REPL by running

using ConsensusBasedX

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 argument x of length D = length(x).

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

minimise(f, D = 2)

Your full code might look like this:

using ConsensusBasedX
f(x) = x[1]^2 + x[2]^2
x = minimise(f, D = 2)

Basic sampling

ConsensusBasedX.jl also provides CBS. The package exports sample, which has the same syntax 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.

Bug reports, feature requests, and contributions

See the contribution guidelines.

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

consensusbasedx.jl's People

Contributors

ctotzeck avatar gdalle avatar konstantinriedl avatar rafaelbailo avatar timroith avatar urbainvaes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.