pyswarm

Package Contents

Classes

Functions

_is_feasible(theList)
_format_fx_fs(objectives_pop, constraints_pop)
class MyMapEvaluator(evaluation_function, callback_on_evaluation)[source]
evaluate_all(x)[source]
class MyMultiprocessEvaluator(evaluation_function, callback_on_evaluation, numberOfCores)[source]
evaluate_all(x)[source]
pso(lb, ub, initialVectorGuess, theEvaluator, maxtime, callback_generation=lambda objectives, constraints: None, swarmsize=100, omega=0.5, phip=0.5, phig=0.5)[source]

Perform a particle swarm optimization (PSO)

lb: list
Lower bounds of each parameter
ub: list
upper bounds of each parameter
initialVectorGuess: list
initial vector guess for the solution (to be included inside population)

theEvaluator : object define before maxtime : float

The maximum time (in s) before stopping the algorithm
callback_generation: function lambda (bjectives (as list), constraints (as list)) per step
Useful to log convergence
swarmsize : int
The number of particles in the swarm (Default: 100)
omega : scalar
Particle velocity scaling factor (Default: 0.5)
phip : scalar
Scaling factor to search away from the particle’s best known position (Default: 0.5)
phig : scalar
Scaling factor to search away from the swarm’s best known position (Default: 0.5)
g : array
The swarm’s best known position (optimal design)
f : scalar
The objective value at g