@@ -70,7 +70,7 @@ def indices_to_values(individual_indices, tune_params):
70
70
values = []
71
71
for dim , idx in enumerate (individual_indices ):
72
72
values .append (tune_params_list [dim ][idx ])
73
- return np . array ( values )
73
+ return values
74
74
75
75
76
76
def parse_method (method ):
@@ -103,15 +103,15 @@ def generate_population(tune_params, max_idx, popsize, searchspace, constraint_a
103
103
if constraint_aware :
104
104
samples = LatinHypercube (len (tune_params )).integers (l_bounds = 0 , u_bounds = max_idx , n = popsize , endpoint = True )
105
105
population = [indices_to_values (sample , tune_params ) for sample in samples ]
106
- population = np . array ( [repair (individual , searchspace ) for individual in population ])
106
+ population = [repair (individual , searchspace ) for individual in population ]
107
107
else :
108
108
population = []
109
109
for _ in range (popsize ):
110
110
ind = []
111
111
for key in tune_params :
112
112
ind .append (random .choice (tune_params [key ]))
113
113
population .append (ind )
114
- population = np . array ( population )
114
+ population = population
115
115
return population
116
116
117
117
@@ -353,7 +353,7 @@ def binomial_crossover(donor_vector, target, CR):
353
353
# Apply crossover
354
354
trial_vector [crossover_points ] = donor_vector [crossover_points ]
355
355
356
- return trial_vector
356
+ return list ( trial_vector )
357
357
358
358
359
359
def exponential_crossover (donor_vector , target , CR ):
@@ -378,7 +378,7 @@ def exponential_crossover(donor_vector, target, CR):
378
378
trial_idx [crossover_point ] = donor_vector [crossover_point ]
379
379
l += 1
380
380
381
- return trial_idx
381
+ return list ( trial_idx )
382
382
383
383
384
384
def repair (trial_vector , searchspace ):
@@ -393,7 +393,7 @@ def repair(trial_vector, searchspace):
393
393
394
394
# if we have found valid neighboring configurations, select one at random
395
395
if len (neighbors ) > 0 :
396
- new_trial_vector = np . array ( list (random .choice (neighbors ) ))
396
+ new_trial_vector = list (random .choice (neighbors ))
397
397
print (f"Differential evolution resulted in invalid config { trial_vector = } , repaired to { new_trial_vector = } " )
398
398
return new_trial_vector
399
399
0 commit comments