A Python framework for Differential Evolution using pymoo (Blank & Deb, 2020).
Install | Algorithms | Survival Operators | Crowding Metrics | Usage | Structure | Citation | References | Contact | Acknowledgements
First, make sure you have a Python 3 environment installed.
From PyPi:
pip install pymoode
From the current version on github:
pip install git+https://github.com/mooscaliaproject/pymoode
- DE: Differential Evolution for single-objective problems proposed by Storn & Price (1997). Other features later implemented are also present, such as dither, jitter, selection variants, and crossover strategies. For details see Price et al. (2005).
- NSDE: Non-dominated Sorting Differential Evolution, a multi-objective algorithm that combines DE mutation and crossover operators to NSGA-II (Deb et al., 2002) survival.
- GDE3: Generalized Differential Evolution 3, a multi-objective algorithm that combines DE mutation and crossover operators to NSGA-II survival with a hybrid type survival strategy. In this algorithm, individuals might be removed in a one-to-one comparison before truncating the population by the multi-objective survival operator. It was proposed by Kukkonen, S. & Lampinen, J. (2005). Variants with M-Nearest Neighbors and 2-Nearest Neighbors survival are also available.
- NSDE-R: Non-dominated Sorting Differential Evolution based on Reference directions (Reddy & Dulikravich, 2019). It is an algorithm for many-objective problems that works as an extension of NSDE using NSGA-III (Deb & Jain, 2014) survival strategy.
- RandAndCrowding: Flexible structure to implement NSGA-II rank and crowding survival with different options for crowding metric and elimination of individuals.
- ConstrRankAndCrowding: A survival operator based on rank and crowding with a special constraint handling approach proposed by Kukkonen, S. & Lampinen, J. (2005).
- Crowding Distance ('cd'): Proposed by Deb et al. (2002) in NSGA-II. Imported from pymoo.
- Pruning Crowding Distance ('pruning-cd' or 'pcd'): Proposed by Kukkonen & Deb (2006a), it recursively recalculates crowding distances as removes individuals from a population to improve diversity.
- M-Nearest Neighbors ('mnn'): Proposed by Kukkonen & Deb (2006b) in an extension of GDE3 to many-objective problems.
- 2-Nearest Neighbors ('2nn'): Also proposed by Kukkonen & Deb (2006b), it is a variant of M-Nearest Neighbors in which the number of neighbors is two.
- Crowding Entropy ('ce'): Proposed by Wang et al. (2010) in MOSADE.
Metrics 'pcd', 'mnn', and '2nn' are recursively recalculated as individuals are removed, to improve the population diversity. Therefore, they are implemented using cython to reduce computational time. If compilation fails, .py files are used instead, which makes it slightly slower.
For more examples, read the docs
import matplotlib.pyplot as plt
from pymoo.problems import get_problem
from pymoo.optimize import minimize
from pymoode.algorithms import GDE3
from pymoode.survival import RankAndCrowding
problem = get_problem("tnk")
pf = problem.pareto_front()
gde3 = GDE3(
pop_size=50, variant="DE/rand/1/bin", CR=0.5, F=(0.0, 0.9),
survival=RankAndCrowding(crowding_func="pcd")
)
res = minimize(problem, gde3, ('n_gen', 200), seed=12)
fig, ax = plt.subplots(figsize=[6, 5], dpi=100)
ax.scatter(pf[:, 0], pf[:, 1], color="navy", label="True Front")
ax.scatter(res.F[:, 0], res.F[:, 1], color="firebrick", label="GDE3")
ax.set_ylabel("$f_2$")
ax.set_xlabel("$f_1$")
ax.legend()
fig.tight_layout()
plt.show()
Alternatively, on the three-objective problem DTLZ2, it would produce amazing results.
problem = get_problem("dtlz2")
gde3mnn = GDE3(
pop_size=150, variant="DE/rand/1/bin", CR=0.5, F=(0.0, 0.9),
survival=RankAndCrowding(crowding_func="mnn")
)
res = minimize(problem, gde3mnn, ('n_gen', 250), seed=12)
pymoode
├───algorithms
│ ├───DE
│ ├───GDE3
│ ├───NSDE
│ └───NSDER
├───survival
│ ├───RankAndCrowding
│ └───ConstrRankAndCrowding
├───performance
│ └───SpacingIndicator
└───operators
├───dem.py
│ └───DEM
├───dex.py
│ └───DEX
└───des.py
└───DES
This package was developed as part of an academic optimization project. Please, if you use it for research purposes, cite it using the published article:
Price, K. V., Storn, R. M. & Lampinen, J. A., 2005. Differential Evolution: A Practical Approach to Global Optimization. 1st ed. Springer: Berlin.
e-mail: [email protected]
To Julian Blank, who created the amazing structure of pymoo, making such a project possible.
To Esly F. da Costa Junior, for the unconditional support all along.