Skip to content

Commit 409e27d

Browse files
committed
PyGAD 3.6.0
1. Support passing a class to the fitness, crossover, and mutation. #342 2. A new class called `Validation` is created in the new `pygad/utils/validation.py` script. It has a method called `validate_parameters()` to validate all the parameters passed while instantiating the `pygad.GA` class. 3. Refactoring the `pygad.py` script by moving a lot of functions and methods to other classes in other scripts. 4. The `summary()` method was moved to `Helper` class in the `pygad/helper/misc.py` script. 5. The validation code in the `__init__()` method of the `pygad.GA` class is moved to the new `validate_parameters()` method in the new `Validation` class in the new `pygad/utils/validation.py` script. Moreover, the `validate_multi_stop_criteria()` method is also moved to the same class. 6. The GA main workflow is moved into the new `GAEngine` class in the new `pygad/utils/engine.py` script. Specifically, these methods are moved from the `pygad.GA` class to the new `GAEngine` class: 1. `run()` 1. `run_loop_head()` 2. `run_select_parents()` 3. `run_crossover()` 4. `run_mutation()` 5. `run_update_population()` 2. `initialize_population()` 3. `cal_pop_fitness()` 4. `best_solution()` 5. `round_genes()` 7. The `pygad.GA` class now extends the two new classes `utils.validation.Validation` and `utils.engine.GAEngine`. 8. The version of the `pygad.utils` submodule is upgraded from `1.3.0` to `1.4.0`. 9. The version of the `pygad.helper` submodule is upgraded from `1.2.0` to `1.3.0`. 10. The version of the `pygad.visualize` submodule is upgraded from `1.1.0` to `1.1.1`. 11. The version of the `pygad.nn` submodule is upgraded from `1.2.1` to `1.2.2`. 12. The version of the `pygad.cnn` submodule is upgraded from `1.1.0` to `1.1.1`. 13. The version of the `pygad.torchga` submodule is upgraded from `1.4.0` to `1.4.1`. 14. The version of the `pygad.kerasga` submodule is upgraded from `1.3.0` to `1.3.1`. 15. Update the elitism after the evolution ends to fix issue where the best solution returned by the `best_solution()` method is not correct. #337 16. Fix a bug in calling the `numpy.reshape()` function. The parameter `newshape` is removed since it is no longer supported started from NumPy `2.4.0`. https://numpy.org/doc/stable/release/2.4.0-notes.html#removed-newshape-parameter-from-numpy-reshape 17. A minor change in the documentation is made to replace the `newshape` parameter when calling `numpy.reshape()`. 18. Fix a bug in the `visualize/plot.py` script that causes a warning to be given when the plot leged is used with single-objective problems. 19. A new method called `initialize_parents_array()` is added to the `Helper` class in the `pygad/helper/misc.py` script. It is usually called from the methods in the `ParentSelection` class in the `pygad/utils/parent_selection.py` script to initialize the parents array. 20. Add more tests about: 1. Operators (crossover, mutation, and parent selection). 2. The `best_solution()` method. 3. Parallel processing. 4. The `GANN` module. 5. The plots created by the `visualize`. 21. Instead of using repeated code for converting the data type and rounding the genes during crossover and mutation, the `change_gene_dtype_and_round()` method is called from the `pygad.helper.misc.Helper` class. 22. Fix some documentation issues. #336 23. Update the documentation to reflect the recent additions and changes to the library structure.
1 parent e7c0229 commit 409e27d

File tree

9 files changed

+80
-40
lines changed

9 files changed

+80
-40
lines changed

docs/md/releases.md

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -622,30 +622,39 @@ Release Date 08 July 2025
622622
4. The `summary()` method was moved to `Helper` class in the `pygad/helper/misc.py` script.
623623
5. The validation code in the `__init__()` method of the `pygad.GA` class is moved to the new `validate_parameters()` method in the new `Validation` class in the new `pygad/utils/validation.py` script. Moreover, the `validate_multi_stop_criteria()` method is also moved to the same class.
624624
6. The GA main workflow is moved into the new `GAEngine` class in the new `pygad/utils/engine.py` script. Specifically, these methods are moved from the `pygad.GA` class to the new `GAEngine` class:
625-
1. `run()`
626-
1. `run_loop_head()`
627-
2. `run_select_parents()`
628-
3. `run_crossover()`
629-
4. `run_mutation()`
630-
5. `run_update_population()`
631-
2. `initialize_population()`
632-
3. `cal_pop_fitness()`
633-
4. `best_solution()`
634-
5. `round_genes()`
625+
1. `run()`
626+
1. `run_loop_head()`
627+
2. `run_select_parents()`
628+
3. `run_crossover()`
629+
4. `run_mutation()`
630+
5. `run_update_population()`
631+
2. `initialize_population()`
632+
3. `cal_pop_fitness()`
633+
4. `best_solution()`
634+
5. `round_genes()`
635635
7. The `pygad.GA` class now extends the two new classes `utils.validation.Validation` and `utils.engine.GAEngine`.
636636
8. The version of the `pygad.utils` submodule is upgraded from `1.3.0` to `1.4.0`.
637637
9. The version of the `pygad.helper` submodule is upgraded from `1.2.0` to `1.3.0`.
638-
10. Update the elitism after the evolution ends to fix issue where the best solution returned by the `best_solution()` method is not correct. https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/337
639-
11. Fix a bug in calling the `numpy.reshape()` function. The parameter `newshape` is removed since it is no longer supported started from NumPy `2.4.0`. https://numpy.org/doc/stable/release/2.4.0-notes.html#removed-newshape-parameter-from-numpy-reshape
640-
12. A minor change in the documentation is made to replace the `newshape` parameter when calling `numpy.reshape()`.
641-
13. Fix a bug in the `visualize/plot.py` script that causes a warning to be given when the plot leged is used with single-objective problems.
642-
14. A new method called `initialize_parents_array()` is added to the `Helper` class in the `pygad/helper/misc.py` script. It is usually called from the methods in the `ParentSelection` class in the `pygad/utils/parent_selection.py` script to initialize the parents array.
643-
15. Add more tests to test:
644-
1) Operators (crossover, mutation, and parent selection).
645-
2) The `best_solution()` method.
646-
3) Parallel processing.
647-
4) The `GANN` module.
648-
5) The plots created by the `visualize`.
638+
10. The version of the `pygad.visualize` submodule is upgraded from `1.1.0` to `1.1.1`.
639+
11. The version of the `pygad.nn` submodule is upgraded from `1.2.1` to `1.2.2`.
640+
12. The version of the `pygad.cnn` submodule is upgraded from `1.1.0` to `1.1.1`.
641+
13. The version of the `pygad.torchga` submodule is upgraded from `1.4.0` to `1.4.1`.
642+
14. The version of the `pygad.kerasga` submodule is upgraded from `1.3.0` to `1.3.1`.
643+
15. Update the elitism after the evolution ends to fix issue where the best solution returned by the `best_solution()` method is not correct. https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/337
644+
16. Fix a bug in calling the `numpy.reshape()` function. The parameter `newshape` is removed since it is no longer supported started from NumPy `2.4.0`. https://numpy.org/doc/stable/release/2.4.0-notes.html#removed-newshape-parameter-from-numpy-reshape
645+
17. A minor change in the documentation is made to replace the `newshape` parameter when calling `numpy.reshape()`.
646+
18. Fix a bug in the `visualize/plot.py` script that causes a warning to be given when the plot leged is used with single-objective problems.
647+
19. A new method called `initialize_parents_array()` is added to the `Helper` class in the `pygad/helper/misc.py` script. It is usually called from the methods in the `ParentSelection` class in the `pygad/utils/parent_selection.py` script to initialize the parents array.
648+
20. Add more tests about:
649+
1. Operators (crossover, mutation, and parent selection).
650+
2. The `best_solution()` method.
651+
3. Parallel processing.
652+
4. The `GANN` module.
653+
5. The plots created by the `visualize`.
654+
655+
21. Instead of using repeated code for converting the data type and rounding the genes during crossover and mutation, the `change_gene_dtype_and_round()` method is called from the `pygad.helper.misc.Helper` class.
656+
22. Fix some documentation issues. https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/336
657+
23. Update the documentation to reflect the recent additions and changes to the library structure.
649658

650659
# PyGAD Projects at GitHub
651660

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = 'PyGAD'
21-
copyright = '2025, Ahmed Fawzy Gad'
21+
copyright = '2026, Ahmed Fawzy Gad'
2222
author = 'Ahmed Fawzy Gad'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '3.5.0'
25+
release = '3.6.0'
2626

2727
master_doc = 'index'
2828

docs/source/releases.rst

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,35 +1844,66 @@ PyGAD 3.6.0
18441844
9. The version of the ``pygad.helper`` submodule is upgraded from
18451845
``1.2.0`` to ``1.3.0``.
18461846

1847-
10. Update the elitism after the evolution ends to fix issue where the
1847+
10. The version of the ``pygad.visualize`` submodule is upgraded from
1848+
``1.1.0`` to ``1.1.1``.
1849+
1850+
11. The version of the ``pygad.nn`` submodule is upgraded from ``1.2.1``
1851+
to ``1.2.2``.
1852+
1853+
12. The version of the ``pygad.cnn`` submodule is upgraded from
1854+
``1.1.0`` to ``1.1.1``.
1855+
1856+
13. The version of the ``pygad.torchga`` submodule is upgraded from
1857+
``1.4.0`` to ``1.4.1``.
1858+
1859+
14. The version of the ``pygad.kerasga`` submodule is upgraded from
1860+
``1.3.0`` to ``1.3.1``.
1861+
1862+
15. Update the elitism after the evolution ends to fix issue where the
18481863
best solution returned by the ``best_solution()`` method is not
18491864
correct.
18501865
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/337
18511866

1852-
11. Fix a bug in calling the ``numpy.reshape()`` function. The parameter
1867+
16. Fix a bug in calling the ``numpy.reshape()`` function. The parameter
18531868
``newshape`` is removed since it is no longer supported started from
18541869
NumPy ``2.4.0``.
18551870
https://numpy.org/doc/stable/release/2.4.0-notes.html#removed-newshape-parameter-from-numpy-reshape
18561871

1857-
12. A minor change in the documentation is made to replace the
1872+
17. A minor change in the documentation is made to replace the
18581873
``newshape`` parameter when calling ``numpy.reshape()``.
18591874

1860-
13. Fix a bug in the ``visualize/plot.py`` script that causes a warning
1875+
18. Fix a bug in the ``visualize/plot.py`` script that causes a warning
18611876
to be given when the plot leged is used with single-objective
18621877
problems.
18631878

1864-
14. A new method called ``initialize_parents_array()`` is added to the
1879+
19. A new method called ``initialize_parents_array()`` is added to the
18651880
``Helper`` class in the ``pygad/helper/misc.py`` script. It is
18661881
usually called from the methods in the ``ParentSelection`` class in
18671882
the ``pygad/utils/parent_selection.py`` script to initialize the
18681883
parents array.
18691884

1870-
15. | Add more tests to test:
1871-
| 1) Operators (crossover, mutation, and parent selection).
1872-
| 2) The ``best_solution()`` method.
1873-
| 3) Parallel processing.
1874-
| 4) The ``GANN`` module.
1875-
| 5) The plots created by the ``visualize``.
1885+
20. Add more tests about:
1886+
1887+
1. Operators (crossover, mutation, and parent selection).
1888+
1889+
2. The ``best_solution()`` method.
1890+
1891+
3. Parallel processing.
1892+
1893+
4. The ``GANN`` module.
1894+
1895+
5. The plots created by the ``visualize``.
1896+
1897+
21. Instead of using repeated code for converting the data type and
1898+
rounding the genes during crossover and mutation, the
1899+
``change_gene_dtype_and_round()`` method is called from the
1900+
``pygad.helper.misc.Helper`` class.
1901+
1902+
22. Fix some documentation issues.
1903+
https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/336
1904+
1905+
23. Update the documentation to reflect the recent additions and changes
1906+
to the library structure.
18761907

18771908
PyGAD Projects at GitHub
18781909
========================

pygad/cnn/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .cnn import *
22

3-
__version__ = "1.1.0"
3+
__version__ = "1.1.1"
44

pygad/gann/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .gann import *
22

3-
__version__ = "1.0.1"
3+
__version__ = "1.0.0"
44

pygad/kerasga/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .kerasga import *
22

3-
__version__ = "1.3.0"
3+
__version__ = "1.3.1"

pygad/nn/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from .nn import *
22

3-
__version__ = "1.2.1"
3+
__version__ = "1.2.2"
44

pygad/torchga/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .torchga import *
22

3-
__version__ = "1.4.0"
3+
__version__ = "1.4.1"

pygad/visualize/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from pygad.visualize import plot
22

3-
__version__ = "1.1.0"
3+
__version__ = "1.1.1"

0 commit comments

Comments
 (0)