@@ -829,9 +829,9 @@ def initialize_population(self, low, high, allow_duplicate_genes, mutation_by_re
829829 size = 1 ), dtype = self .gene_type [gene_idx ])[0 ]
830830 self .population [sol_idx , gene_idx ] = random .choice (self .gene_space [gene_idx ])
831831 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 ]
835835 elif type (self .gene_space [gene_idx ]) == type (None ):
836836 self .gene_space [gene_idx ] = numpy .asarray (numpy .random .uniform (low = low ,
837837 high = high ,
@@ -853,7 +853,7 @@ def initialize_population(self, low, high, allow_duplicate_genes, mutation_by_re
853853 self .population = numpy .asarray (numpy .random .uniform (low = self .gene_space ['low' ],
854854 high = self .gene_space ['high' ],
855855 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.
857857 else :
858858 self .population = numpy .asarray (numpy .random .choice (self .gene_space ,
859859 size = self .pop_size ),
0 commit comments