Skip to content

Commit 158e53c

Browse files
authored
PyGAD 2.16.1 Documentation
1 parent 19bac06 commit 158e53c

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

docs/source/Footer.rst

+58
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,64 @@ Release Date: 19 June 2021
833833
section for more details.
834834
https://github.com./ahmedfgad/GeneticAlgorithmPython/discussions/50
835835

836+
.. _pygad-2161:
837+
838+
PyGAD 2.16.1
839+
------------
840+
841+
Release Date: 28 September 2021
842+
843+
1. Reuse the fitness of previously explored solutions rather than
844+
recalculating them. This feature only works if
845+
``save_solutions=True``.
846+
847+
2. The user can use the ``tqdm`` library to show a progress bar.
848+
https://github.com./ahmedfgad/GeneticAlgorithmPython/discussions/50
849+
850+
.. code:: python
851+
852+
import pygad
853+
import numpy
854+
import tqdm
855+
856+
equation_inputs = [4,-2,3.5]
857+
desired_output = 44
858+
859+
def fitness_func(solution, solution_idx):
860+
output = numpy.sum(solution * equation_inputs)
861+
fitness = 1.0 / (numpy.abs(output - desired_output) + 0.000001)
862+
return fitness
863+
864+
num_generations = 10000
865+
with tqdm.tqdm(total=num_generations) as pbar:
866+
ga_instance = pygad.GA(num_generations=num_generations,
867+
sol_per_pop=5,
868+
num_parents_mating=2,
869+
num_genes=len(equation_inputs),
870+
fitness_func=fitness_func,
871+
on_generation=lambda _: pbar.update(1))
872+
873+
ga_instance.run()
874+
875+
ga_instance.plot_result()
876+
877+
1. Solved the issue of unequal length between the ``solutions`` and
878+
``solutions_fitness`` when the ``save_solutions`` parameter is set to
879+
``True``. Now, the fitness of the last population is appended to the
880+
``solutions_fitness`` array.
881+
https://github.com./ahmedfgad/GeneticAlgorithmPython/issues/64
882+
883+
2. There was an issue of getting the length of these 4 variables
884+
(``solutions``, ``solutions_fitness``, ``best_solutions``, and
885+
``best_solutions_fitness``) doubled after each call of the ``run()``
886+
method. This is solved by resetting these variables at the beginning
887+
of the ``run()`` method.
888+
https://github.com./ahmedfgad/GeneticAlgorithmPython/issues/62
889+
890+
3. Bug fixes when adaptive mutation is used
891+
(``mutation_type="adaptive"``).
892+
https://github.com./ahmedfgad/GeneticAlgorithmPython/issues/65
893+
836894
PyGAD Projects at GitHub
837895
========================
838896

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Ahmed Fawzy Gad'
2323

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

2727
master_doc = 'index'
2828

0 commit comments

Comments
 (0)