# DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution
# Introduction
The DetPy library contains implementations of the differential evolution algorithm and 15 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 |
# 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.
# Documentation
Full documentation is available: https://blazej-zielinski.github.io/detpy/
Raw data
{
"_id": null,
"home_page": "https://github.com/Blazej-Zielinski/detpy",
"name": "detpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "optimization, metaheuristics, nature-inspired algorithms, evolutionary computation, population-based algorithms, Stochastic optimization, different evolution",
"author": "Szymon \u015aciegienny, B\u0142a\u017cej Zieli\u0144ski, Hubert Orlicki, Wojciech Ksi\u0105\u017cek",
"author_email": "wojciech.ksiazek@pk.edu.pl",
"download_url": "https://files.pythonhosted.org/packages/ff/99/c2eea9df3fb19630fa0d533ee107ceb1fb98b20484363229587b108e77b0/detpy-1.0.10.tar.gz",
"platform": null,
"description": "# DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution\r\n\r\n# Introduction\r\nThe DetPy library contains implementations of the differential evolution algorithm and 15 modifications of this \r\nalgorithm. It can be used to solve advanced optimization problems.\r\nThe following variants have been implemented:\r\n\r\n| No. | Algorithm | Year |\r\n|-----|-----------------------------------------------------------------------------------------------|------|\r\n| 1 | DE (Differential evolution) [1] | 1997 |\r\n| 2 | COMDE (Constrained optimization-based differential evolution) [2] | 2012 |\r\n| 3 | DERL (Differential evolution random locations) [3] | 2006 |\r\n| 4 | NMDE (Novel modified differential evolution algorithm) [4] | 2011 |\r\n| 5 | FIADE (Fitness-Adaptive DE) [5] | 2011 |\r\n| 6 | EMDE (Efficient modified differential evolution) [6] | 2015 |\r\n| 7 | IDE (Improved differential evolution) [7] | 2019 |\r\n| 8 | SADE (Self-adaptive differential evolution) [8] | 2008 |\r\n| 9 | JADE (Adaptive differential evolution with optional external archive) [9] | 2009 |\r\n| 10 | OppBasedDE (Opposition-based differential evolution) [10] | 2010 |\r\n| 11 | AADE (Auto adaptive differential evolution algorithm) [11] | 2019 |\r\n| 12 | DEGL (Differential evolution with neighborhood-based mutation) [12] | 2009 |\r\n| 13 | DELB (Differential evolution with localization using the best vector) [3] | 2006 |\r\n| 14 | EIDE (An efficient improved differential evolution algorithm) [13] | 2012 |\r\n| 15 | MGDE (A many-objective guided differential evolution) [14] | 2022 |\r\n| 16 | ImprovedDE (DE with dynamic mutation parameters) [15] | 2023 |\r\n\r\n# Installation\r\n```\r\npip install detpy\r\n```\r\n\r\n# Example - optimization of the Ackley function based SADE\r\n```\r\nfrom detpy.DETAlgs.data.alg_data import SADEData\r\n\r\nfrom detpy.DETAlgs.sade import SADE\r\n\r\nfrom detpy.functions import FunctionLoader\r\n\r\nfrom detpy.models.enums.boundary_constrain import BoundaryFixing\r\n\r\nfrom detpy.models.enums.optimization import OptimizationType\r\n\r\nfrom detpy.models.fitness_function import BenchmarkFitnessFunction\r\n\r\n\r\nfunction_loader = FunctionLoader()\r\n\r\nackley_function = function_loader.get_function(function_name=\"ackley\", n_dimensions=2)\r\n\r\nfitness_fun = BenchmarkFitnessFunction(ackley_function)\r\n\r\n\r\nparams = SADEData(\r\n\r\n epoch=100,\r\n\r\n population_size=100,\r\n\r\n dimension=2,\r\n\r\n lb=[-32.768, -32.768],\r\n\r\n ub=[32.768, 32.768],\r\n\r\n mode=OptimizationType.MINIMIZATION,\r\n\r\n boundary_constraints_fun=BoundaryFixing.RANDOM,\r\n\r\n function=fitness_fun,\r\n\r\n log_population=True,\r\n\r\n parallel_processing=['thread', 4]\r\n\r\n)\r\n\r\n\r\ndefault2 = SADE(params, db_conn=\"Differential_evolution.db\", db_auto_write=False)\r\n\r\nresults = default2.run()\r\n```\r\n\r\n# Using FunctionLoader\r\n\r\nYou can also use one of predefined functions to solve your problem. \r\nTo do this, call the FunctionLoader method and pass as an argument the name of a function from the folder and variables,\r\nwhich u want to use in your calculations.\r\n\r\n```\r\nfunction_loader = FunctionLoader()\r\nfunction_name = \"ackley\"\r\nvariables = [0.0, 0.0]\r\nn_dimensions = 2\r\n\r\nresult = function_loader.evaluate_function(function_name, variables, n_dimensions)\r\n```\r\n\r\nAvailable functions:\r\n\r\n```\r\n self.function_classes = {\r\n \"ackley\": Ackley,\r\n \"rastrigin\": Rastrigin,\r\n \"rosenbrock\": Rosenbrock,\r\n \"sphere\": Sphere,\r\n \"griewank\": Griewank,\r\n \"schwefel\": Schwefel,\r\n \"michalewicz\": Michalewicz,\r\n \"easom\": Easom,\r\n \"himmelblau\": Himmelblau,\r\n \"keane\": Keane,\r\n \"rana\": Rana,\r\n \"pits_and_holes\": PitsAndHoles,\r\n \"hypersphere\": Hypersphere,\r\n \"hyperellipsoid\": Hyperellipsoid,\r\n \"eggholder\": EggHolder,\r\n \"styblinski_tang\": StyblinskiTang,\r\n \"goldstein_and_price\": GoldsteinAndPrice\r\n }\r\n```\r\n\r\nTest functions prepared based on https://gitlab.com/luca.baronti/python_benchmark_functions\r\n\r\n# References\r\n\r\n1. 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.\r\n2. Mohamed, Ali Wagdy and Sabry, Hegazy Zaher. *Constrained optimization based on modified differential evolution algorithm*. Information Sciences, vol. 194, 2012.\r\n3. 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.\r\n4. 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.\r\n5. 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.\r\n6. 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.\r\n7. 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.\r\n8. 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.\r\n9. Zhang, Jingqiao and Sanderson, A.C. *JADE: Adaptive Differential Evolution With Optional External Archive*. IEEE Transactions on Evolutionary Computation, vol. 13, no. 5, 2009.\r\n10. Rahnamayan, Shahryar, Tizhoosh, Hamid R., Salama, Magdy M. A. *Opposition-Based Differential Evolution*. Studies in Computational Intelligence, Springer, Berlin, Heidelberg.\r\n11. Sharma, Vivek, Agarwal, Shalini, Verma, Pawan Kumar. *Auto Adaptive Differential Evolution Algorithm*. 2019 3rd International Conference on Computing Methodologies and Communication (ICCMC), IEEE, 2019.\r\n12. 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.\r\n13. Zou, Dexuan and Gao, Liqun. *An efficient improved differential evolution algorithm*. Proceedings of the 31st Chinese Control Conference, 2012.\r\n14. 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.\r\n15. Lin, Yifeng, Yang, Yuer, Zhang, Yinyan. *Improved differential evolution with dynamic mutation parameters*. Soft Computing, Springer, 2023.\r\n\r\n# Documentation\r\nFull documentation is available: https://blazej-zielinski.github.io/detpy/\r\n\r\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "DetPy (Differential Evolution Tools): A Python toolbox for solving optimization problems using differential evolution",
"version": "1.0.10",
"project_urls": {
"Homepage": "https://github.com/Blazej-Zielinski/detpy"
},
"split_keywords": [
"optimization",
" metaheuristics",
" nature-inspired algorithms",
" evolutionary computation",
" population-based algorithms",
" stochastic optimization",
" different evolution"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ff99c2eea9df3fb19630fa0d533ee107ceb1fb98b20484363229587b108e77b0",
"md5": "22e85866a75499e89b88832bbc6e73f1",
"sha256": "d3ceb75381d15c0bb7948a3808e05046b69f81af4767b136c06cd01fa4c4ef09"
},
"downloads": -1,
"filename": "detpy-1.0.10.tar.gz",
"has_sig": false,
"md5_digest": "22e85866a75499e89b88832bbc6e73f1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 38760,
"upload_time": "2024-11-04T08:06:37",
"upload_time_iso_8601": "2024-11-04T08:06:37.693463Z",
"url": "https://files.pythonhosted.org/packages/ff/99/c2eea9df3fb19630fa0d533ee107ceb1fb98b20484363229587b108e77b0/detpy-1.0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-04 08:06:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Blazej-Zielinski",
"github_project": "detpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "detpy"
}