Skip to content

rgreen13/PSO-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

PSO-Python

A simple implementation of classic Particle Swarm Optimization in Python.

Usage

  1. Update the fitFunc function to accurately reflect your fitness function
  2. Adjust Np and Nd to reflect your fitness function
  3. Adjust xMin, xMax, vMin, and vMax to reflect your fitness function
  4. Adjust gBestValue and pBestValue initialization to reflect your fitness function
  5. Run the code!

Method Names

fitFunc: User defined fitness function

initPosition: Initializes R with random values

initVelocity: Initializes V with random values

updatePosition: Updates R values based on V

updateVelocity: Updates V values based on gBestPos, pBestPos, w, and chi

udpateFitness: Updates M values based on R

Variable Names

R: Position

V: Velocity

M: Fitness

Np: Number of Probes Nd: Number of Dimensions Nt: Number of Iterations

w: Omega wMin: Omega Minimum Value wMax: Omega Maximum Value

chi: Constriction Factor

xMin: Minimum value for any dimension in R xMax: Maximum value for any dimension in R

vMin: Minimum value for any dimension in V vMax: Maximum value for any dimension in V

gBestValue: Global best fitness value gBestPos: Global best fitness position

pBestValue: Personal best fitness value pBestPos: Personal best fitness position

About

Particle Swarm Optimization in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages