@@ -829,9 +829,9 @@ def initialize_population(self, low, high, allow_duplicate_genes, mutation_by_re
829
829
size = 1 ), dtype = self .gene_type [gene_idx ])[0 ]
830
830
self .population [sol_idx , gene_idx ] = random .choice (self .gene_space [gene_idx ])
831
831
elif type (self .gene_space [gene_idx ]) is dict :
832
- self .population [sol_idx , gene_idx ] = numpy .random .uniform (low = self .gene_space [gene_idx ]['low' ],
833
- high = self .gene_space [gene_idx ]['high' ],
834
- size = 1 )
832
+ self .population [sol_idx , gene_idx ] = numpy .asarray ( numpy . random .uniform (low = self .gene_space [gene_idx ]['low' ],
833
+ high = self .gene_space [gene_idx ]['high' ],
834
+ size = 1 ), dtype = self . gene_type [ gene_idx ])[ 0 ]
835
835
elif type (self .gene_space [gene_idx ]) == type (None ):
836
836
self .gene_space [gene_idx ] = numpy .asarray (numpy .random .uniform (low = low ,
837
837
high = high ,
@@ -853,7 +853,7 @@ def initialize_population(self, low, high, allow_duplicate_genes, mutation_by_re
853
853
self .population = numpy .asarray (numpy .random .uniform (low = self .gene_space ['low' ],
854
854
high = self .gene_space ['high' ],
855
855
size = self .pop_size ),
856
- dtype = self .gene_type ) # A NumPy array holding the initial population.
856
+ dtype = self .gene_type ) # A NumPy array holding the initial population.
857
857
else :
858
858
self .population = numpy .asarray (numpy .random .choice (self .gene_space ,
859
859
size = self .pop_size ),
0 commit comments