Skip to content

Commit 260be03

Browse files
committed
Update validated parent selection params
1 parent 0a518fe commit 260be03

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pygad/utils/validation.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,9 @@ def _validate_parent_selection(self,
870870
self.num_offspring = self.sol_per_pop - self.keep_parents
871871
else:
872872
self.num_offspring = self.sol_per_pop - self.keep_elitism
873-
873+
874+
return parent_selection_type
875+
874876
def _validate_fitness_func(self,
875877
fitness_func,
876878
fitness_batch_size):
@@ -1326,7 +1328,7 @@ def _validate_footer(self,
13261328
self.valid_parameters = True
13271329

13281330
# Parameters of the genetic algorithm.
1329-
self.parent_selection_type = parent_selection_type.lower()
1331+
self.parent_selection_type = parent_selection_type
13301332

13311333
# Parameters of the mutation operation.
13321334
self.mutation_percent_genes = mutation_percent_genes
@@ -1467,10 +1469,10 @@ def validate_parameters(self,
14671469
mutation_num_genes,
14681470
mutation_percent_genes)
14691471

1470-
self._validate_parent_selection(parent_selection_type,
1471-
K_tournament,
1472-
keep_parents,
1473-
keep_elitism)
1472+
parent_selection_type = self._validate_parent_selection(parent_selection_type,
1473+
K_tournament,
1474+
keep_parents,
1475+
keep_elitism)
14741476

14751477
self._validate_fitness_func(fitness_func,
14761478
fitness_batch_size)

0 commit comments

Comments
 (0)