@@ -53,7 +53,7 @@ def solve_duplicate_genes_randomly(self,
5353 else :
5454 temp_val = numpy .random .uniform (low = min_val ,
5555 high = max_val ,
56- size = 1 )
56+ size = 1 )[ 0 ]
5757 if mutation_by_replacement :
5858 pass
5959 else :
@@ -69,7 +69,7 @@ def solve_duplicate_genes_randomly(self,
6969 else :
7070 temp_val = numpy .random .uniform (low = min_val ,
7171 high = max_val ,
72- size = 1 )
72+ size = 1 )[ 0 ]
7373 if mutation_by_replacement :
7474 pass
7575 else :
@@ -229,7 +229,7 @@ def unique_int_gene_from_range(self,
229229 # Note that we already know that the data type is integer.
230230 all_gene_values = numpy .asarray (all_gene_values ,
231231 gene_type [gene_index ][0 ])
232-
232+
233233 values_to_select_from = list (set (all_gene_values ) - set (solution ))
234234
235235 if len (values_to_select_from ) == 0 :
@@ -347,12 +347,12 @@ def unique_gene_by_space(self,
347347
348348 value_from_space = numpy .random .uniform (low = low ,
349349 high = high ,
350- size = 1 )
350+ size = 1 )[ 0 ]
351351 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
352- if self .mutation_by_replacement :
353- pass
354- else :
355- value_from_space = solution [gene_idx ] + value_from_space
352+ # if self.mutation_by_replacement:
353+ # pass
354+ # else:
355+ # value_from_space = solution[gene_idx] + value_from_space
356356 else :
357357 if gene_type [gene_idx ][0 ] in pygad .GA .supported_int_types :
358358 if build_initial_pop == True :
@@ -378,12 +378,12 @@ def unique_gene_by_space(self,
378378
379379 value_from_space = numpy .random .uniform (low = low ,
380380 high = high ,
381- size = 1 )
381+ size = 1 )[ 0 ]
382382 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
383- if self .mutation_by_replacement :
384- pass
385- else :
386- value_from_space = solution [gene_idx ] + value_from_space
383+ # if self.mutation_by_replacement:
384+ # pass
385+ # else:
386+ # value_from_space = solution[gene_idx] + value_from_space
387387
388388 elif type (curr_gene_space ) is dict :
389389 if self .gene_type_single == True :
@@ -409,12 +409,12 @@ def unique_gene_by_space(self,
409409 else :
410410 value_from_space = numpy .random .uniform (low = curr_gene_space ['low' ],
411411 high = curr_gene_space ['high' ],
412- size = 1 )
412+ size = 1 )[ 0 ]
413413 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
414- if self .mutation_by_replacement :
415- pass
416- else :
417- value_from_space = solution [gene_idx ] + value_from_space
414+ # if self.mutation_by_replacement:
415+ # pass
416+ # else:
417+ # value_from_space = solution[gene_idx] + value_from_space
418418 else :
419419 # Use index 0 to return the type from the list (e.g. [int, None] or [float, 2]).
420420 if gene_type [gene_idx ][0 ] in pygad .GA .supported_int_types :
@@ -439,12 +439,12 @@ def unique_gene_by_space(self,
439439 else :
440440 value_from_space = numpy .random .uniform (low = curr_gene_space ['low' ],
441441 high = curr_gene_space ['high' ],
442- size = 1 )
442+ size = 1 )[ 0 ]
443443 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
444- if self .mutation_by_replacement :
445- pass
446- else :
447- value_from_space = solution [gene_idx ] + value_from_space
444+ # if self.mutation_by_replacement:
445+ # pass
446+ # else:
447+ # value_from_space = solution[gene_idx] + value_from_space
448448
449449 else :
450450 # Selecting a value randomly based on the current gene's space in the 'gene_space' attribute.
@@ -503,12 +503,12 @@ def unique_gene_by_space(self,
503503 else :
504504 value_from_space = numpy .random .uniform (low = self .gene_space ['low' ],
505505 high = self .gene_space ['high' ],
506- size = 1 )
506+ size = 1 )[ 0 ]
507507 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
508- if self .mutation_by_replacement :
509- pass
510- else :
511- value_from_space = solution [gene_idx ] + value_from_space
508+ # if self.mutation_by_replacement:
509+ # pass
510+ # else:
511+ # value_from_space = solution[gene_idx] + value_from_space
512512 else :
513513 if gene_type [gene_idx ][0 ] in pygad .GA .supported_int_types :
514514 if 'step' in self .gene_space .keys ():
@@ -533,12 +533,12 @@ def unique_gene_by_space(self,
533533 else :
534534 value_from_space = numpy .random .uniform (low = self .gene_space ['low' ],
535535 high = self .gene_space ['high' ],
536- size = 1 )
536+ size = 1 )[ 0 ]
537537 # TODO: Remove check for mutation_by_replacement when solving duplicates. Just replace the gene by the selected value from space.
538- if self .mutation_by_replacement :
539- pass
540- else :
541- value_from_space = solution [gene_idx ] + value_from_space
538+ # if self.mutation_by_replacement:
539+ # pass
540+ # else:
541+ # value_from_space = solution[gene_idx] + value_from_space
542542
543543 else :
544544 # If the space type is not of type dict, then a value is randomly selected from the gene_space attribute.
@@ -562,7 +562,7 @@ def unique_gene_by_space(self,
562562
563563 value_from_space = numpy .random .uniform (low = low ,
564564 high = high ,
565- size = 1 )
565+ size = 1 )[ 0 ]
566566
567567 # Similar to the round_genes() method in the pygad module,
568568 # Create a round_gene() method to round a single gene.
@@ -722,7 +722,7 @@ def unpack_gene_space(self,
722722 for idx in none_indices :
723723 random_value = numpy .random .uniform (low = self .random_mutation_min_val ,
724724 high = self .random_mutation_max_val ,
725- size = 1 )
725+ size = 1 )[ 0 ]
726726 gene_space_unpacked [space_idx ][idx ] = random_value
727727
728728 if self .gene_type_single == True : # self.gene_type_single
0 commit comments