pyswarm¶
Package Contents¶
Classes¶
Functions¶
-
_is_feasible
(theList)¶
-
_format_fx_fs
(objectives_pop, constraints_pop)¶
-
pso
(lb, ub, initialVectorGuess, theEvaluator, terminationCondition, callback_generation=lambda objectives, constraints: None, swarmsize=100, omega=0.5, phip=0.5, phig=0.5)[source]¶ Perform a particle swarm optimization (PSO)
Parameters: - 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
- terminationCondition – Termination condition with shouldTerminated method
- callback_generation – function lambda (objectives (as list), constraints (as list)) per step
- swarmsize – Int. The number of particles in the swarm (Default: 100)
- omega – Float. Particle velocity scaling factor (Default: 0.5)
- phip – Float. Scaling factor to search away from the particle’s best known position (Default: 0.5)
- phig – Float. Scaling factor to search away from the swarm’s best known position (Default: 0.5)
Returns: - array The swarm’s best known position (optimal design). (f) scalar, the objective value at (g)