mango 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. {mango-0.2.0/mango.egg-info → mango-0.2.2}/PKG-INFO +16 -3
  2. mango-0.2.2/README.rst +19 -0
  3. mango-0.2.2/docs/source/conf.py +46 -0
  4. mango-0.2.2/mango/__init__.py +4 -0
  5. mango-0.2.2/mango/benchmark/__init__.py +1 -0
  6. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/ackley.py +8 -2
  7. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/bukin.py +4 -2
  8. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/cross_in_tray.py +4 -2
  9. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/dolan.py +4 -2
  10. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/drop_wave.py +4 -2
  11. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/egg_holder.py +4 -2
  12. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/gramacy_lee.py +11 -4
  13. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/griewank.py +6 -4
  14. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/holder_table.py +9 -4
  15. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/langermann.py +12 -4
  16. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/levy.py +11 -6
  17. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/rastrigin.py +11 -5
  18. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/rosenbrock.py +13 -7
  19. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/schaffer.py +15 -8
  20. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/schwefel.py +4 -4
  21. {mango-0.2.0 → mango-0.2.2}/mango/clients/aemet.py +12 -8
  22. {mango-0.2.0 → mango-0.2.2}/mango/clients/arcgis.py +9 -4
  23. {mango-0.2.0 → mango-0.2.2}/mango/clients/google_cloud_storage.py +28 -0
  24. {mango-0.2.0 → mango-0.2.2}/mango/config/base_config.py +22 -0
  25. {mango-0.2.0 → mango-0.2.2}/mango/dashboards/file_explorer_app.py +5 -4
  26. mango-0.2.2/mango/models/activations.py +32 -0
  27. mango-0.2.2/mango/models/genetic/config/__init__.py +1 -0
  28. {mango-0.2.0 → mango-0.2.2}/mango/models/genetic/config/config.py +0 -1
  29. {mango-0.2.0 → mango-0.2.2}/mango/models/genetic/const.py +1 -1
  30. mango-0.2.2/mango/models/genetic/individual/base_individual.py +270 -0
  31. mango-0.2.2/mango/models/genetic/population/__init__.py +1 -0
  32. {mango-0.2.0 → mango-0.2.2}/mango/models/genetic/population/base_population.py +270 -116
  33. mango-0.2.2/mango/models/genetic/problem/__init__.py +1 -0
  34. mango-0.2.2/mango/models/genetic/problem/base_problem.py +40 -0
  35. mango-0.2.2/mango/models/genetic/shared/exceptions.py +14 -0
  36. {mango-0.2.0 → mango-0.2.2}/mango/models/neural_networks.py +4 -3
  37. {mango-0.2.0 → mango-0.2.2}/mango/models/pyomo.py +15 -1
  38. {mango-0.2.0 → mango-0.2.2}/mango/processing/date_functions.py +13 -9
  39. {mango-0.2.0 → mango-0.2.2}/mango/processing/file_functions.py +84 -14
  40. {mango-0.2.0 → mango-0.2.2}/mango/processing/object_functions.py +26 -0
  41. {mango-0.2.0 → mango-0.2.2}/mango/table/pytups_table.py +45 -17
  42. {mango-0.2.0 → mango-0.2.2}/mango/table/pytups_tools.py +45 -29
  43. {mango-0.2.0 → mango-0.2.2}/mango/table/table_tools.py +1 -1
  44. {mango-0.2.0 → mango-0.2.2}/mango/tests/config_module/test_config.py +24 -0
  45. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_ackley.cfg +4 -4
  46. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_cross_in_tray.cfg +1 -1
  47. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_levy.cfg +2 -2
  48. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_rastrigin.cfg +1 -1
  49. {mango-0.2.0 → mango-0.2.2}/mango/tests/models_module/test_genetic.py +19 -16
  50. mango-0.2.2/mango/tests/models_module/test_optimization_benchmarks.py +295 -0
  51. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_date_functions.py +5 -0
  52. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_file_functions.py +18 -1
  53. {mango-0.2.0 → mango-0.2.2}/mango/tests/table_module/test_table.py +126 -11
  54. {mango-0.2.0 → mango-0.2.2/mango.egg-info}/PKG-INFO +16 -3
  55. {mango-0.2.0 → mango-0.2.2}/mango.egg-info/SOURCES.txt +1 -0
  56. {mango-0.2.0 → mango-0.2.2}/mango.egg-info/top_level.txt +1 -0
  57. {mango-0.2.0 → mango-0.2.2}/pyproject.toml +1 -1
  58. mango-0.2.0/README.rst +0 -6
  59. mango-0.2.0/mango/__init__.py +0 -4
  60. mango-0.2.0/mango/models/activations.py +0 -11
  61. mango-0.2.0/mango/models/genetic/individual/base_individual.py +0 -142
  62. mango-0.2.0/mango/models/genetic/problem/base_problem.py +0 -15
  63. mango-0.2.0/mango/models/genetic/shared/exceptions.py +0 -6
  64. mango-0.2.0/mango/tests/models_module/test_optimization_benchmarks.py +0 -116
  65. mango-0.2.0/mango/tests/shap_module/__init__.py +0 -0
  66. mango-0.2.0/mango/tests/shared_module/__init__.py +0 -0
  67. mango-0.2.0/mango/tests/table_module/__init__.py +0 -0
  68. mango-0.2.0/mango/validators/__init__.py +0 -0
  69. {mango-0.2.0 → mango-0.2.2}/LICENSE +0 -0
  70. {mango-0.2.0 → mango-0.2.2}/MANIFEST.in +0 -0
  71. {mango-0.2.0/mango/benchmark → mango-0.2.2/mango/benchmark/machine_learning}/__init__.py +0 -0
  72. {mango-0.2.0 → mango-0.2.2}/mango/benchmark/optimization/__init__.py +0 -0
  73. {mango-0.2.0 → mango-0.2.2}/mango/cli/__init__.py +0 -0
  74. {mango-0.2.0 → mango-0.2.2}/mango/cli/dashboard.py +0 -0
  75. {mango-0.2.0/mango/benchmark/machine_learning → mango-0.2.2/mango/clients}/__init__.py +0 -0
  76. {mango-0.2.0 → mango-0.2.2}/mango/clients/cloud_storage.py +0 -0
  77. {mango-0.2.0 → mango-0.2.2}/mango/clients/email_downloader.py +0 -0
  78. {mango-0.2.0 → mango-0.2.2}/mango/clients/email_sender.py +0 -0
  79. {mango-0.2.0 → mango-0.2.2}/mango/clients/rest_client.py +0 -0
  80. {mango-0.2.0 → mango-0.2.2}/mango/config/__init__.py +0 -0
  81. {mango-0.2.0 → mango-0.2.2}/mango/dashboards/__init__.py +0 -0
  82. {mango-0.2.0 → mango-0.2.2}/mango/dashboards/assets/logo.png +0 -0
  83. {mango-0.2.0 → mango-0.2.2}/mango/data/__init__.py +0 -0
  84. {mango-0.2.0 → mango-0.2.2}/mango/data/calendar_data.py +0 -0
  85. {mango-0.2.0 → mango-0.2.2}/mango/data/ts_dataset.pkl +0 -0
  86. {mango-0.2.0 → mango-0.2.2}/mango/logging/__init__.py +0 -0
  87. {mango-0.2.0 → mango-0.2.2}/mango/logging/chrono.py +0 -0
  88. {mango-0.2.0 → mango-0.2.2}/mango/logging/decorators.py +0 -0
  89. {mango-0.2.0 → mango-0.2.2}/mango/logging/logger.py +0 -0
  90. {mango-0.2.0 → mango-0.2.2}/mango/models/__init__.py +0 -0
  91. {mango-0.2.0/mango/clients → mango-0.2.2/mango/models/genetic}/__init__.py +0 -0
  92. {mango-0.2.0 → mango-0.2.2}/mango/models/genetic/individual/__init__.py +0 -0
  93. {mango-0.2.0/mango/models/genetic → mango-0.2.2/mango/models/genetic/shared}/__init__.py +0 -0
  94. {mango-0.2.0 → mango-0.2.2}/mango/plots/__init__.py +0 -0
  95. {mango-0.2.0 → mango-0.2.2}/mango/plots/plots.py +0 -0
  96. {mango-0.2.0 → mango-0.2.2}/mango/processing/__init__.py +0 -0
  97. {mango-0.2.0 → mango-0.2.2}/mango/processing/processing_time_series.py +0 -0
  98. {mango-0.2.0 → mango-0.2.2}/mango/schemas/location.json +0 -0
  99. {mango-0.2.0 → mango-0.2.2}/mango/shap_analysis/__init__.py +0 -0
  100. {mango-0.2.0 → mango-0.2.2}/mango/shap_analysis/const.py +0 -0
  101. {mango-0.2.0 → mango-0.2.2}/mango/shap_analysis/shap_analysis.py +0 -0
  102. {mango-0.2.0 → mango-0.2.2}/mango/shared/__init__.py +0 -0
  103. {mango-0.2.0 → mango-0.2.2}/mango/shared/const.py +0 -0
  104. {mango-0.2.0 → mango-0.2.2}/mango/shared/decorators.py +0 -0
  105. {mango-0.2.0 → mango-0.2.2}/mango/shared/exceptions.py +0 -0
  106. {mango-0.2.0 → mango-0.2.2}/mango/shared/requirement_check.py +0 -0
  107. {mango-0.2.0 → mango-0.2.2}/mango/shared/spatial.py +0 -0
  108. {mango-0.2.0 → mango-0.2.2}/mango/table/__init__.py +0 -0
  109. {mango-0.2.0/mango/models/genetic/config → mango-0.2.2/mango/tests}/__init__.py +0 -0
  110. {mango-0.2.0/mango/models/genetic/population → mango-0.2.2/mango/tests/clients_module}/__init__.py +0 -0
  111. {mango-0.2.0 → mango-0.2.2}/mango/tests/clients_module/test_aemet_client.py +0 -0
  112. {mango-0.2.0 → mango-0.2.2}/mango/tests/clients_module/test_arcgis_client.py +0 -0
  113. {mango-0.2.0 → mango-0.2.2}/mango/tests/clients_module/test_rest_client.py +0 -0
  114. {mango-0.2.0/mango/models/genetic/problem → mango-0.2.2/mango/tests/config_module}/__init__.py +0 -0
  115. {mango-0.2.0 → mango-0.2.2}/mango/tests/const.py +0 -0
  116. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/json_dataset.json +0 -0
  117. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/result.json +0 -0
  118. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test.csv +0 -0
  119. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test.json +0 -0
  120. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test.xlsx +0 -0
  121. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test2.csv +0 -0
  122. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_bad_type.cfg +0 -0
  123. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_bad_value.cfg +0 -0
  124. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_bukin.cfg +0 -0
  125. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_custom_problem.cfg +0 -0
  126. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_good.cfg +0 -0
  127. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_inverted_griewank_10d.cfg +0 -0
  128. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/test_schwefel.cfg +0 -0
  129. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/variables.json +0 -0
  130. {mango-0.2.0 → mango-0.2.2}/mango/tests/data/variables.xlsx +0 -0
  131. {mango-0.2.0/mango/models/genetic/shared → mango-0.2.2/mango/tests/data_module}/__init__.py +0 -0
  132. {mango-0.2.0 → mango-0.2.2}/mango/tests/data_module/test_calendar_data.py +0 -0
  133. {mango-0.2.0/mango/tests → mango-0.2.2/mango/tests/initialization_library}/__init__.py +0 -0
  134. {mango-0.2.0 → mango-0.2.2}/mango/tests/initialization_library/test_init.py +0 -0
  135. {mango-0.2.0/mango/tests/clients_module → mango-0.2.2/mango/tests/logging_module}/__init__.py +0 -0
  136. {mango-0.2.0 → mango-0.2.2}/mango/tests/logging_module/test_logging.py +0 -0
  137. {mango-0.2.0/mango/tests/config_module → mango-0.2.2/mango/tests/models_module}/__init__.py +0 -0
  138. {mango-0.2.0 → mango-0.2.2}/mango/tests/models_module/test_models.py +0 -0
  139. {mango-0.2.0 → mango-0.2.2}/mango/tests/models_module/test_pyomo.py +0 -0
  140. {mango-0.2.0/mango/tests/data_module → mango-0.2.2/mango/tests/plots_module}/__init__.py +0 -0
  141. {mango-0.2.0/mango/tests/initialization_library → mango-0.2.2/mango/tests/processing_module}/__init__.py +0 -0
  142. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_correlation_ts.py +0 -0
  143. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_object_functions.py +0 -0
  144. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_processing_time_series.py +0 -0
  145. {mango-0.2.0 → mango-0.2.2}/mango/tests/processing_module/test_tools.py +0 -0
  146. {mango-0.2.0/mango/tests/logging_module → mango-0.2.2/mango/tests/shap_module}/__init__.py +0 -0
  147. {mango-0.2.0 → mango-0.2.2}/mango/tests/shap_module/test_shap_analysis.py +0 -0
  148. {mango-0.2.0/mango/tests/models_module → mango-0.2.2/mango/tests/shared_module}/__init__.py +0 -0
  149. {mango-0.2.0 → mango-0.2.2}/mango/tests/shared_module/test_requirement_check.py +0 -0
  150. {mango-0.2.0 → mango-0.2.2}/mango/tests/shared_module/test_spatial.py +0 -0
  151. {mango-0.2.0 → mango-0.2.2}/mango/tests/shared_module/test_validation.py +0 -0
  152. {mango-0.2.0/mango/tests/plots_module → mango-0.2.2/mango/tests/table_module}/__init__.py +0 -0
  153. {mango-0.2.0 → mango-0.2.2}/mango/tests/table_module/test_tools.py +0 -0
  154. {mango-0.2.0/mango/tests/processing_module → mango-0.2.2/mango/validators}/__init__.py +0 -0
  155. {mango-0.2.0 → mango-0.2.2}/mango/validators/aemet.py +0 -0
  156. {mango-0.2.0 → mango-0.2.2}/mango/validators/arcgis.py +0 -0
  157. {mango-0.2.0 → mango-0.2.2}/mango.egg-info/dependency_links.txt +0 -0
  158. {mango-0.2.0 → mango-0.2.2}/mango.egg-info/entry_points.txt +0 -0
  159. {mango-0.2.0 → mango-0.2.2}/mango.egg-info/requires.txt +0 -0
  160. {mango-0.2.0 → mango-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mango
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Library with a collection of usefull classes and methods to DRY
5
5
  Author-email: baobab soluciones <mango@baobabsoluciones.es>
6
6
  License: Apache Software License
@@ -51,8 +51,21 @@ Requires-Dist: plotly<=5.17.0; extra == "plot"
51
51
  Provides-Extra: shap
52
52
  Requires-Dist: shap[plots]==0.43.0; extra == "shap"
53
53
 
54
- MANGO
55
- -----
54
+ Mango
55
+ ------
56
+
57
+ .. image:: https://img.shields.io/pypi/v/mango?label=version&logo=python&logoColor=white&style=for-the-badge&color=E58164
58
+ :alt: PyPI
59
+ :target: https://pypi.python.org/pypi/cornflow-client
60
+ .. image:: https://img.shields.io/pypi/l/mango?color=blue&style=for-the-badge
61
+ :alt: PyPI - License
62
+ :target: https://github.com/baobabsoluciones/cornflow/blob/master/LICENSE
63
+ .. image:: https://img.shields.io/github/actions/workflow/status/baobabsoluciones/mango/build_docs.yml?label=docs&logo=github&style=for-the-badge
64
+ :alt: GitHub Workflow Status
65
+ :target: https://github.com/baobabsoluciones/cornflow/actions
66
+ .. image:: https://img.shields.io/codecov/c/gh/baobabsoluciones/mango?flag=unit-tests&label=coverage&logo=codecov&logoColor=white&style=for-the-badge&token=0KKRF3J95L
67
+ :alt: Codecov
68
+ :target: https://app.codecov.io/gh/baobabsoluciones/mango
56
69
 
57
70
  This a library containing several modules developed by the team at baobab soluciones. These functions, classes and methods are based on their experience, understanding and knowledge of the Python language and its ecosystem.
58
71
 
mango-0.2.2/README.rst ADDED
@@ -0,0 +1,19 @@
1
+ Mango
2
+ ------
3
+
4
+ .. image:: https://img.shields.io/pypi/v/mango?label=version&logo=python&logoColor=white&style=for-the-badge&color=E58164
5
+ :alt: PyPI
6
+ :target: https://pypi.python.org/pypi/cornflow-client
7
+ .. image:: https://img.shields.io/pypi/l/mango?color=blue&style=for-the-badge
8
+ :alt: PyPI - License
9
+ :target: https://github.com/baobabsoluciones/cornflow/blob/master/LICENSE
10
+ .. image:: https://img.shields.io/github/actions/workflow/status/baobabsoluciones/mango/build_docs.yml?label=docs&logo=github&style=for-the-badge
11
+ :alt: GitHub Workflow Status
12
+ :target: https://github.com/baobabsoluciones/cornflow/actions
13
+ .. image:: https://img.shields.io/codecov/c/gh/baobabsoluciones/mango?flag=unit-tests&label=coverage&logo=codecov&logoColor=white&style=for-the-badge&token=0KKRF3J95L
14
+ :alt: Codecov
15
+ :target: https://app.codecov.io/gh/baobabsoluciones/mango
16
+
17
+ This a library containing several modules developed by the team at baobab soluciones. These functions, classes and methods are based on their experience, understanding and knowledge of the Python language and its ecosystem.
18
+
19
+ The functions are divided in different modules so even though everything is imported the dependencies can be installed only for the modules that are needed.
@@ -0,0 +1,46 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # -- Project information -----------------------------------------------------
7
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
+ import os
9
+ import sys
10
+
11
+ sys.path.insert(0, os.path.abspath("../../"))
12
+
13
+
14
+ project = "mango"
15
+ copyright = "2023, baobab soluciones"
16
+ author = "baobab soluciones"
17
+ # release = "0.2.0"
18
+
19
+ # -- General configuration ---------------------------------------------------
20
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
21
+
22
+ extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinxcontrib.bibtex"]
23
+
24
+ templates_path = ["templates"]
25
+ exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]
26
+
27
+
28
+ # -- Options for HTML output -------------------------------------------------
29
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
30
+
31
+ html_theme = "shibuya"
32
+ html_static_path = ["static"]
33
+
34
+ # autodoc_mock_imports = ["mango"]
35
+ autodoc_member_order = "bysource"
36
+ autodoc_default_options = {"members": True, "inherited-members": True}
37
+
38
+ import mango
39
+
40
+ version = mango.__version__
41
+ release = mango.__version__
42
+
43
+
44
+ # Options for bibtex
45
+ bibtex_bibfiles = ["./refs.bib"]
46
+ bibtex_default_style = "plain"
@@ -0,0 +1,4 @@
1
+ """
2
+ Main file
3
+ """
4
+ __version__ = "0.2.2"
@@ -0,0 +1 @@
1
+ from .optimization import *
@@ -7,15 +7,18 @@ def ackley(x: np.ndarray) -> float:
7
7
  General Ackley function.
8
8
 
9
9
  The Ackley function is widely used for testing optimization algorithms.
10
+
10
11
  In its two-dimensional form, it is characterized by a nearly flat outer region, and a large hole at the centre.
11
12
  The function poses a risk for optimization algorithms, particularly hillclimbing algorithms,
12
13
  to be trapped in one of its many local minima.
13
14
 
14
15
  The global minimum point of the function is: f(x) = 0, at x = (0, ..., 0)
15
16
 
16
- :param :class:`np.ndarray` x: numpy array of floats. The values are evaluated in the range [-32.768, 32.768]
17
+ :param x: numpy array of floats. The values are evaluated in the range [-32.768, 32.768]
18
+ :type x: :class:`numpy.ndarray`
17
19
  :return: the value of the function
18
20
  :rtype: float
21
+ :doc-author: baobab soluciones
19
22
  """
20
23
  return (
21
24
  -20 * exp(-0.2 * sqrt(1 / len(x) * np.sum(np.square(x))))
@@ -29,7 +32,10 @@ def inverted_ackley(x: np.ndarray) -> float:
29
32
  """
30
33
  Inverted Ackley function.
31
34
 
32
- :param :class:`np.ndarray` x: numpy array of floats
35
+ Some description of the function.
36
+
37
+ :param x: numpy array of floats
38
+ :type x: :class:`numpy.ndarray`
33
39
  :return: the value of the function
34
40
  :rtype: float
35
41
  """
@@ -11,7 +11,8 @@ def bukin_function_6(x: np.array) -> float:
11
11
 
12
12
  The global minima is at (-10, 1) with a value of 0.
13
13
 
14
- :param :class:`np.array` x: array of floats. Values are between [-15, 5] for x1 and [-3, 3] for x2
14
+ :param x: array of floats. Values are between [-15, 5] for x1 and [-3, 3] for x2
15
+ :type x: :class:`numpy.ndarray`
15
16
  :return: the value of the function
16
17
  :rtype: float
17
18
  """
@@ -22,7 +23,8 @@ def inverted_bukin_function_6(x: np.array) -> float:
22
23
  """
23
24
  Inverted Bukin function N. 6.
24
25
 
25
- :param :class:`np.array` x: array of floats. Values are between [-15, 5] for x1 and [-3, 3] for x2
26
+ :param x: array of floats. Values are between [-15, 5] for x1 and [-3, 3] for x2
27
+ :type x: :class:`numpy.ndarray`
26
28
  :return: the value of the function
27
29
  :rtype: float
28
30
  """
@@ -13,7 +13,8 @@ def cross_in_tray(x: np.array) -> float:
13
13
  The global mínima is located at x = (1.34941, 1.34941), (-1.34941, 1.34941), (1.34941, -1.34941)
14
14
  and (-1.34941, -1.34941) with a value of -2.06261
15
15
 
16
- :param :class:`np.array` x: array of floats
16
+ :param x: array of floats
17
+ :type x: :class:`numpy.ndarray`
17
18
  :return: the value of the function
18
19
  :rtype: float
19
20
  """
@@ -36,7 +37,8 @@ def inverted_cross_in_tray(x: np.array) -> float:
36
37
  The Cross-in-tray function has many widespread local minima, which are regularly distributed
37
38
  This implementation inverts the function to test out the maximization
38
39
 
39
- :param :class:`np.array` x: array of floats
40
+ :param x: array of floats
41
+ :type x: :class:`numpy.ndarray`
40
42
  :return: the value of the function
41
43
  :rtype: float
42
44
  """
@@ -9,7 +9,8 @@ def dolan_function_no2(x: np.array) -> float:
9
9
 
10
10
  The global minima is at [8.39045925, 4.81424707, 7.34574133, 68.88246895, 3.85470806] with a value of 10^-5
11
11
 
12
- :param :class:`np.array` x: array of floats. Values are evaluated between [-100, 100]
12
+ :param x: array of floats. Values are evaluated between [-100, 100]
13
+ :type x: :class:`numpy.ndarray`
13
14
  :return: the value of the function
14
15
  :rtype: float
15
16
  """
@@ -27,7 +28,8 @@ def inverted_dolan_function_no2(x: np.array) -> float:
27
28
  """
28
29
  Inverted Dolan function No 2.
29
30
 
30
- :param :class:`np.array` x: array of floats. Values are evaluated between [-100, 100]
31
+ :param x: array of floats. Values are evaluated between [-100, 100]
32
+ :type x: :class:`numpy.ndarray`
31
33
  :return: the value of the function
32
34
  :rtype: float
33
35
  """
@@ -11,7 +11,8 @@ def drop_wave(x: np.array) -> float:
11
11
 
12
12
  The global minima is located at x = (0, 0) with a value of -1
13
13
 
14
- :param :class:`np.array` x: array of floats. Values usually are between -5.12 and 5.12.
14
+ :param x: array of floats. Values usually are between -5.12 and 5.12.
15
+ :type x: :class:`numpy.ndarray`
15
16
  :return: the value of the function
16
17
  :rtype: float
17
18
  """
@@ -29,7 +30,8 @@ def inverted_drop_wave(x: np.array) -> float:
29
30
 
30
31
  The global minima is located at x = (0, 0) with a value of -1
31
32
 
32
- :param :class:`np.array` x: array of floats. Values usually are between -5.12 and 5.12.
33
+ :param x: array of floats. Values usually are between -5.12 and 5.12.
34
+ :type x: :class:`numpy.ndarray`
33
35
  :return: the value of the function
34
36
  :rtype: float
35
37
  """
@@ -12,7 +12,8 @@ def egg_holder(x: np.array) -> float:
12
12
  The function is usually evaluated on the square xi ∈ [-512, 512], for all i = 1, 2.
13
13
  The global mínima is located at x = (512, 404.2319) with a value of -959.6407
14
14
 
15
- :param :class:`np.array` x: array of floats
15
+ :param x: array of floats
16
+ :type x: :class:`numpy.ndarray`
16
17
  :return: the value of the function
17
18
  :rtype: float
18
19
  """
@@ -28,7 +29,8 @@ def inverted_egg_holder(x: np.array) -> float:
28
29
  The Egg-holder function has many widespread local minima, which are regularly distributed
29
30
  This implementation inverts the function to test out the maximization
30
31
 
31
- :param :class:`np.array` x: array of floats
32
+ :param x: array of floats
33
+ :type x: :class:`numpy.ndarray`
32
34
  :return: the value of the function
33
35
  :rtype: float
34
36
  """
@@ -1,26 +1,33 @@
1
1
  from math import sin, pi
2
+ from typing import Union
2
3
 
4
+ import numpy as np
3
5
 
4
- def gramacy_lee(x: list) -> float:
6
+
7
+ def gramacy_lee(x: Union[np.array, list, float]) -> float:
5
8
  """
6
9
  Gramacy & Lee function.
7
10
 
8
11
  This function is multimodal, with a number of local minima. The global minimum is at x = 0.54.
9
12
 
10
- :param list x: list of floats. Each value is usually between -0.5 and 2.5.
13
+ :param x: array or list with the value or the value itself. Each value is usually between -0.5 and 2.5.
14
+ :type x: :class:`numpy.array`, list or float
11
15
  :return: the value of the function
12
16
  :rtype: float
13
17
  """
18
+ if isinstance(x, float):
19
+ x = [x]
14
20
  return sin(10 * pi * x[0]) / (2 * x[0]) + (x[0] - 1) ** 4
15
21
 
16
22
 
17
- def inverted_gramacy_lee(x: list) -> float:
23
+ def inverted_gramacy_lee(x: Union[np.array, list, float]) -> float:
18
24
  """
19
25
  Inverted Gramacy & Lee function.
20
26
 
21
27
  This function is multimodal, with a number of local minima. The global minimum is at x = 0.54.
22
28
 
23
- :param list x: list of floats. Each value is usually between -0.5 and 2.5.
29
+ :param x: array or list with the value or the value itself. Each value is usually between -0.5 and 2.5.
30
+ :type x: :class:`numpy.array`, list or float
24
31
  :return: the value of the function
25
32
  :rtype: float
26
33
  """
@@ -1,5 +1,3 @@
1
- from math import prod, cos, sqrt
2
-
3
1
  import numpy as np
4
2
 
5
3
 
@@ -9,7 +7,10 @@ def griewank(x: np.array) -> float:
9
7
 
10
8
  The Griewank function has many widespread local minima, which are regularly distributed
11
9
 
12
- :param :class:`np.array` x: array of floats
10
+ The global minima is located at [0, 0, ..., 0] with a value of 0
11
+
12
+ :param x: array of floats
13
+ :type x: :class:`numpy.ndarray`
13
14
  :return: the value of the function
14
15
  :rtype: float
15
16
  """
@@ -27,7 +28,8 @@ def inverted_griewank(x: np.array) -> float:
27
28
  The Griewank function has many widespread local minima, which are regularly distributed
28
29
  This implementation inverts the function to test out the maximization
29
30
 
30
- :param :class:`np.array` x: array of floats
31
+ :param x: array of floats
32
+ :type x: :class:`numpy.ndarray`
31
33
  :return: the value of the function
32
34
  :rtype: float
33
35
  """
@@ -1,7 +1,10 @@
1
1
  from math import sin, cos, exp, sqrt, pi
2
+ from typing import Union
2
3
 
4
+ import numpy as np
3
5
 
4
- def holder_table(x: list) -> float:
6
+
7
+ def holder_table(x: Union[np.array, list]) -> float:
5
8
  """
6
9
  Holder function.
7
10
 
@@ -9,14 +12,15 @@ def holder_table(x: list) -> float:
9
12
  The global minima is at (8.05502, 9.66459), (-8.05502, 9.66459), (8.05502, -9.66459) and (-8.05502, -9.66459)
10
13
  with a value of -19.2085.
11
14
 
12
- :param list x: list of floats. Each value is usually between -10 and 10.
15
+ :param x: array or list of floats. Each value is usually between -10 and 10.
16
+ :type x: :class:`numpy.array` or list
13
17
  :return: the value of the function
14
18
  :rtype: float
15
19
  """
16
20
  return -abs(sin(x[0]) * cos(x[1]) * exp(abs(1 - sqrt(x[0] ** 2 + x[1] ** 2) / pi)))
17
21
 
18
22
 
19
- def inverted_holder_table(x: list) -> float:
23
+ def inverted_holder_table(x: Union[np.array, list]) -> float:
20
24
  """
21
25
  Inverted Holder function.
22
26
 
@@ -26,7 +30,8 @@ def inverted_holder_table(x: list) -> float:
26
30
  The global maxima is at (8.05502, 9.66459), (-8.05502, 9.66459), (8.05502, -9.66459) and (-8.05502, -9.66459)
27
31
  with a value of 19.2085.
28
32
 
29
- :param list x: list of floats. Each value is usually between -10 and 10.
33
+ :param x: list of floats. Each value is usually between -10 and 10.
34
+ :type x: :class:`numpy.array` or list
30
35
  :return: the value of the function
31
36
  :rtype: float
32
37
  """
@@ -1,14 +1,21 @@
1
1
  from math import exp, pi, cos
2
+ from typing import Union
2
3
 
4
+ import numpy as np
3
5
 
4
- def langermann(x: list) -> float:
6
+
7
+ def langermann(x: Union[np.array, list]) -> float:
5
8
  """
6
9
  Langermann function.
7
10
 
8
11
  The Langermann function is a multimodal problem. It has a fairly large number of local minima,
9
12
  widely separated and regularly distributed.
10
13
 
11
- :param list x: list of floats. Each value is usually between 0 and 10.
14
+ This implementation is only for the two dimension version of the function using the values for a, c and m
15
+ proposed by Molga & Smutnicki (2005) :cite:p:`molga2005test`.
16
+
17
+ :param x: array or list of floats. Each value is usually between 0 and 10.
18
+ :type x: :class:`numpy.array` or list
12
19
  :return: the value of the function
13
20
  :rtype: float
14
21
  """
@@ -29,14 +36,15 @@ def langermann(x: list) -> float:
29
36
  )
30
37
 
31
38
 
32
- def inverted_langermann(x: list) -> float:
39
+ def inverted_langermann(x: Union[np.array, list]) -> float:
33
40
  """
34
41
  Inverted Langermann function.
35
42
 
36
43
  The Langermann function is a multimodal problem. It has a fairly large number of local minima,
37
44
  widely separated and regularly distributed. This implementation inverts the function to test out the maximization
38
45
 
39
- :param list x: list of floats. Each value is usually between 0 and 10.
46
+ :param x: array or list of floats. Each value is usually between 0 and 10.
47
+ :type x: :class:`numpy.array` or list
40
48
  :return: the value of the function
41
49
  :rtype: float
42
50
  """
@@ -1,4 +1,5 @@
1
1
  from math import sin, pi
2
+ from typing import Union
2
3
 
3
4
  import numpy as np
4
5
 
@@ -9,7 +10,8 @@ def levy(x: np.array) -> float:
9
10
 
10
11
  The global minima is at x = [1, 1, 1, ..., 1] and the function value is 0.
11
12
 
12
- :param :class:`np.array` x: array of floats. Each value is usually between -10 and 10.
13
+ :param x: array of floats. Each value is usually between -10 and 10.
14
+ :type x: :class:`numpy.array`
13
15
  :return: the value of the function
14
16
  :rtype: float
15
17
  """
@@ -26,20 +28,22 @@ def inverted_levy(x: np.array) -> float:
26
28
  """
27
29
  Inverted Levy function.
28
30
 
29
- :param :class:`np.array` x: array of floats. Each value is usually between -10 and 10.
31
+ :param x: array of floats. Each value is usually between -10 and 10.
32
+ :type x: :class:`numpy.array`
30
33
  :return: the value of the function
31
34
  :rtype: float
32
35
  """
33
36
  return -levy(x)
34
37
 
35
38
 
36
- def levy_function_no13(x: list) -> float:
39
+ def levy_function_no13(x: Union[np.array, list]) -> float:
37
40
  """
38
41
  Levy function N. 13.
39
42
 
40
43
  The global minima is at x = [1, 1] and the function value is 0.
41
44
 
42
- :param list x: list of floats. Each value is usually between -10 and 10.
45
+ :param x: array or list of floats. Each value is usually between -10 and 10.
46
+ :type x: :class:`numpy.array` or list
43
47
  :return: the value of the function
44
48
  :rtype: float
45
49
  :doc-author: baobab soluciones
@@ -51,13 +55,14 @@ def levy_function_no13(x: list) -> float:
51
55
  )
52
56
 
53
57
 
54
- def inverted_levy_no13(x: list) -> float:
58
+ def inverted_levy_no13(x: Union[np.array, list]) -> float:
55
59
  """
56
60
  Inverted Levy function N. 13.
57
61
 
58
62
  The global minima is at x = [1, 1] and the function value is 0.
59
63
 
60
- :param list x: list of floats. Each value is usually between -10 and 10.
64
+ :param x: list of floats. Each value is usually between -10 and 10.
65
+ :type x: :class:`numpy.array` or list
61
66
  :return: the value of the function
62
67
  :rtype: float
63
68
  :doc-author: baobab soluciones
@@ -1,28 +1,34 @@
1
1
  from math import cos, pi
2
2
 
3
+ import numpy as np
3
4
 
4
- def rastrigin(x: list) -> float:
5
+
6
+ def rastrigin(x: np.array) -> float:
5
7
  """
6
8
  Rastrigin function.
7
9
 
8
10
  The Rastrigin function has several local minima. It is highly multimodal, but locations of the minima
9
11
  are regularly distributed.
10
12
 
11
- :param list x: list of floats. Values usually are between -5.12 and 5.12.
13
+ The global minima is at [0, 0, ..., 0] with a value of 0
14
+
15
+ :param x: array of floats. Values usually are between -5.12 and 5.12.
16
+ :type x: :class:`npumpy.array`
12
17
  :return: the value of the function
13
18
  :rtype: float
14
19
  """
15
- return 10 * len(x) + sum([i**2 - 10 * cos(2 * pi * i) for i in x])
20
+ return 10 * len(x) + np.sum(x**2 - 10 * np.cos(2 * pi * x))
16
21
 
17
22
 
18
- def inverse_rastrigin(x: list) -> float:
23
+ def inverted_rastrigin(x: np.array) -> float:
19
24
  """
20
25
  Inverted Rastrigin function.
21
26
 
22
27
  The Rastrigin function has several local minima. It is highly multimodal, but locations of the minima
23
28
  are regularly distributed. This implementation inverts the function to test out the maximization
24
29
 
25
- :param list x: list of floats. Values usually are between -5.12 and 5.12.
30
+ :param x: array of floats. Values usually are between -5.12 and 5.12.
31
+ :type x: :class:`npumpy.array`
26
32
  :return: the value of the function
27
33
  :rtype: float
28
34
  """
@@ -1,4 +1,7 @@
1
- def rosenbrock(x: list) -> float:
1
+ import numpy as np
2
+
3
+
4
+ def rosenbrock(x: np.array) -> float:
2
5
  """
3
6
  Rosenbrock function.
4
7
 
@@ -8,16 +11,18 @@ def rosenbrock(x: list) -> float:
8
11
  The function is unimodal, and the global minimum lies in a narrow, parabolic valley.
9
12
  However, even though this valley is easy to find, convergence to the minimum is difficult (Picheny et al., 2012).
10
13
 
11
- :param list x: list of floats. Values ussually are between -5 and 10
14
+ The global minima is at [1, 1, ..., 1] with a value of 0
15
+
16
+ :param x: array of floats. Values usually are between -5 and 10
17
+ :type x: :class:`numpy.array`
12
18
  :return: the value of the function
13
19
  :rtype: float
14
20
  """
15
- return sum(
16
- [100 * (x[i + 1] - x[i] ** 2) ** 2 + (1 - x[i]) ** 2 for i in range(len(x) - 1)]
17
- )
21
+
22
+ return np.sum(100.0 * (x[1:] - x[:-1] ** 2.0) ** 2.0 + (1 - x[:-1]) ** 2.0, axis=0)
18
23
 
19
24
 
20
- def inverted_rosenbrock(x: list) -> float:
25
+ def inverted_rosenbrock(x: np.array) -> float:
21
26
  """
22
27
  Inverted Rosenbrock function.
23
28
 
@@ -27,7 +32,8 @@ def inverted_rosenbrock(x: list) -> float:
27
32
  The function is unimodal, and the global minimum lies in a narrow, parabolic valley.
28
33
  However, even though this valley is easy to find, convergence to the minimum is difficult (Picheny et al., 2012).
29
34
 
30
- :param list x: list of floats. Values ussually are between -5 and 10
35
+ :param x: array of floats. Values ussually are between -5 and 10
36
+ :type x: :class:`numpy.array`
31
37
  :return: the value of the function
32
38
  :rtype: float
33
39
  """
@@ -1,7 +1,10 @@
1
1
  from math import sin, cos
2
+ from typing import Union
2
3
 
4
+ import numpy as np
3
5
 
4
- def schaffer_function_no2(x: list) -> float:
6
+
7
+ def schaffer_function_no2(x: Union[np.array, list]) -> float:
5
8
  """
6
9
  Schaffer function N. 2.
7
10
 
@@ -9,7 +12,8 @@ def schaffer_function_no2(x: list) -> float:
9
12
 
10
13
  The global minima is at x [0, 0] with value 0
11
14
 
12
- :param list x: A list of values. Values are evaluated between [-100, 100]
15
+ :param x: A list of values. Values are evaluated between [-100, 100]
16
+ :type x: :class:`numpy.array` or list
13
17
  :return: The value of the Schaffer function N. 2.
14
18
  :rtype: float
15
19
  """
@@ -18,7 +22,7 @@ def schaffer_function_no2(x: list) -> float:
18
22
  )
19
23
 
20
24
 
21
- def inverted_schaffer_function_no2(x: list) -> float:
25
+ def inverted_schaffer_function_no2(x: Union[np.array, list]) -> float:
22
26
  """
23
27
  Inverted Schaffer function N. 2.
24
28
 
@@ -28,14 +32,15 @@ def inverted_schaffer_function_no2(x: list) -> float:
28
32
 
29
33
  The global maxima is at x [0, 0] with value 0
30
34
 
31
- :param list x: A list of values. Values are evaluated between [-100, 100]
35
+ :param x: A list of values. Values are evaluated between [-100, 100]
36
+ :type x: :class:`numpy.array` or list
32
37
  :return: The value of the Inverted Schaffer function N. 2.
33
38
  :rtype: float
34
39
  """
35
40
  return -schaffer_function_no2(x)
36
41
 
37
42
 
38
- def schaffer_function_no4(x: list) -> float:
43
+ def schaffer_function_no4(x: Union[np.array, list]) -> float:
39
44
  """
40
45
  Schaffer function N. 4.
41
46
 
@@ -43,7 +48,8 @@ def schaffer_function_no4(x: list) -> float:
43
48
 
44
49
  The global minima is at x [0, 1.253115] with value 0.292579
45
50
 
46
- :param list x: A list of values. Values are evaluated between [-100, 100]
51
+ :param x: array or list of values. Values are evaluated between [-100, 100]
52
+ :type x: :class:`numpy.array` or list
47
53
  :return: The value of the Schaffer function N. 4.
48
54
  :rtype: float
49
55
  """
@@ -52,7 +58,7 @@ def schaffer_function_no4(x: list) -> float:
52
58
  )
53
59
 
54
60
 
55
- def inverted_schaffer_function_no4(x: list) -> float:
61
+ def inverted_schaffer_function_no4(x: Union[np.array, list]) -> float:
56
62
  """
57
63
  Inverted Schaffer function N. 4.
58
64
 
@@ -62,7 +68,8 @@ def inverted_schaffer_function_no4(x: list) -> float:
62
68
 
63
69
  The global maxima is at x [0, 1.253115] with value -0.292579
64
70
 
65
- :param list x: A list of values. Values are evaluated between [-100, 100]
71
+ :param x: array or list of values. Values are evaluated between [-100, 100]
72
+ :type x: :class:`numpy.array` or list
66
73
  :return: The value of the Inverted Schaffer function N. 4.
67
74
  :rtype: float
68
75
  """
@@ -9,10 +9,10 @@ def schwefel(x: np.array) -> float:
9
9
 
10
10
  The global minima is located at [420,9687, ..., 420,9687] with a value of 0
11
11
 
12
- :param :class:`np.array` x: input vector. The function is usually evaluated between [500, 500]
12
+ :param x: input vector. The function is usually evaluated between [500, 500]
13
+ :type x: :class:`numpy.array`
13
14
  :return: the value of the function
14
15
  :rtype: float
15
- :doc-author: baobab soluciones
16
16
  """
17
17
  return 418.9829 * len(x) - np.sum(x * np.sin(np.sqrt(np.abs(x))))
18
18
 
@@ -26,9 +26,9 @@ def inverted_schwefel(x: np.array) -> float:
26
26
 
27
27
  The global minima is located at [420,9687, ..., 420,9687] with a value of 0
28
28
 
29
- :param :class:`np.array` x: input vector. The function is usually evaluated between [500, 500]
29
+ :param x: input vector. The function is usually evaluated between [500, 500]
30
+ :type x: :class:`numpy.array`
30
31
  :return: the value of the function
31
32
  :rtype: float
32
- :doc-author: baobab soluciones
33
33
  """
34
34
  return -schwefel(x)