Skip to content

single- and multi-objective particle swarm Optimizer

License

Notifications You must be signed in to change notification settings

Lars-Moellerherm/PSO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSO

single- and multi-objective Particle Swarm Optimizer

This module can optimize single and multi objective problems. It uses non domination sorting[1] for multi objective problems.

Particle Swarm Optimization Algorithm

The Particle Swarm Optimizer is an Algorithm which iteratively searches for the optimal solution in a search space, according to a fitness evaluation. The swarm consists of a number of particles, which are solutions in the search space. These particles move in each step, depending on the velocity. The velocity depends on the actual distance of the particle to the best position in history of the particle and to the globally best known position.

Because PSO is an metaheuristic there is no garantee that the swarm moves to the global optimum and doesn't get stuck in a local Extremum

How to use pso class:

Initiate :

  • att : number off Attributes

  • l_b : lower bounds for every Attribute (sticks to these bounds) (numpy.array with length att)

  • u_b : upper bounds for every Attribute (sticks to these bounds) (numpy.array with length att)

  • obj_func : objective function/s (for multi objective use list of function handels)

  • constraints : constraint function/s from type penalty (default: empty list)

  • c : cognitive parameter (default : 2.1304)

  • s : sozial parameter (default : 1.0575)

  • w : inertia (default : 0.4091)

  • pop : size of population (default : 156)

  • vm : max velocity for every attribute (default: u_b - l_b)

  • integer : Integer constraint for every attribute (default False)

Functions :

  • moving(steps, time_termination = -1) :

    • doing steps iterations
    • if timer_termination != -1 terminates before steps or done if time > time_termination
  • plot(best_p=True, x_coord = 0, y_coord = 1) : plotting the actual swarm

    • best_p = True or False -> want to plot the personal best or the actual position of all particles
    • x_coord = 0,1,... -> for single: which position variable should be plotted ; for multi: which objective value should be plotted on the y-axis
    • y_coord = 0,1,... -> for single: not relevant ; for multi: which objective value should be plottet on the y-axis
  • get_solution(whole_particle = True) : single -> returns global best particle ; multi -> returns Pareto Front

    • whole_particle = True or False -> returns particle class or just the objective value

Missing for now:

  • Termination Criterium
  1. Kalyanmoy Deb, Amrit Pratap, Sameer Agarwal, and T. Meyarivan, A Fast Elitist Multiobjective Genetic Algorithm: NSGA-II, IEEE Transactions on Evolutionary Computation 6 (2002), no. 2, 182 – 197.

About

single- and multi-objective particle swarm Optimizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages