@@ -71,7 +71,7 @@ def indices_to_values(individual_indices, tune_params):
7171 values = []
7272 for dim , idx in enumerate (individual_indices ):
7373 values .append (tune_params_list [dim ][idx ])
74- return np . array ( values )
74+ return values
7575
7676
7777def parse_method (method ):
@@ -104,15 +104,15 @@ def generate_population(tune_params, max_idx, popsize, searchspace, constraint_a
104104 if constraint_aware :
105105 samples = LatinHypercube (len (tune_params )).integers (l_bounds = 0 , u_bounds = max_idx , n = popsize , endpoint = True )
106106 population = [indices_to_values (sample , tune_params ) for sample in samples ]
107- population = np . array ( [repair (individual , searchspace ) for individual in population ])
107+ population = [repair (individual , searchspace ) for individual in population ]
108108 else :
109109 population = []
110110 for _ in range (popsize ):
111111 ind = []
112112 for key in tune_params :
113113 ind .append (random .choice (tune_params [key ]))
114114 population .append (ind )
115- population = np . array ( population )
115+ population = population
116116 return population
117117
118118
@@ -354,7 +354,7 @@ def binomial_crossover(donor_vector, target, CR):
354354 # Apply crossover
355355 trial_vector [crossover_points ] = donor_vector [crossover_points ]
356356
357- return trial_vector
357+ return list ( trial_vector )
358358
359359
360360def exponential_crossover (donor_vector , target , CR ):
@@ -379,7 +379,7 @@ def exponential_crossover(donor_vector, target, CR):
379379 trial_idx [crossover_point ] = donor_vector [crossover_point ]
380380 l += 1
381381
382- return trial_idx
382+ return list ( trial_idx )
383383
384384
385385def repair (trial_vector , searchspace ):
@@ -394,7 +394,7 @@ def repair(trial_vector, searchspace):
394394
395395 # if we have found valid neighboring configurations, select one at random
396396 if len (neighbors ) > 0 :
397- new_trial_vector = np . array ( list (random .choice (neighbors ) ))
397+ new_trial_vector = list (random .choice (neighbors ))
398398 print (f"Differential evolution resulted in invalid config { trial_vector = } , repaired to { new_trial_vector = } " )
399399 return new_trial_vector
400400
0 commit comments