Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 14, 2025

Bumps pygad from 3.3.1 to 3.5.0.

Release notes

Sourced from pygad's releases.

PyGAD-3.5.0

  1. Fix a bug when minus sign (-) is used inside the stop_criteria parameter for multi-objective problems. ahmedfgad/GeneticAlgorithmPython#314 ahmedfgad/GeneticAlgorithmPython#323
  2. Fix a bug when the stop_criteria parameter is passed as an iterable (e.g. list) for multi-objective problems (e.g. ['reach_50_60', 'reach_20, 40']). ahmedfgad/GeneticAlgorithmPython#314
  3. Call the get_matplotlib() function from the plot_genes() method inside the pygad.visualize.plot.Plot class to import the matplotlib library. ahmedfgad/GeneticAlgorithmPython#315
  4. Create a new helper method called select_unique_value() inside the pygad/helper/unique.py script to select a unique gene from an array of values.
  5. Create a new helper method called get_random_mutation_range() inside the pygad/utils/mutation.py script that returns the random mutation range (min and max) for a single gene by its index.
  6. Create a new helper method called change_random_mutation_value_dtype inside the pygad/utils/mutation.py script that changes the data type of the value used to apply random mutation.
  7. Create a new helper method called round_random_mutation_value() inside the pygad/utils/mutation.py script that rounds the value used to apply random mutation.
  8. Create the pygad/helper/misc.py script with a class called Helper that has the following helper methods:
    1. change_population_dtype_and_round(): For each gene in the population, round the gene value and change the data type.
    2. change_gene_dtype_and_round(): Round the change the data type of a single gene.
    3. mutation_change_gene_dtype_and_round(): Decides whether mutation is done by replacement or not. Then it rounds and change the data type of the new gene value.
    4. validate_gene_constraint_callable_output(): Validates the output of the user-defined callable/function that checks whether the gene constraint defined in the gene_constraint parameter is satisfied or not.
    5. get_gene_dtype(): Returns the gene data type from the gene_type instance attribute.
    6. get_random_mutation_range(): Returns the random mutation range using the random_mutation_min_val and random_mutation_min_val instance attributes.
    7. get_initial_population_range(): Returns the initial population values range using the init_range_low and init_range_high instance attributes.
    8. generate_gene_value_from_space(): Generates/selects a value for a gene using the gene_space instance attribute.
    9. generate_gene_value_randomly(): Generates a random value for the gene. Only used if gene_space is None.
    10. generate_gene_value(): Generates a value for the gene. It checks whether gene_space is None and calls either generate_gene_value_randomly() or generate_gene_value_from_space().
    11. filter_gene_values_by_constraint(): Receives a list of values for a gene. Then it filters such values using the gene constraint.
    12. get_valid_gene_constraint_values(): Selects one valid gene value that satisfy the gene constraint. It simply calls generate_gene_value() to generate some gene values then it filters such values using filter_gene_values_by_constraint().
  9. Create a new helper method called mutation_process_random_value() inside the pygad/utils/mutation.py script that generates constrained random values for mutation. It calls either generate_gene_value() or get_valid_gene_constraint_values() based on whether the gene_constraint parameter is used or not.
  10. A new parameter called gene_constraint is added. It accepts a list of callables (i.e. functions) acting as constraints for the gene values. Before selecting a value for a gene, the callable is called to ensure the candidate value is valid. Check the [Gene Constraint](https://pygad.readthedocs.io/en/latest/pygad_more.html#gene-constraint) section for more information. ahmedfgad/GeneticAlgorithmPython#119
  11. A new parameter called sample_size is added. To select a gene value that respects a constraint, this variable defines the size of the sample from which a value is selected randomly. Useful if either allow_duplicate_genes or gene_constraint is used. An instance attribute of the same name is created in the instances of the pygad.GA class. Check the [sample_size Parameter](https://pygad.readthedocs.io/en/latest/pygad_more.html#sample-size-parameter) section for more information.
  12. Use the sample_size parameter instead of num_trials in the methods solve_duplicate_genes_randomly() and unique_float_gene_from_range() inside the pygad/helper/unique.py script. It is the maximum number of values to generate as the search space when looking for a unique float value out of a range.
  13. Fixed a bug in population initialization when allow_duplicate_genes=False. Previously, gene values were checked for duplicates before rounding, which could allow near-duplicates like 7.61 and 7.62 to pass. After rounding (e.g., both becoming 7.6), this resulted in unintended duplicates. The fix ensures gene values are now rounded before duplicate checks, preventing such cases.
  14. More tests are created.
  15. More examples are created.
  16. Edited the sort_solutions_nsga2() method in the pygad/utils/nsga2.py script to accept an optional parameter called find_best_solution when calling this method just to find the best solution.
  17. Fixed a bug while applying the non-dominated sorting in the get_non_dominated_set() method inside the pygad/utils/nsga2.py script. It was swapping the non-dominated and dominated sets. In other words, it used the non-dominated set as if it is the dominated set and vice versa. All the calls to this method were edited accordingly. ahmedfgad/GeneticAlgorithmPython#320.
  18. Fix a bug retrieving in the best_solution() method when retrieving the best solution for multi-objective problems. ahmedfgad/GeneticAlgorithmPython#331

PyGAD-3.4.0

  1. The delay_after_gen parameter is removed from the pygad.GA class constructor. As a result, it is no longer an attribute of the pygad.GA class instances. To add a delay after each generation, apply it inside the on_generation callback. ahmedfgad/GeneticAlgorithmPython#283
  2. In the single_point_crossover() method of the pygad.utils.crossover.Crossover class, all the random crossover points are returned before the for loop. This is by calling the numpy.random.randint() function only once before the loop to generate all the K points (where K is the offspring size). This is compared to calling the numpy.random.randint() function inside the for loop K times, once for each individual offspring.
  3. Bug fix in the examples/example_custom_operators.py script. ahmedfgad/GeneticAlgorithmPython#285
  4. While making prediction using the pygad.torchga.predict() function, no gradients are calculated.
  5. The gene_type parameter of the pygad.helper.unique.Unique.unique_int_gene_from_range() method accepts the type of the current gene only instead of the full gene_type list.
  6. Created a new method called unique_float_gene_from_range() inside the pygad.helper.unique.Unique class to find a unique floating-point number from a range.
  7. Fix a bug in the pygad.helper.unique.Unique.unique_gene_by_space() method to return the numeric value only instead of a NumPy array.
  8. Refactoring the pygad/helper/unique.py script to remove duplicate codes and reformatting the docstrings.
  9. The plot_pareto_front_curve() method added to the pygad.visualize.plot.Plot class to visualize the Pareto front for multi-objective problems. It only supports 2 objectives. ahmedfgad/GeneticAlgorithmPython#279
  10. Fix a bug converting a nested NumPy array to a nested list. ahmedfgad/GeneticAlgorithmPython#300
  11. The Matplotlib library is only imported when a method inside the pygad/visualize/plot.py script is used. This is more efficient than using import matplotlib.pyplot at the module level as this causes it to be imported when pygad is imported even when it is not needed. ahmedfgad/GeneticAlgorithmPython#292
  12. Fix a bug when minus sign (-) is used inside the stop_criteria parameter (e.g. stop_criteria=["saturate_10", "reach_-0.5"]). ahmedfgad/GeneticAlgorithmPython#296
  13. Make sure self.best_solutions is a list of lists inside the cal_pop_fitness method. ahmedfgad/GeneticAlgorithmPython#293
  14. Fix a bug where the cal_pop_fitness() method was using the previous_generation_fitness attribute to return the parents fitness. This instance attribute was not using the fitness of the latest population, instead the fitness of the population before the last one. The issue is solved by updating the previous_generation_fitness attribute to the latest population fitness before the GA completes. ahmedfgad/GeneticAlgorithmPython#291
Commits
  • 9ac7527 Merge pull request #334 from ahmedfgad/github-actions
  • 19250a9 Getting PyGAD 3.5.0 Ready
  • 83f0bed Merge pull request #333 from ahmedfgad/github-actions
  • eccdc6c Merge pull request #332 from ahmedfgad/master
  • a5ef680 Merge pull request #331 from Crylab/master
  • 9ac72f6 Clean repo
  • 3c7ed23 Solve a bug in NSGA2 tournament selection of parents
  • b2ac512 fix: keep original code + fix for multi-objective optimization
  • 7e068dd fix: best_solution for multi-objective optimization
  • c4e1164 Merge pull request #329 from ahmedfgad/master
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [pygad](https://github.com/ahmedfgad/GeneticAlgorithmPython) from 3.3.1 to 3.5.0.
- [Release notes](https://github.com/ahmedfgad/GeneticAlgorithmPython/releases)
- [Commits](ahmedfgad/GeneticAlgorithmPython@3.3.1...3.5.0)

---
updated-dependencies:
- dependency-name: pygad
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jul 14, 2025
@dependabot dependabot bot requested a review from crismunoz as a code owner July 14, 2025 18:18
@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant