Coder Social home page Coder Social logo

pdips / consensusbasedx.jl Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 652 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 argumemt 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

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

Stargazers

 avatar Orjan Ameye avatar  avatar  avatar David Gómez-Castro avatar  avatar Jeremy Wu avatar Antonio Esposito avatar Evolutionary-Intelligence avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

consensusbasedx.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Add examples

It would be nice to add worked examples in the repository, illustrating the full pipeline: define initial particles, run CBO, plot the results. I'd like to work on implementing CBS, but am a little bit stuck getting an example for CBO to run fully. I really like the DefaultKeywordArguments technique, but it does make debugging more difficult.

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.