All Projects → nathanrooy → Particle Swarm Optimization

nathanrooy / Particle Swarm Optimization

Licence: gpl-3.0
Learn about particle swarm optimization (PSO) through Python!

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Particle Swarm Optimization

Functional intro to python
[tutorial]A functional, Data Science focused introduction to Python
Stars: ✭ 228 (+94.87%)
Mutual labels:  tutorial, optimization
Annotation Processing Example
It is the example project for the annotation processing tutorial.
Stars: ✭ 116 (-0.85%)
Mutual labels:  tutorial
Chocolate
A fully decentralized hyperparameter optimization framework
Stars: ✭ 112 (-4.27%)
Mutual labels:  optimization
Mlr
Machine Learning in R
Stars: ✭ 1,542 (+1217.95%)
Mutual labels:  tutorial
Tensorflow Object Detection Tutorial
The purpose of this tutorial is to learn how to install and prepare TensorFlow framework to train your own convolutional neural network object detection classifier for multiple objects, starting from scratch
Stars: ✭ 113 (-3.42%)
Mutual labels:  tutorial
Sshserver
This is a tutorial on how to build a basic SSH Server in C#, but you are welcome to try following in any language.
Stars: ✭ 114 (-2.56%)
Mutual labels:  tutorial
Aruco Markers
Working examples/tutorial for detection and pose estimation of ArUco markers with C++
Stars: ✭ 112 (-4.27%)
Mutual labels:  tutorial
Evolving Simple Organisms
Evolving simple organisms using a genetic algorithm and deep learning from scratch with python
Stars: ✭ 117 (+0%)
Mutual labels:  tutorial
Node Or Tools
Node.js bindings for or-tools vehicle routing problems
Stars: ✭ 115 (-1.71%)
Mutual labels:  optimization
Boot App
This repository is an example application for Spring Boot and Angular2 tutorial.
Stars: ✭ 113 (-3.42%)
Mutual labels:  tutorial
Reactinterface
This is the repository for my course, Building a Web Interface with React.js on LinkedIn Learning and Lynda.com.
Stars: ✭ 113 (-3.42%)
Mutual labels:  tutorial
Byte Of Python
Beginners book on Python - start here if you don't know programming
Stars: ✭ 1,713 (+1364.1%)
Mutual labels:  tutorial
Cadl
ARCHIVED: Contains historical course materials/Homework materials for the FREE MOOC course on "Creative Applications of Deep Learning w/ Tensorflow" #CADL
Stars: ✭ 1,478 (+1163.25%)
Mutual labels:  tutorial
Webhub
📦前端资源/学习/问题整理中心,请看issue
Stars: ✭ 112 (-4.27%)
Mutual labels:  tutorial
Stanford Tensorflow Tutorials
This repository contains code examples for the Stanford's course: TensorFlow for Deep Learning Research.
Stars: ✭ 10,098 (+8530.77%)
Mutual labels:  tutorial
Mlf Mlt
📚 机器学习基石和机器学习技法作业
Stars: ✭ 112 (-4.27%)
Mutual labels:  tutorial
React Redux Boilerplate
It is a boilerplate of React-Redux as the infrastructure, which helps to setup a Web APP quickly
Stars: ✭ 113 (-3.42%)
Mutual labels:  tutorial
Microservice Rs
Tutorial codebase for writing a microservice in Rust
Stars: ✭ 114 (-2.56%)
Mutual labels:  tutorial
Drone Tutorial
Drone Continuous Delivery Documentation using docker-compose
Stars: ✭ 117 (+0%)
Mutual labels:  tutorial
Raspberry Pi Os
Learning operating system development using Linux kernel and Raspberry Pi
Stars: ✭ 11,000 (+9301.71%)
Mutual labels:  tutorial

Particle Swarm Optimization with Python

gh-actions-ci GitHub license codecov

Particle swarm optimization (PSO) is amazing and I created a series of tutorials that cover the topic using Python. The first (pso-simple) is comprised of a bare bones implementation and is useful for anyone new to PSO and looking to get a good understanding of how it works. The tutorial can be found here: https://nathanrooy.github.io/posts/2016-08-17/simple-particle-swarm-optimization-with-python/

The second version (pso-advanced) is still a work in progress...

Installation

You can either download/clone this repo and use as is, or you can pip install it with the following command:

pip install git+https://github.com/nathanrooy/particle-swarm-optimization

Usage

particle swarm optimization - simple

Once you have completed the installation, usage is similar to that of other common optimization frameworks.

>>> from pso import pso_simple

Next, you need to specify a cost fucntion. I included the sphere function for example purposes, but you'll probably end up using your own.

>>> from pso.cost_functions import sphere

Next, let's specify some bounds and an initial starting location:

>>> initial=[5,5]               # initial starting location [x1,x2...]
>>> bounds=[(-10,10),(-10,10)]  # input bounds [(x1_min,x1_max),(x2_min,x2_max)...]

Lastly, lets minimize this thing!

>>> pso_simple.minimize(sphere, initial, bounds, num_particles=15, maxiter=30, verbose=True)

The output of which should look like this:

iter:    0, best solution:  -1.000000
iter:    1, best solution:  50.000000
iter:    2, best solution:  44.186379
iter:    3, best solution:  37.884043
iter:    4, best solution:  26.485279
iter:    5, best solution:  15.552986
iter:    6, best solution:   8.098333
iter:    7, best solution:   2.697282
iter:    8, best solution:   0.514359
iter:    9, best solution:   0.111682
iter:   10, best solution:   0.010832
iter:   11, best solution:   0.002607
iter:   12, best solution:   0.002607
iter:   13, best solution:   0.002607
iter:   14, best solution:   0.000507
iter:   15, best solution:   0.000507
iter:   16, best solution:   0.000507
iter:   17, best solution:   0.000507
iter:   18, best solution:   0.000507
iter:   19, best solution:   0.000507
iter:   20, best solution:   0.000507
iter:   21, best solution:   0.000415
iter:   22, best solution:   0.000268
iter:   23, best solution:   0.000194
iter:   24, best solution:   0.000064
iter:   25, best solution:   0.000064
iter:   26, best solution:   0.000018
iter:   27, best solution:   0.000013
iter:   28, best solution:   0.000001
iter:   29, best solution:   0.000001

FINAL SOLUTION:
   > [0.0010272779593734505, -0.00023254128511081273]
   > 1.109375455095469e-06

particle swarm optimization - advanced

(coming soon...)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].