Skip to content

Commit

Permalink
Merge branch 'master' into github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedfgad authored Jan 29, 2024
2 parents f83c973 + e946f04 commit b3183c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
9 changes: 5 additions & 4 deletions docs/source/pygad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1037,10 +1037,11 @@ Let's discuss how to do each of these steps.
Preparing the ``fitness_func`` Parameter
-----------------------------------------

Even though some steps in the genetic algorithm pipeline can work the
same regardless of the problem being solved, one critical step is the
calculation of the fitness value. There is no unique way of calculating
the fitness value and it changes from one problem to another.
Even though some steps in the genetic algorithm pipeline can
work the same regardless of the problem being solved, one critical step
is the calculation of the fitness value. There is no unique way of
calculating the fitness value and it changes from one problem to
another.

PyGAD has a parameter called ``fitness_func`` that allows the user to
specify a custom function/method to use when calculating the fitness.
Expand Down
1 change: 0 additions & 1 deletion docs/source/pygad_more.rst
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ After running the code again, it will find the same result.
0.04872203136549972
Continue without Losing Progress
================================

In `PyGAD
2.18.0 <https://pygad.readthedocs.io/en/latest/releases.html#pygad-2-18-0>`__,
Expand Down
6 changes: 3 additions & 3 deletions pygad/pygad.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def __init__(self,
if self.mutation_probability is None:
if not self.suppress_warnings:
warnings.warn(
f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resutled in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resulted in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
mutation_num_genes = 1

elif type(mutation_percent_genes) in GA.supported_int_float_types:
Expand All @@ -745,7 +745,7 @@ def __init__(self,
if mutation_num_genes == 0:
if self.mutation_probability is None:
if not self.suppress_warnings:
warnings.warn(f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resutled in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
warnings.warn(f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resulted in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
mutation_num_genes = 1
else:
self.valid_parameters = False
Expand All @@ -771,7 +771,7 @@ def __init__(self,
# Based on the mutation percentage of genes, if the number of selected genes for mutation is less than the least possible value which is 1, then the number will be set to 1.
if mutation_num_genes[idx] == 0:
if not self.suppress_warnings:
warnings.warn(f"The percentage of genes to mutate ({mutation_percent_genes[idx]}) resutled in selecting ({mutation_num_genes[idx]}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
warnings.warn(f"The percentage of genes to mutate ({mutation_percent_genes[idx]}) resulted in selecting ({mutation_num_genes[idx]}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
mutation_num_genes[idx] = 1
if mutation_percent_genes[0] < mutation_percent_genes[1]:
if not self.suppress_warnings:
Expand Down

0 comments on commit b3183c2

Please sign in to comment.