tag:github.com,2008:https://github.com/divineforge/GeneticAlgorithmPython/releases Tags from GeneticAlgorithmPython 2023-09-08T00:33:25Z tag:github.com,2008:Repository/726425617/3.2.0 2023-09-08T00:33:25Z 3.2.0: Merge pull request #232 from ahmedfgad/github-actions <p>Merge pull request <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/232">ahmedfgad#232</a> from ahmedfgad/github-actions</p> <p>GitHub actions</p> ahmedfgad tag:github.com,2008:Repository/726425617/3.1.0 2023-06-20T19:27:49Z PyGAD 3.1.0 Release <p>PyGAD 3.1.0 Release</p> <p>PyGAD 3.1.0 Release Notes <br />1. Fix a bug when the initial population has duplciate genes if a nested gene space is used. <br />2. The gene_space parameter can no longer be assigned a tuple. <br />3. Fix a bug when the gene_space parameter has a member of type tuple. <br />4. A new instance attribute called gene_space_unpacked which has the unpacked gene_space. It is used to solve duplicates. For infinite ranges in the gene_space, they are unpacked to a limited number of values (e.g. 100). <br />5. Bug fixes when creating the initial population using gene_space attribute. <br />6. When a dict is used with the gene_space attribute, the new gene value was calculated by summing 2 values: 1) the value sampled from the dict 2) a random value returned from the random mutation range defined by the 2 parameters random_mutation_min_val and random_mutation_max_val. This might cause the gene value to exceed the range limit defined in the gene_space. To respect the gene_space range, this release only returns the value from the dict without summing it to a random value. <br />7. Formatting the strings using f-string instead of the format() method. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/189">ahmedfgad#189</a> <br />8. In the __init__() of the pygad.GA class, the logged error messages are handled using a try-except block instead of repeating the logger.error() command. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/189">ahmedfgad#189</a> <br />9. A new class named CustomLogger is created in the pygad.cnn module to create a default logger using the logging module assigned to the logger attribute. This class is extended in all other classes in the module. The constructors of these classes have a new parameter named logger which defaults to None. If no logger is passed, then the default logger in the CustomLogger class is used. <br />10. Except for the pygad.nn module, the print() function in all other modules are replaced by the logging module to log messages. <br />11. The callback functions/methods on_fitness(), on_parents(), on_crossover(), and on_mutation() can return values. These returned values override the corresponding properties. The output of on_fitness() overrides the population fitness. The on_parents() function/method must return 2 values representing the parents and their indices. The output of on_crossover() overrides the crossover offspring. The output of on_mutation() overrides the mutation offspring. <br />12. Fix a bug when adaptive mutation is used while fitness_batch_size&gt;1. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/195">ahmedfgad#195</a> <br />13. When allow_duplicate_genes=False and a user-defined gene_space is used, it sometimes happen that there is no room to solve the duplicates between the 2 genes by simply replacing the value of one gene by another gene. This release tries to solve such duplicates by looking for a third gene that will help in solving the duplicates. These examples explain how it works. Check this section for more information. <br />14. Use probabilities to select parents using the rank parent selection method. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/205">ahmedfgad#205</a> <br />15. The 2 parameters random_mutation_min_val and random_mutation_max_val can accept iterables (list/tuple/numpy.ndarray) with length equal to the number of genes. This enables customizing the mutation range for each individual gene. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198">ahmedfgad#198</a> <br />16. The 2 parameters init_range_low and init_range_high can accept iterables (list/tuple/numpy.ndarray) with length equal to the number of genes. This enables customizing the initial range for each individual gene when creating the initial population. <br />17. The data parameter in the predict() function of the pygad.kerasga module can be assigned a data generator. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/115">ahmedfgad#115</a> <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207">ahmedfgad#207</a> <br />18. The predict() function of the pygad.kerasga module accepts 3 optional parameters: 1) batch_size=None, verbose=0, and steps=None. Check documentation of the Keras Model.predict() method for more information. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207">ahmedfgad#207</a> <br />19. The documentation is updated to explain how mutation works when gene_space is used with int or float data types. Check this section. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198">ahmedfgad#198</a></p> ahmedfgad tag:github.com,2008:Repository/726425617/3.0.1 2023-04-20T13:35:05Z PyGAD 3.0.1 <p>PyGAD 3.0.1</p> <p>Fix an issue with passing user-defined function/method for parent selection. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/179">ahmedfgad#179</a></p> ahmedfgad tag:github.com,2008:Repository/726425617/3.0.0 2023-04-08T19:16:22Z PyGAD 3.0.0 Release <p>PyGAD 3.0.0 Release</p> <p>PyGAD 3.0.0 Release Notes <br />1. The structure of the library is changed and some methods defined in the `pygad.py` module are moved to the `pygad.utils`, `pygad.helper`, and `pygad.visualize` submodules. <br /> 2. The `pygad.utils.parent_selection` module has a class named `ParentSelection` where all the parent selection operators exist. The `pygad.GA` class extends this class. <br /> 3. The `pygad.utils.crossover` module has a class named `Crossover` where all the crossover operators exist. The `pygad.GA` class extends this class. <br /> 4. The `pygad.utils.mutation` module has a class named `Mutation` where all the mutation operators exist. The `pygad.GA` class extends this class. <br /> 5. The `pygad.helper.unique` module has a class named `Unique` some helper methods exist to solve duplicate genes and make sure every gene is unique. The `pygad.GA` class extends this class. <br /> 6. The `pygad.visualize.plot` module has a class named `Plot` where all the methods that create plots exist. The `pygad.GA` class extends this class.</p> <p>```python <br />... <br />class GA(utils.parent_selection.ParentSelection, <br /> utils.crossover.Crossover, <br /> utils.mutation.Mutation, <br /> helper.unique.Unique, <br /> visualize.plot.Plot): <br />... <br />```</p> <p>2. Support of using the `logging` module to log the outputs to both the console and text file instead of using the `print()` function. This is by assigning the `logging.Logger` to the new `logger` parameter. Check the [Logging Outputs](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#logging-outputs">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#logging-outputs</a>) for more information. <br />3. A new instance attribute called `logger` to save the logger. <br />4. The function/method passed to the `fitness_func` parameter accepts a new parameter that refers to the instance of the `pygad.GA` class. Check this for an example: [Use Functions and Methods to Build Fitness Function and Callbacks](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks</a>). <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/163">ahmedfgad#163</a> <br />5. Update the documentation to include an example of using functions and methods to calculate the fitness and build callbacks. Check this for more details: [Use Functions and Methods to Build Fitness Function and Callbacks](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks</a>). <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/92#issuecomment-1443635003">ahmedfgad#92 (comment)</a> <br />6. Validate the value passed to the `initial_population` parameter. <br />7. Validate the type and length of the `pop_fitness` parameter of the `best_solution()` method. <br />8. Some edits in the documentation. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/106">ahmedfgad#106</a> <br />9. Fix an issue when building the initial population as (some) genes have their value taken from the mutation range (defined by the parameters `random_mutation_min_val` and `random_mutation_max_val`) instead of using the parameters `init_range_low` and `init_range_high`. <br />10. The `summary()` method returns the summary as a single-line string. Just log/print the returned string it to see it properly. <br />11. The `callback_generation` parameter is removed. Use the `on_generation` parameter instead. <br />12. There was an issue when using the `parallel_processing` parameter with Keras and PyTorch. As Keras/PyTorch are not thread-safe, the `predict()` method gives incorrect and weird results when more than 1 thread is used. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/145">ahmedfgad#145</a> <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/TorchGA/issues/5">ahmedfgad/TorchGA#5</a> <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/KerasGA/issues/6">ahmedfgad/KerasGA#6</a>. Thanks to this [StackOverflow answer](<a href="https://stackoverflow.com/a/75606666/5426539">https://stackoverflow.com/a/75606666/5426539</a>). <br />13. Replace `numpy.float` by `float` in the 2 parent selection operators roulette wheel and stochastic universal. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/168">ahmedfgad#168</a></p> ahmedfgad tag:github.com,2008:Repository/726425617/2.19.2 2023-02-23T13:36:28Z PyGAD 2.19.2 Release <p>PyGAD 2.19.2 Release</p> <p>PyGAD 2.19.2 Release Notes <br />1. Fix an issue when paralell processing was used where the elitism solutions' fitness values are not re-used. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/160#issuecomment-1441718184">ahmedfgad#160 (comment)</a></p> ahmedfgad tag:github.com,2008:Repository/726425617/2.19.1 2023-02-22T15:20:14Z PyGAD 2.19.1 Release <p>PyGAD 2.19.1 Release</p> <p>PyGAD 2.19.1 Release Notes <br />1. Add the [cloudpickle](<a href="https://github.com/cloudpipe/cloudpickle">https://github.com/cloudpipe/cloudpickle</a>) library as a dependency.</p> ahmedfgad tag:github.com,2008:Repository/726425617/2.18.3 2023-02-14T20:38:25Z 2.18.3 ahmedfgad tag:github.com,2008:Repository/726425617/2.18.2 2023-02-14T18:59:47Z 2.18.2 ahmedfgad tag:github.com,2008:Repository/726425617/2.18.1 2022-09-19T19:06:36Z 2.18.1 ahmedfgad tag:github.com,2008:Repository/726425617/2.18.0 2022-09-09T05:38:58Z PyGAD 2.18.0 Documentation <p>PyGAD 2.18.0 Documentation</p> <p>1. Raise an exception if the sum of fitness values is zero while either roulette wheel or stochastic universal parent selection is used. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/129">ahmedfgad#129</a> <br />2. Initialize the value of the `run_completed` property to `False`. <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/122">ahmedfgad#122</a> <br />3. The values of these properties are no longer reset with each call to the `run()` method `self.best_solutions, self.best_solutions_fitness, self.solutions, self.solutions_fitness`: <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/123">ahmedfgad#123</a>. Now, the user can have the flexibility of calling the `run()` method more than once while extending the data collected after each generation. Another advantage happens when the instance is loaded and the `run()` method is called, as the old fitness value are shown on the graph alongside with the new fitness values. Read more in this section: [Continue without Loosing Progress](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#continue-without-loosing-progress">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#continue-without-loosing-progress</a>) <br />4. Thanks [Prof. Fernando Jiménez Barrionuevo](<a href="http://webs.um.es/fernan">http://webs.um.es/fernan</a>) (Dept. of Information and Communications Engineering, University of Murcia, Murcia, Spain) for editing this [comment](<a href="https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/5315bbec02777df96ce1ec665c94dece81c440f4/pygad.py#L73">https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/5315bbec02777df96ce1ec665c94dece81c440f4/pygad.py#L73</a>) in the code. <a class="commit-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/commit/5315bbec02777df96ce1ec665c94dece81c440f4">ahmedfgad@<tt>5315bbe</tt></a> <br />5. A bug fixed when `crossover_type=None`. <br />6. Support of elitism selection through a new parameter named `keep_elitism`. It defaults to 1 which means for each generation keep only the best solution in the next generation. If assigned 0, then it has no effect. Read more in this section: [Elitism Selection](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#elitism-selection">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#elitism-selection</a>). <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/74">ahmedfgad#74</a> <br />7. A new instance attribute named `last_generation_elitism` added to hold the elitism in the last generation. <br />8. A new parameter called `random_seed` added to accept a seed for the random function generators. Credit to this issue <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/70">ahmedfgad#70</a> and [Prof. Fernando Jiménez Barrionuevo](<a href="http://webs.um.es/fernan">http://webs.um.es/fernan</a>). Read more in this section: [Random Seed](<a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#random-seed">https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#random-seed</a>). <br />9. Editing the `pygad.TorchGA` module to make sure the tensor data is moved from GPU to CPU. Thanks to Rasmus Johansson for opening this pull request: <a class="issue-link js-issue-link" href="https://github.com/ahmedfgad/TorchGA/pull/2">ahmedfgad/TorchGA#2</a></p> ahmedfgad