Coder Social home page Coder Social logo

gaceladri / pyswarms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ljvmiranda921/pyswarms

0.0 2.0 0.0 3.85 MB

A research toolkit for particle swarm optimization in Python

Home Page: https://pyswarms.readthedocs.io/en/latest/

License: MIT License

Makefile 1.60% Python 98.40%

pyswarms's Introduction

PySwarms Logo


PyPI Version Build Status Documentation Status Code Health Updates Python versions License Citation

PySwarms is a an extensible research toolkit for particle swarm optimization (PSO) in Python.

Features

  • High-level module for Particle Swarm Optimization. For a list of all optimizers, check this link.
  • Test optimizers using various objective functions
  • (For Devs and Researchers): Highly-extensible API for implementing your own techniques
  • Easy API built on matplotlib to create animations like these:
3d particle plot cost history plot

Dependencies

  • numpy >= 1.13.0
  • scipy >= 0.17.0
  • matplotlib >= 1.3.1

Installation

To install PySwarms, run this command in your terminal:

$ pip install pyswarms

This is the preferred method to install PySwarms, as it will always install the most recent stable release.

In case you want to install the bleeding-edge version, clone this repo:

$ git clone https://github.com/ljvmiranda921/pyswarms.git

and then run

$ python setup.py install

Basic Usage

To use PySwarms in your project,

import pyswarms as ps

Suppose you want to find the minima of f(x) = x^2 using global best PSO, simply import the built-in sphere function, pyswarms.utils.functions.sphere_func(), and the necessary optimizer:

import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx

# Set-up hyperparameters
options = {'c1': 0.5, 'c2': 0.3, 'w':0.9}

# Call instance of PSO
optimizer = ps.single.GlobalBestPSO(n_particles=10, dimensions=2, options=options)

# Perform optimization
stats = optimizer.optimize(fx.sphere_func, iters=100)

Credits

This project was inspired by the pyswarm module that performs PSO with constrained support. The package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Cite us

Are you using PySwarms in your project or research? Please cite us!

@article{PySwarms2017,
    author = "Lester James V. Miranda",
    year = 2017,
    title = "PySwarms, a research-toolkit for Particle Swarm Optimization in Python",
    doi = {10.5281/zenodo.986300},
    url = {https://zenodo.org/badge/latestdoi/97002861}
}

Others

Like it? Love it? Leave us a star on Github to show your appreciation!

pyswarms's People

Contributors

carl-k avatar cpapadim avatar jazcap53 avatar pyup-bot avatar siokcronin avatar

Watchers

 avatar  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.