This repository contains some optimization algorithms in Python, namely Particle Swarm Optimization Algorithm, Differential Evolution, Self Adaptive Differential Evolution and Differential Evolution with Composite Trial Vector Generation Strategies and Control Parameters. All algorithms generates logs and statitical results, as well as convegence and diversity graphs for each run and overall runs, which is defined by the user.
matplotlib
- import the module (e.g import de)
- create the object (e.g. d = de())
- override fitness function with the function you want to maximize or minimize (e.g. d.fitness = YourFitnessFunction) OBS: you have to pass as parameter a list of the parameters you want to optimize with size of dim, and Rastrigin Function is implemented for testing purposes
- then run the function optimizer (e.g. d.diferentialEvolution(parameters)) OBS: for PSO use d.particleSwarmOptimization(parameters)
- pop_size: population size
- dim: dimensions of the individual (parameters to optimize)
- bounds: a tuple containing the bounds of the parameters (e.g. ((-5.12),(5.12)) bounds for 2 dimensions rastrigin benchmark function)
- max_iterations: stop criteria
- runs: number of algorithm executions for robustness
- maximize: True to maximize and False to minimize (default: True)
- vmax: bounds for particle's velocities based on domain's percentage (default: 0.1 (10%))
- c1: cognitive component (default: 2)
- c2: social component (default: 2)
- inertia: inertia weight for global and local search control (default: 0.7)
- weight_factor (default: 0.8)
- crossover_rate (default: 0.9)
- p1: the probability of applying strategy "rand/l/bin" (default: 0.5)
- p2: the probability of applying strategy "current to best/2/bin" (default: 0.5)
- learningPeriod: the probability of applying those two strategies update (default: 50)
- crPeriod: CR values update (default: 5)
- crmUpdatePeriod: CRm update (default: 25)
- param_pool: pool of parameters (suggested: param_pool =[[1.0,0.1], [1.0,0.9], [0.8,0.2]])
Self-adaptive Differential Evolution Algorithm for Numerical Optimization (2005) http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1554904
Differential Evolution with Composite Trial Vector Generation Strategies and Control Parameters (2011) http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=5688232
Particle Swarm Optimization http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=488968
Differential Evolution – A Simple and Efficient Heuristic for global Optimization over Continuous Spaces https://link.springer.com/article/10.1023%2FA%3A1008202821328