tag:github.com,2008:https://github.com/longamu/GeneticAlgorithmPython/releases Release notes from GeneticAlgorithmPython 2024-02-17T21:03:20Z tag:github.com,2008:Repository/909738453/3.3.1 2024-02-17T21:03:20Z 3.3.1: Merge pull request #278 from ahmedfgad/github-actions <p>Merge pull request <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2140617639" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/277" data-hovercard-type="pull_request" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/pull/277/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/277">ahmedfgad#277</a> from ahmedfgad/master</p> ahmedfgad tag:github.com,2008:Repository/909738453/3.3.0 2024-01-29T06:29:41Z 3.3.0: Merge pull request #265 from ahmedfgad/github-actions <p>GitHub actions</p> ahmedfgad tag:github.com,2008:Repository/909738453/3.2.0 2023-09-08T00:33:25Z 3.2.0: Merge pull request #232 from ahmedfgad/github-actions <p>GitHub actions</p> ahmedfgad tag:github.com,2008:Repository/909738453/3.1.0 2023-06-20T19:27:49Z PyGAD 3.1.0 Release <p>PyGAD 3.1.0 Release Notes</p> <ol> <li>Fix a bug when the initial population has duplciate genes if a nested gene space is used.</li> <li>The gene_space parameter can no longer be assigned a tuple.</li> <li>Fix a bug when the gene_space parameter has a member of type tuple.</li> <li>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).</li> <li>Bug fixes when creating the initial population using gene_space attribute.</li> <li>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.</li> <li>Formatting the strings using f-string instead of the format() method. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1695932374" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/189" data-hovercard-type="pull_request" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/pull/189/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/189">ahmedfgad#189</a></li> <li>In the <strong>init</strong>() 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" data-error-text="Failed to load title" data-id="1695932374" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/189" data-hovercard-type="pull_request" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/pull/189/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/189">ahmedfgad#189</a></li> <li>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.</li> <li>Except for the pygad.nn module, the print() function in all other modules are replaced by the logging module to log messages.</li> <li>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.</li> <li>Fix a bug when adaptive mutation is used while fitness_batch_size&gt;1. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1703704890" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/195" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/195/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/195">ahmedfgad#195</a></li> <li>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.</li> <li>Use probabilities to select parents using the rank parent selection method. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="5268161" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/205" data-hovercard-type="discussion" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/discussions/205/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/205">ahmedfgad#205</a></li> <li>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" data-error-text="Failed to load title" data-id="5198482" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198" data-hovercard-type="discussion" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/discussions/198/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198">ahmedfgad#198</a></li> <li>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.</li> <li>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" data-error-text="Failed to load title" data-id="1254327448" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/115" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/115/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/115">ahmedfgad#115</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1749809155" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/207/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207">ahmedfgad#207</a></li> <li>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" data-error-text="Failed to load title" data-id="1749809155" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/207/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/207">ahmedfgad#207</a></li> <li>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" data-error-text="Failed to load title" data-id="5198482" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198" data-hovercard-type="discussion" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/discussions/198/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/discussions/198">ahmedfgad#198</a></li> </ol> ahmedfgad tag:github.com,2008:Repository/909738453/3.0.1 2023-04-20T13:35:05Z PyGAD 3.0.1 <p>Fix an issue with passing user-defined function/method for parent selection. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1676248852" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/179" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/179/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/179">ahmedfgad#179</a></p> ahmedfgad tag:github.com,2008:Repository/909738453/3.0.0 2023-04-08T19:16:22Z PyGAD 3.0.0 Release <p>PyGAD 3.0.0 Release Notes</p> <ol> <li>The structure of the library is changed and some methods defined in the <code>pygad.py</code> module are moved to the <code>pygad.utils</code>, <code>pygad.helper</code>, and <code>pygad.visualize</code> submodules.</li> <li>The <code>pygad.utils.parent_selection</code> module has a class named <code>ParentSelection</code> where all the parent selection operators exist. The <code>pygad.GA</code> class extends this class.</li> <li>The <code>pygad.utils.crossover</code> module has a class named <code>Crossover</code> where all the crossover operators exist. The <code>pygad.GA</code> class extends this class.</li> <li>The <code>pygad.utils.mutation</code> module has a class named <code>Mutation</code> where all the mutation operators exist. The <code>pygad.GA</code> class extends this class.</li> <li>The <code>pygad.helper.unique</code> module has a class named <code>Unique</code> some helper methods exist to solve duplicate genes and make sure every gene is unique. The <code>pygad.GA</code> class extends this class.</li> <li>The <code>pygad.visualize.plot</code> module has a class named <code>Plot</code> where all the methods that create plots exist. The <code>pygad.GA</code> class extends this class.</li> </ol> <div class="highlight highlight-source-python notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="... class GA(utils.parent_selection.ParentSelection, utils.crossover.Crossover, utils.mutation.Mutation, helper.unique.Unique, visualize.plot.Plot): ..."><pre>... <span class="pl-k">class</span> <span class="pl-c1">GA</span>(<span class="pl-s1">utils</span>.<span class="pl-c1">parent_selection</span>.<span class="pl-c1">ParentSelection</span>, <span class="pl-s1">utils</span>.<span class="pl-c1">crossover</span>.<span class="pl-c1">Crossover</span>, <span class="pl-s1">utils</span>.<span class="pl-c1">mutation</span>.<span class="pl-c1">Mutation</span>, <span class="pl-s1">helper</span>.<span class="pl-c1">unique</span>.<span class="pl-c1">Unique</span>, <span class="pl-s1">visualize</span>.<span class="pl-c1">plot</span>.<span class="pl-c1">Plot</span>): ...</pre></div> <ol start="2"> <li>Support of using the <code>logging</code> module to log the outputs to both the console and text file instead of using the <code>print()</code> function. This is by assigning the <code>logging.Logger</code> to the new <code>logger</code> parameter. Check the <a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#logging-outputs" rel="nofollow">Logging Outputs</a> for more information.</li> <li>A new instance attribute called <code>logger</code> to save the logger.</li> <li>The function/method passed to the <code>fitness_func</code> parameter accepts a new parameter that refers to the instance of the <code>pygad.GA</code> class. Check this for an example: <a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks" rel="nofollow">Use Functions and Methods to Build Fitness Function and Callbacks</a>. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1598953584" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/163" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/163/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/163">ahmedfgad#163</a></li> <li>Update the documentation to include an example of using functions and methods to calculate the fitness and build callbacks. Check this for more details: <a href="https://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#use-functions-and-methods-to-build-fitness-and-callbacks" rel="nofollow">Use Functions and Methods to Build Fitness Function and Callbacks</a>. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1163483400" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/92" data-hovercard-type="pull_request" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/pull/92/hovercard?comment_id=1443635003&amp;comment_type=issue_comment" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/92#issuecomment-1443635003">ahmedfgad#92 (comment)</a></li> <li>Validate the value passed to the <code>initial_population</code> parameter.</li> <li>Validate the type and length of the <code>pop_fitness</code> parameter of the <code>best_solution()</code> method.</li> <li>Some edits in the documentation. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1221419402" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/106" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/106/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/106">ahmedfgad#106</a></li> <li>Fix an issue when building the initial population as (some) genes have their value taken from the mutation range (defined by the parameters <code>random_mutation_min_val</code> and <code>random_mutation_max_val</code>) instead of using the parameters <code>init_range_low</code> and <code>init_range_high</code>.</li> <li>The <code>summary()</code> method returns the summary as a single-line string. Just log/print the returned string it to see it properly.</li> <li>The <code>callback_generation</code> parameter is removed. Use the <code>on_generation</code> parameter instead.</li> <li>There was an issue when using the <code>parallel_processing</code> parameter with Keras and PyTorch. As Keras/PyTorch are not thread-safe, the <code>predict()</code> method gives incorrect and weird results when more than 1 thread is used. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1453468522" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/145" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/145/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/145">ahmedfgad#145</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1605384120" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/TorchGA/issues/5" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/TorchGA/issues/5/hovercard" href="https://github.com/ahmedfgad/TorchGA/issues/5">ahmedfgad/TorchGA#5</a> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1605386990" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/KerasGA/issues/6" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/KerasGA/issues/6/hovercard" href="https://github.com/ahmedfgad/KerasGA/issues/6">ahmedfgad/KerasGA#6</a>. Thanks to this <a href="https://stackoverflow.com/a/75606666/5426539" rel="nofollow">StackOverflow answer</a>.</li> <li>Replace <code>numpy.float</code> by <code>float</code> in the 2 parent selection operators roulette wheel and stochastic universal. <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1650610335" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/168" data-hovercard-type="pull_request" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/pull/168/hovercard" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/pull/168">ahmedfgad#168</a></li> </ol> ahmedfgad tag:github.com,2008:Repository/909738453/2.19.2 2023-02-23T13:36:28Z PyGAD 2.19.2 Release <p>PyGAD 2.19.2 Release Notes</p> <ol> <li>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" data-error-text="Failed to load title" data-id="1578213596" data-permission-text="Title is private" data-url="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/160" data-hovercard-type="issue" data-hovercard-url="/ahmedfgad/GeneticAlgorithmPython/issues/160/hovercard?comment_id=1441718184&amp;comment_type=issue_comment" href="https://github.com/ahmedfgad/GeneticAlgorithmPython/issues/160#issuecomment-1441718184">ahmedfgad#160 (comment)</a></li> </ol> ahmedfgad tag:github.com,2008:Repository/909738453/2.19.1 2023-02-22T15:20:14Z PyGAD 2.19.1 Release <p>PyGAD 2.19.1 Release Notes</p> <ol> <li>Add the <a href="https://github.com/cloudpipe/cloudpickle">cloudpickle</a> library as a dependency.</li> </ol> ahmedfgad tag:github.com,2008:Repository/909738453/2.18.3 2023-02-14T20:38:25Z 2.18.3 <p>Update conf.py</p> ahmedfgad tag:github.com,2008:Repository/909738453/2.18.2 2023-02-14T18:59:47Z 2.18.2 <p>PyGAD 2.18.2</p> ahmedfgad