Skip to content

Commit f7096bc

Browse files
authored
Merge branch 'master' into master
2 parents e35aae8 + 7699a56 commit f7096bc

13 files changed

+1050
-191
lines changed

LICENSE

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright GeneticAlgorithmPython Contributors
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ To start with coding the genetic algorithm, you can check the tutorial titled [*
245245
Get started with the genetic algorithm by reading the tutorial titled [**Introduction to Optimization with Genetic Algorithm**](https://www.linkedin.com/pulse/introduction-optimization-genetic-algorithm-ahmed-gad) which is available at these links:
246246

247247
* [LinkedIn](https://www.linkedin.com/pulse/introduction-optimization-genetic-algorithm-ahmed-gad)
248-
* [Towards Data Science](https://www.kdnuggets.com/2018/03/introduction-optimization-with-genetic-algorithm.html)
249-
* [KDnuggets](https://towardsdatascience.com/introduction-to-optimization-with-genetic-algorithm-2f5001d9964b)
248+
* [Towards Data Science](https://towardsdatascience.com/introduction-to-optimization-with-genetic-algorithm-2f5001d9964b)
249+
* [KDnuggets](https://www.kdnuggets.com/2018/03/introduction-optimization-with-genetic-algorithm.html)
250250

251251
[![Introduction to Genetic Algorithm](https://user-images.githubusercontent.com/16560492/82078259-26252d00-96e1-11ea-9a02-52a99e1054b9.jpg)](https://www.linkedin.com/pulse/introduction-optimization-genetic-algorithm-ahmed-gad)
252252

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .pygad import * # Relative import.
22

3-
__version__ = "2.16.3"
3+
__version__ = "2.18.3"

docs/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/Footer.rst

+153-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Release Date: 15 April 2020
1919
.. _pygad-1020:
2020

2121
PyGAD 1.0.20
22-
------------
22+
-------------
2323

2424
Release Date: 4 May 2020
2525

@@ -39,7 +39,7 @@ Release Date: 4 May 2020
3939
.. _pygad-200:
4040

4141
PyGAD 2.0.0
42-
-----------
42+
------------
4343

4444
Release Date: 13 May 2020
4545

@@ -258,7 +258,7 @@ Release date: 19 July 2020
258258
.. _pygad-260:
259259

260260
PyGAD 2.6.0
261-
-----------
261+
------------
262262

263263
Release Date: 6 August 2020
264264

@@ -378,7 +378,7 @@ Release Date: 3 October 2020
378378
.. _pygad-290:
379379

380380
PyGAD 2.9.0
381-
-----------
381+
------------
382382

383383
Release Date: 06 December 2020
384384

@@ -585,7 +585,7 @@ issue.
585585
.. _pygad-2130:
586586

587587
PyGAD 2.13.0
588-
------------
588+
-------------
589589

590590
Release Date: 12 March 2021
591591

@@ -920,14 +920,14 @@ progress bar.
920920
``solutions_fitness`` array.
921921
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/64
922922

923-
1. There was an issue of getting the length of these 4 variables
923+
2. There was an issue of getting the length of these 4 variables
924924
(``solutions``, ``solutions_fitness``, ``best_solutions``, and
925925
``best_solutions_fitness``) doubled after each call of the ``run()``
926926
method. This is solved by resetting these variables at the beginning
927927
of the ``run()`` method.
928928
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/62
929929

930-
2. Bug fixes when adaptive mutation is used
930+
3. Bug fixes when adaptive mutation is used
931931
(``mutation_type="adaptive"``).
932932
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/65
933933

@@ -963,6 +963,136 @@ Release Date: 2 February 2022
963963
exception is raised if something is wrong.
964964
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/67
965965

966+
.. _pygad-2170:
967+
968+
PyGAD 2.17.0
969+
------------
970+
971+
Release Date: 8 July 2022
972+
973+
1. An issue is solved when the ``gene_space`` parameter is given a fixed
974+
value. e.g. gene_space=[range(5), 4]. The second gene's value is
975+
static (4) which causes an exception.
976+
977+
2. Fixed the issue where the ``allow_duplicate_genes`` parameter did not
978+
work when mutation is disabled (i.e. ``mutation_type=None``). This is
979+
by checking for duplicates after crossover directly.
980+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/39
981+
982+
3. Solve an issue in the ``tournament_selection()`` method as the
983+
indices of the selected parents were incorrect.
984+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/89
985+
986+
4. Reuse the fitness values of the previously explored solutions rather
987+
than recalculating them. This feature only works if
988+
``save_solutions=True``.
989+
990+
5. Parallel processing is supported. This is by the introduction of a
991+
new parameter named ``parallel_processing`` in the constructor of the
992+
``pygad.GA`` class. Thanks to
993+
`@windowshopr <https://github.com/windowshopr>`__ for opening the
994+
issue
995+
`#78 <https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/78>`__
996+
at GitHub. Check the `Parallel Processing in
997+
PyGAD <https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#parallel-processing-in-pygad>`__
998+
section for more information and examples.
999+
1000+
.. _pygad-2180:
1001+
1002+
PyGAD 2.18.0
1003+
------------
1004+
1005+
Release Date: 9 September 2022
1006+
1007+
1. Raise an exception if the sum of fitness values is zero while either
1008+
roulette wheel or stochastic universal parent selection is used.
1009+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/129
1010+
1011+
2. Initialize the value of the ``run_completed`` property to ``False``.
1012+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/122
1013+
1014+
3. The values of these properties are no longer reset with each call to
1015+
the ``run()`` method
1016+
``self.best_solutions, self.best_solutions_fitness, self.solutions, self.solutions_fitness``:
1017+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/123. Now,
1018+
the user can have the flexibility of calling the ``run()`` method
1019+
more than once while extending the data collected after each
1020+
generation. Another advantage happens when the instance is loaded and
1021+
the ``run()`` method is called, as the old fitness value are shown on
1022+
the graph alongside with the new fitness values. Read more in this
1023+
section: `Continue without Loosing
1024+
Progress <https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#continue-without-loosing-progress>`__
1025+
1026+
4. Thanks `Prof. Fernando Jiménez
1027+
Barrionuevo <http://webs.um.es/fernan>`__ (Dept. of Information and
1028+
Communications Engineering, University of Murcia, Murcia, Spain) for
1029+
editing this
1030+
`comment <https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/5315bbec02777df96ce1ec665c94dece81c440f4/pygad.py#L73>`__
1031+
in the code.
1032+
https://github.com/ahmedfgad/GeneticAlgorithmPython/commit/5315bbec02777df96ce1ec665c94dece81c440f4
1033+
1034+
5. A bug fixed when ``crossover_type=None``.
1035+
1036+
6. Support of elitism selection through a new parameter named
1037+
``keep_elitism``. It defaults to 1 which means for each generation
1038+
keep only the best solution in the next generation. If assigned 0,
1039+
then it has no effect. Read more in this section: `Elitism
1040+
Selection <https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#elitism-selection>`__.
1041+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/74
1042+
1043+
7. A new instance attribute named ``last_generation_elitism`` added to
1044+
hold the elitism in the last generation.
1045+
1046+
8. A new parameter called ``random_seed`` added to accept a seed for the
1047+
random function generators. Credit to this issue
1048+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/70 and
1049+
`Prof. Fernando Jiménez Barrionuevo <http://webs.um.es/fernan>`__.
1050+
Read more in this section: `Random
1051+
Seed <https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#random-seed>`__.
1052+
1053+
9. Editing the ``pygad.TorchGA`` module to make sure the tensor data is
1054+
moved from GPU to CPU. Thanks to Rasmus Johansson for opening this
1055+
pull request: https://github.com/ahmedfgad/TorchGA/pull/2
1056+
1057+
.. _pygad-2181:
1058+
1059+
PyGAD 2.18.1
1060+
------------
1061+
1062+
Release Date: 19 September 2022
1063+
1064+
1. A big fix when ``keep_elitism`` is used.
1065+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/132
1066+
1067+
.. _pygad-2182:
1068+
1069+
PyGAD 2.18.2
1070+
------------
1071+
1072+
Release Date: 14 February 2023
1073+
1074+
1. Remove ``numpy.int`` and ``numpy.float`` from the list of supported
1075+
data types.
1076+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/151
1077+
https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/152
1078+
1079+
2. Call the ``on_crossover()`` callback function even if
1080+
``crossover_type`` is ``None``.
1081+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/138
1082+
1083+
3. Call the ``on_mutation()`` callback function even if
1084+
``mutation_type`` is ``None``.
1085+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/138
1086+
1087+
.. _pygad-2183:
1088+
1089+
PyGAD 2.18.3
1090+
------------
1091+
1092+
Release Date: 14 February 2023
1093+
1094+
1. Bug fixes.
1095+
9661096
PyGAD Projects at GitHub
9671097
========================
9681098

@@ -1071,6 +1201,22 @@ Stackoverflow Questions about PyGAD
10711201
`Multi-Input Multi-Output in Genetic algorithm (python) <https://stackoverflow.com/questions/64943711/multi-input-multi-output-in-genetic-algorithm-python>`__
10721202
--------------------------------------------------------------------------------------------------------------------------------------------------------------
10731203

1204+
https://www.linkedin.com/pulse/validation-short-term-parametric-trading-model-genetic-landolfi
1205+
1206+
https://itchef.ru/articles/397758
1207+
1208+
https://audhiaprilliant.medium.com/genetic-algorithm-based-clustering-algorithm-in-searching-robust-initial-centroids-for-k-means-e3b4d892a4be
1209+
1210+
https://python.plainenglish.io/validation-of-a-short-term-parametric-trading-model-with-genetic-optimization-and-walk-forward-89708b789af6
1211+
1212+
https://ichi.pro/ko/pygadwa-hamkke-yujeon-algolijeum-eul-sayonghayeo-keras-model-eul-hunlyeonsikineun-bangbeob-173299286377169
1213+
1214+
https://ichi.pro/tr/pygad-ile-genetik-algoritmayi-kullanarak-keras-modelleri-nasil-egitilir-173299286377169
1215+
1216+
https://ichi.pro/ru/kak-obucit-modeli-keras-s-pomos-u-geneticeskogo-algoritma-s-pygad-173299286377169
1217+
1218+
https://blog.csdn.net/sinat_38079265/article/details/108449614
1219+
10741220
Submitting Issues
10751221
=================
10761222

0 commit comments

Comments
 (0)