Skip to content

Commit ed1199d

Browse files
committed
PyGAD 2.19.0 Release
PyGAD 2.19.0 Release Notes 1. A new `summary()` method is supported to return a Keras-like summary of the PyGAD lifecycle. 2. A new optional parameter called `fitness_batch_size` is supported to calculate the fitness function in batches. If it is assigned the value `1` or `None` (default), then the normal flow is used where the fitness function is called for each individual solution. If the `fitness_batch_size` parameter is assigned a value satisfying this condition `1 < fitness_batch_size <= sol_per_pop`, then the solutions are grouped into batches of size `fitness_batch_size` and the fitness function is called once for each batch. In this case, the fitness function must return a list/tuple/numpy.ndarray with a length equal to the number of solutions passed. #136. 3. The `cloudpickle` library (https://github.com/cloudpipe/cloudpickle) is used instead of the `pickle` library to pickle the `pygad.GA` objects. This solves the issue of having to redefine the functions (e.g. fitness function). The `cloudpickle` library is added as a dependancy in the `requirements.txt` file. #159 4. Support of assigning methods to these parameters: `fitness_func`, `crossover_type`, `mutation_type`, `parent_selection_type`, `on_start`, `on_fitness`, `on_parents`, `on_crossover`, `on_mutation`, `on_generation`, and `on_stop`. #92 #138 5. Validating the output of the parent selection, crossover, and mutation functions. 6. The built-in parent selection operators return the parent's indices as a NumPy array. 7. The outputs of the parent selection, crossover, and mutation operators must be NumPy arrays. 8. Fix an issue when `allow_duplicate_genes=True`. #39 9. Fix an issue creating scatter plots of the solutions' fitness. 10. Sampling from a `set()` is no longer supported in Python 3.11. Instead, sampling happens from a `list()`. Thanks `Marco Brenna` for pointing to this issue. 11. The lifecycle is updated to reflect that the new population's fitness is calculated at the end of the lifecycle not at the beginning. #154 (comment) 12. There was an issue when `save_solutions=True` that causes the fitness function to be called for solutions already explored and have their fitness pre-calculated. #160 13. A new instance attribute named `last_generation_elitism_indices` added to hold the indices of the selected elitism. This attribute helps to re-use the fitness of the elitism instead of calling the fitness function. 14. Fewer calls to the `best_solution()` method which in turns saves some calls to the fitness function. 15. Some updates in the documentation to give more details about the `cal_pop_fitness()` method. #79 (comment)
1 parent fcf5d07 commit ed1199d

10 files changed

+1320
-497
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Please check the **Contact Us** section for more contact details.
6464

6565
The next figure lists the different stages in the lifecycle of an instance of the `pygad.GA` class. Note that PyGAD stops when either all generations are completed or when the function passed to the `on_generation` parameter returns the string `stop`.
6666

67-
![PyGAD Lifecycle](https://user-images.githubusercontent.com/16560492/89446279-9c6f8380-d754-11ea-83fd-a60ea2f53b85.jpg)
67+
![PyGAD Lifecycle](https://user-images.githubusercontent.com/16560492/220486073-c5b6089d-81e4-44d9-a53c-385f479a7273.jpg)
6868

6969
The next code implements all the callback functions to trace the execution of the genetic algorithm. Each callback function prints its name.
7070

__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.18.3"
3+
__version__ = "2.19.0"

docs/source/Footer.rst

+78
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,84 @@ Release Date: 14 February 2023
10931093

10941094
1. Bug fixes.
10951095

1096+
.. _pygad-2190:
1097+
1098+
PyGAD 2.19.0
1099+
------------
1100+
1101+
Release Date: 22 February 2023
1102+
1103+
1. A new ``summary()`` method is supported to return a Keras-like
1104+
summary of the PyGAD lifecycle.
1105+
1106+
2. A new optional parameter called ``fitness_batch_size`` is supported
1107+
to calculate the fitness function in batches. If it is assigned the
1108+
value ``1`` or ``None`` (default), then the normal flow is used
1109+
where the fitness function is called for each individual solution.
1110+
If the ``fitness_batch_size`` parameter is assigned a value
1111+
satisfying this condition ``1 < fitness_batch_size <= sol_per_pop``,
1112+
then the solutions are grouped into batches of size
1113+
``fitness_batch_size`` and the fitness function is called once for
1114+
each batch. In this case, the fitness function must return a
1115+
list/tuple/numpy.ndarray with a length equal to the number of
1116+
solutions passed.
1117+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/136.
1118+
1119+
3. The ``cloudpickle`` library
1120+
(https://github.com/cloudpipe/cloudpickle) is used instead of the
1121+
``pickle`` library to pickle the ``pygad.GA`` objects. This solves
1122+
the issue of having to redefine the functions (e.g. fitness
1123+
function). The ``cloudpickle`` library is added as a dependancy in
1124+
the ``requirements.txt`` file.
1125+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/159
1126+
1127+
4. Support of assigning methods to these parameters: ``fitness_func``,
1128+
``crossover_type``, ``mutation_type``, ``parent_selection_type``,
1129+
``on_start``, ``on_fitness``, ``on_parents``, ``on_crossover``,
1130+
``on_mutation``, ``on_generation``, and ``on_stop``.
1131+
https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/92
1132+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/138
1133+
1134+
5. Validating the output of the parent selection, crossover, and
1135+
mutation functions.
1136+
1137+
6. The built-in parent selection operators return the parent's indices
1138+
as a NumPy array.
1139+
1140+
7. The outputs of the parent selection, crossover, and mutation
1141+
operators must be NumPy arrays.
1142+
1143+
8. Fix an issue when ``allow_duplicate_genes=True``.
1144+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/39
1145+
1146+
9. Fix an issue creating scatter plots of the solutions' fitness.
1147+
1148+
10. Sampling from a ``set()`` is no longer supported in Python 3.11.
1149+
Instead, sampling happens from a ``list()``. Thanks ``Marco Brenna``
1150+
for pointing to this issue.
1151+
1152+
11. The lifecycle is updated to reflect that the new population's
1153+
fitness is calculated at the end of the lifecycle not at the
1154+
beginning.
1155+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/154#issuecomment-1438739483
1156+
1157+
12. There was an issue when ``save_solutions=True`` that causes the
1158+
fitness function to be called for solutions already explored and
1159+
have their fitness pre-calculated.
1160+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/160
1161+
1162+
13. A new instance attribute named ``last_generation_elitism_indices``
1163+
added to hold the indices of the selected elitism. This attribute
1164+
helps to re-use the fitness of the elitism instead of calling the
1165+
fitness function.
1166+
1167+
14. Fewer calls to the ``best_solution()`` method which in turns saves
1168+
some calls to the fitness function.
1169+
1170+
15. Some updates in the documentation to give more details about the
1171+
``cal_pop_fitness()`` method.
1172+
https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/79#issuecomment-1439605442
1173+
10961174
PyGAD Projects at GitHub
10971175
========================
10981176

0 commit comments

Comments
 (0)