Skip to main content

DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution

📖 Citation

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

BibTeX

@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}
}

Introduction

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

Installation

pip install detpy

Example - optimization of the Ackley function based SADE

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(

    epoch=100,

    population_size=100,

    dimension=2,

    lb=[-32.768, -32.768],

    ub=[32.768, 32.768],

    mode=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()

Using FunctionLoader

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

References

  1. 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.
  2. Mohamed, Ali Wagdy and Sabry, Hegazy Zaher. Constrained optimization based on modified differential evolution algorithm. Information Sciences, vol. 194, 2012.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. Zhang, Jingqiao and Sanderson, A.C. JADE: Adaptive Differential Evolution With Optional External Archive. IEEE Transactions on Evolutionary Computation, vol. 13, no. 5, 2009.
  10. Rahnamayan, Shahryar, Tizhoosh, Hamid R., Salama, Magdy M. A. Opposition-Based Differential Evolution. Studies in Computational Intelligence, Springer, Berlin, Heidelberg.
  11. Sharma, Vivek, Agarwal, Shalini, Verma, Pawan Kumar. Auto Adaptive Differential Evolution Algorithm. 2019 3rd International Conference on Computing Methodologies and Communication (ICCMC), IEEE, 2019.
  12. 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.
  13. Zou, Dexuan and Gao, Liqun. An efficient improved differential evolution algorithm. Proceedings of the 31st Chinese Control Conference, 2012.
  14. 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.
  15. Lin, Yifeng, Yang, Yuer, Zhang, Yinyan. Improved differential evolution with dynamic mutation parameters. Soft Computing, Springer, 2023.
  16. Ryoji Tanabe, Alex Fukunaga. Success-history based parameter adaptation for Differential Evolution. IEEE Congress on Evolutionary Computation, 2013.
  17. Vladimir Stanovov, Shakhnaz Akhmedova, Eugene Semenkin. Algorithm with a Rank-based Selective Pressure mutation (LSAHDE-RSP). IEEE Congress on Evolutionary Computation, 2018.
  18. Ryoji Tanabe, Alex Fukunaga. Improving the Search Performance of SHADE Using Linear Population Size Reduction. IEEE Congress on Evolutionary Computation, 2014.
  19. 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.
  20. 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.
  21. 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.
  22. 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.
  23. Tetsuyuki Takahama, Setsuko Sakai, Constrained optimization by the ε constrained differential evolution with an archive and gradient-based mutation. IEEE Congress on Evolutionary Computation, 2010.
  24. 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.
  25. 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
  26. Tetsuyuki Takahama and Setsuko Sakai, Efficient Constrained Optimization by the ε Constrained Adaptive Differential Evolution. IEEE Congress on Evolutionary Computation, 2010
  27. Tetsuyuki Takahama and Setsuko Sakai, Efficient Constrained Optimization by the ε Constrained Rank-Based Differential Evolution. IEEE Congress on Evolutionary Computation, 2012
  28. 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

Documentation

Full documentation is available: https://blazej-zielinski.github.io/detpy/

Metadata

Release files for detpy 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detpy 2.0.0
File Size Uploaded
detpy-2.0.0.tar.gz 80.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for detpy 2.0.0
File Interpreter ABI Platform
detpy-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 212.8 kB

Release files / detpy-2.0.0.tar.gz

Download URL detpy-2.0.0.tar.gz
Size 80.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a1dd4b8a9c4603f45aa0f770177d520a842002e64b0970f75966881a9991df2d
BLAKE2b-256 checksum
How to use checksums
29323f6cf1eb89ff852f8c21c001b905019020a75f213817892c00337e84ad27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / detpy-2.0.0-py3-none-any.whl

Download URL detpy-2.0.0-py3-none-any.whl
Size 132.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2db4e9e0da35cf5cc6dd88d72ebdd8d451f35e48cabda9cdd7f4a5a8a9b277c
BLAKE2b-256 checksum
How to use checksums
fe1da3eab8df1749b7f50cb425115681cd743f6354b0ace86bc1733277eb45d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page