DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution
If you use DetPy in your research, please cite:
Zieliński, B., Ściegienny, S., Orlicki, H., & Książek, W. (2025).
DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution.
SoftwareX, 29, 102014.
https://doi.org/10.1016/j.softx.2024.102014
@article{Zielinski2025DetPy,
title = {DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution},
author = {Zieliński, Błażej and Ściegienny, Szymon and Orlicki, Hubert and Książek, Wojciech},
journal = {SoftwareX},
volume = {29},
pages = {102014},
year = {2025},
doi = {10.1016/j.softx.2024.102014}
}The DetPy library contains implementations of the differential evolution algorithm and 18 modifications of this algorithm. It can be used to solve advanced optimization problems. The following variants have been implemented:
| No. | Algorithm | Year |
|---|---|---|
| 1 | DE (Differential evolution) [1] | 1997 |
| 2 | COMDE (Constrained optimization-based differential evolution) [2] | 2012 |
| 3 | DERL (Differential evolution random locations) [3] | 2006 |
| 4 | NMDE (Novel modified differential evolution algorithm) [4] | 2011 |
| 5 | FIADE (Fitness-Adaptive DE) [5] | 2011 |
| 6 | EMDE (Efficient modified differential evolution) [6] | 2015 |
| 7 | IDE (Improved differential evolution) [7] | 2019 |
| 8 | SADE (Self-adaptive differential evolution) [8] | 2008 |
| 9 | JADE (Adaptive differential evolution with optional external archive) [9] | 2009 |
| 10 | OppBasedDE (Opposition-based differential evolution) [10] | 2010 |
| 11 | AADE (Auto adaptive differential evolution algorithm) [11] | 2019 |
| 12 | DEGL (Differential evolution with neighborhood-based mutation) [12] | 2009 |
| 13 | DELB (Differential evolution with localization using the best vector) [3] | 2006 |
| 14 | EIDE (An efficient improved differential evolution algorithm) [13] | 2012 |
| 15 | MGDE (A many-objective guided differential evolution) [14] | 2022 |
| 16 | ImprovedDE (DE with dynamic mutation parameters) [15] | 2023 |
| 17 | SHADE (Success-History Based Parameter Adaptation for Differential Evolution) [16] | 2013 |
| 18 | LSHADE_RSP (Algorithm with a Rank-based Selective Pressure Strategy) [17] | 2018 |
| 19 | LSHADE (Improving the Search Performance of SHADE Using Linear Population Size Reduction) [18] | 2014 |
| 20 | SPS_LSHADE_EIG (Self-Optimizing L-SHADE with Eigenvector Crossover ) [19] | 2015 |
| 21 | AL-SHADE (Adaptive L-SHADE with current-to-Amean strategy and adaptive mutation selection scheme) [20] | 2022 |
| 22 | DETCR (Hybrid DE Algorithm With Adaptive Crossover Operator) [21] | 2011 |
| 23 | EPSDE (Epsilon Constrained Differential Evolution) [22] | 2006 |
| 24 | EPSDEAG (Constrained Optimization by the ε Constrained Differential Evolution with an Archive and Gradient-Based Mutation) [23] | 2010 |
| 25 | LSHADE_EPSIN (L-SHADE with Ensemble Sinusoidal Parameter Adaptation) [24] | 2016 |
| 26 | EPSDEG (Epsilon Constrained Differential Evolution with Gradient-Based Mutation) [25] | 2009 |
| 27 | EPSADE (Epsilon Constrained adaptive Differential Evolution) [26] | 2010 |
| 28 | EPSRDE (Epsilon Constrained Rank-Based Differential Evolution) [27] | 2012 |
| 29 | SHADE 1.1 (Success-History Based Parameter Adaptation for Differential Evolution) [16] | 2014 |
| 30 | EPSDEwDC (Epsilon Constrained Differential Evolution with Dynamic ε-Level Control) [28] | 2012 |
pip install detpy
from detpy.DETAlgs.data.alg_data import SADEData
from detpy.DETAlgs.sade import SADE
from detpy.functions import FunctionLoader
from detpy.models.enums.boundary_constrain import BoundaryFixing
from detpy.models.enums.optimization import OptimizationType
from detpy.models.fitness_function import BenchmarkFitnessFunction
function_loader = FunctionLoader()
ackley_function = function_loader.get_function(function_name="ackley", n_dimensions=2)
fitness_fun = BenchmarkFitnessFunction(ackley_function)
params = SADEData(
max_nfe=10000,
population_size=100,
dimension=2,
lb=[-32.768, -32.768],
ub=[32.768, 32.768],
optimization_type=OptimizationType.MINIMIZATION,
boundary_constraints_fun=BoundaryFixing.RANDOM,
function=fitness_fun,
log_population=True,
parallel_processing=['thread', 4]
)
default2 = SADE(params, db_conn="Differential_evolution.db", db_auto_write=False)
results = default2.run()
You can also use one of predefined functions to solve your problem. To do this, call the FunctionLoader method and pass as an argument the name of a function from the folder and variables, which u want to use in your calculations.
function_loader = FunctionLoader()
function_name = "ackley"
variables = [0.0, 0.0]
n_dimensions = 2
result = function_loader.evaluate_function(function_name, variables, n_dimensions)
Available functions:
self.function_classes = {
"ackley": Ackley,
"rastrigin": Rastrigin,
"rosenbrock": Rosenbrock,
"sphere": Sphere,
"griewank": Griewank,
"schwefel": Schwefel,
"michalewicz": Michalewicz,
"easom": Easom,
"himmelblau": Himmelblau,
"keane": Keane,
"rana": Rana,
"pits_and_holes": PitsAndHoles,
"hypersphere": Hypersphere,
"hyperellipsoid": Hyperellipsoid,
"eggholder": EggHolder,
"styblinski_tang": StyblinskiTang,
"goldstein_and_price": GoldsteinAndPrice
}
Test functions prepared based on https://gitlab.com/luca.baronti/python_benchmark_functions
- Storn, Rainer and Price, Kenneth. Differential Evolution - A Simple and Efficient Heuristic for Global Optimization over Continuous Spaces. Journal of Global Optimization, vol. 11, no. 4, 1997.
- Mohamed, Ali Wagdy and Sabry, Hegazy Zaher. Constrained optimization based on modified differential evolution algorithm. Information Sciences, vol. 194, 2012.
- Kaelo, Paul and Ali, Mohamed M. A numerical study of some modified differential evolution algorithms. European Journal of Operational Research, vol. 169, no. 3, 2006.
- Zou, Dexuan, Liu, Haikuan, Gao, Liqun, Li, Steven. A novel modified differential evolution algorithm for constrained optimization problems. Computers & Mathematics with Applications, vol. 61, no. 6, 2011.
- Ghosh, Arnob, Das, Swagatam, Chowdhury, Aritra, Giri, Ritwik. An improved differential evolution algorithm with fitness-based adaptation of the control parameters. Information Sciences, vol. 181, no. 18, 2011.
- Mohamed, Ali Wagdy. An efficient modified differential evolution algorithm for solving constrained non-linear integer and mixed-integer global optimization problems. International Journal of Machine Learning and Cybernetics, vol. 8, no. 3, 2015.
- Ma, Jian and Li, Haiming. Research on Rosenbrock Function Optimization Problem Based on Improved Differential Evolution Algorithm. Journal of Computer and Communications, vol. 7, no. 11, 2019.
- Wu Zhi-Feng, Huang Hou-Kuan, Yang Bei, Zhang Ying. A modified differential evolution algorithm with self-adaptive control parameters. 2008 3rd International Conference on Intelligent System and Knowledge Engineering, IEEE, 2008.
- Zhang, Jingqiao and Sanderson, A.C. JADE: Adaptive Differential Evolution With Optional External Archive. IEEE Transactions on Evolutionary Computation, vol. 13, no. 5, 2009.
- Rahnamayan, Shahryar, Tizhoosh, Hamid R., Salama, Magdy M. A. Opposition-Based Differential Evolution. Studies in Computational Intelligence, Springer, Berlin, Heidelberg.
- Sharma, Vivek, Agarwal, Shalini, Verma, Pawan Kumar. Auto Adaptive Differential Evolution Algorithm. 2019 3rd International Conference on Computing Methodologies and Communication (ICCMC), IEEE, 2019.
- Das, Swagatam, Abraham, Ajith, Chakraborty, Uday K., Konar, Amit. Differential Evolution Using a Neighborhood-Based Mutation Operator. IEEE Transactions on Evolutionary Computation, vol. 13, no. 3, 2009.
- Zou, Dexuan and Gao, Liqun. An efficient improved differential evolution algorithm. Proceedings of the 31st Chinese Control Conference, 2012.
- Zouache, Djaafar, Abdelaziz, Fouad Ben. MGDE: a many-objective guided differential evolution with strengthened dominance relation and bi-goal evolution. Annals of Operations Research, Springer, 2022.
- Lin, Yifeng, Yang, Yuer, Zhang, Yinyan. Improved differential evolution with dynamic mutation parameters. Soft Computing, Springer, 2023.
- Ryoji Tanabe, Alex Fukunaga. Success-history based parameter adaptation for Differential Evolution. IEEE Congress on Evolutionary Computation, 2013.
- Vladimir Stanovov, Shakhnaz Akhmedova, Eugene Semenkin. Algorithm with a Rank-based Selective Pressure mutation (LSAHDE-RSP). IEEE Congress on Evolutionary Computation, 2018.
- Ryoji Tanabe, Alex Fukunaga. Improving the Search Performance of SHADE Using Linear Population Size Reduction. IEEE Congress on Evolutionary Computation, 2014.
- Shu-Mei Guo, Jason Sheng-Hong Tsai, Chin-Chang Yang, Pang-Han Hsu. A self-optimization approach for L-SHADE incorporated with eigenvector-based crossover and successful-parent-selecting framework on CEC 2015 benchmark set. IEEE Congress on Evolutionary Computation (CEC), 2015.
- Yintong Li, Tong Han, Huan Zhou, Shangqin Tang, Hui Zhao. A novel adaptive L-SHADE algorithm and its application in UAV swarm resource configuration problem. Information Sciences, vol. 606, pp. 350–367, 2022.
- Gilberto Reynoso-Meza, Javier Sanchis, Xavier Blasco, Juan M. Herrero, Hybrid DE algorithm with adaptive crossover operator for solving real-world numerical optimization problems. IEEE Congress of Evolutionary Computation (CEC), New Orleans, LA, USA, 2011, doi: 10.1109/CEC.2011.5949800, 2011.
- Tetsuyuki Takahama, Setsuko Sakai, Noriyuki Iwane, Solving Nonlinear Constrained Optimization Problems by the Epsilon Constrained Differential Evolution IEEE International Conference on Systems, Man and Cybernetics, 2006.
- Tetsuyuki Takahama, Setsuko Sakai, Constrained optimization by the ε constrained differential evolution with an archive and gradient-based mutation. IEEE Congress on Evolutionary Computation, 2010.
- Noor H. Awad, Mostafa Z. Ali, Ponnuthurai N. Suganthan, Robert G. Reynolds. L-SHADE with Ensemble Sinusoidal Parameter Adaptation. IEEE Congress on Evolutionary Computation, 2016.
- T. Takahama and S. Sakai, Solving difficult constrained optimization problems by the ε constrained differential evolution with gradient based mutation, in Constraint-Handling in Evolutionary Optimization, E. Mezura-Montes, Ed. Springer-Verlag, pp. 51–72, 2009
- Tetsuyuki Takahama and Setsuko Sakai, Efficient Constrained Optimization by the ε Constrained Adaptive Differential Evolution. IEEE Congress on Evolutionary Computation, 2010
- Tetsuyuki Takahama and Setsuko Sakai, Efficient Constrained Optimization by the ε Constrained Rank-Based Differential Evolution. IEEE Congress on Evolutionary Computation, 2012
- Tetsuyuki Takahama and Setsuko Sakai, Epsilon Constrained Differential Evolution with Dynamic ε-Level Control. Chakraborty, U.K. (eds) Advances in Differential Evolution. Studies in Computational Intelligence, vol 143. Springer, Berlin, Heidelberg, 2008
Full documentation is available: https://blazej-zielinski.github.io/detpy/