Skip to content

Commit 0a518fe

Browse files
committed
Update validate mutation params
1 parent 30c8e3c commit 0a518fe

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

pygad/utils/validation.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ def _validate_mutation(self,
753753
if (self.mutation_type is None) and (self.crossover_type is None):
754754
if not self.suppress_warnings:
755755
warnings.warn("The 2 parameters mutation_type and crossover_type are None. This disables any type of evolution the genetic algorithm can make. As a result, the genetic algorithm cannot find a better solution that the best solution in the initial population.")
756-
756+
return mutation_num_genes, mutation_percent_genes
757+
757758
def _validate_parent_selection(self,
758759
parent_selection_type,
759760
K_tournament,
@@ -1325,7 +1326,7 @@ def _validate_footer(self,
13251326
self.valid_parameters = True
13261327

13271328
# Parameters of the genetic algorithm.
1328-
self.parent_selection_type = parent_selection_type
1329+
self.parent_selection_type = parent_selection_type.lower()
13291330

13301331
# Parameters of the mutation operation.
13311332
self.mutation_percent_genes = mutation_percent_genes
@@ -1461,10 +1462,10 @@ def validate_parameters(self,
14611462
self._validate_crossover(crossover_type,
14621463
crossover_probability)
14631464

1464-
self._validate_mutation(mutation_type,
1465-
mutation_probability,
1466-
mutation_num_genes,
1467-
mutation_percent_genes)
1465+
mutation_num_genes, mutation_percent_genes = self._validate_mutation(mutation_type,
1466+
mutation_probability,
1467+
mutation_num_genes,
1468+
mutation_percent_genes)
14681469

14691470
self._validate_parent_selection(parent_selection_type,
14701471
K_tournament,

0 commit comments

Comments
 (0)