@@ -271,7 +271,7 @@ def evolve(self, pop, hist_cr, hist_f, archive, arc_ind_cnt, task, **_kwargs):
271
271
272
272
"""
273
273
new_pop = objects_to_array ([self .gen_ind_params (xi , hist_cr , hist_f ) for xi in pop ])
274
- p_num = np . int_ ( np . around ( len (pop ) * self .pbest_factor ) )
274
+ p_num = round ( len (pop ) * self .pbest_factor )
275
275
if p_num < 2 :
276
276
p_num = 2
277
277
# cr and f for mutation are computed
@@ -309,7 +309,7 @@ def selection(self, pop, new_pop, archive, arc_ind_cnt, best_x, best_fitness, ta
309
309
success_f = np .asarray ([]) # array for storing successful f values
310
310
success_cr = np .asarray ([]) # array for storing successful cr values
311
311
fitness_diff = np .asarray ([]) # array for storing the difference of fitness of new individuals
312
- archive_size = np . int_ ( np . around ( len (pop ) * self .extern_arc_rate ) )
312
+ archive_size = round ( len (pop ) * self .extern_arc_rate )
313
313
arr = np .copy (pop )
314
314
for i , vi in enumerate (new_pop ):
315
315
if vi .f == pop [i ].f :
@@ -380,7 +380,7 @@ def init_population(self, task):
380
380
h_mem_f = np .full (self .hist_mem_size , 0.5 )
381
381
# all values in the historical memory for parameters f and cr are initialized to 0.5
382
382
k = 0 # the starting memory position is set to 1
383
- arc_size = np . int_ ( np . around ( self .population_size * self .extern_arc_rate ) )
383
+ arc_size = round ( self .population_size * self .extern_arc_rate )
384
384
archive = np .zeros ((arc_size , task .dimension ))
385
385
# the external archive of max size pop_size * arc_rate is initialized
386
386
arc_ind_cnt = 0 # the number of archive elements is set to 0
@@ -514,7 +514,7 @@ def post_selection(self, pop, arc, arc_ind_cnt, task, xb, fxb, **kwargs):
514
514
max_nfe = task .max_evals
515
515
nfe = task .evals
516
516
517
- next_pop_size = np . int_ ( np . around (((( 4.0 - self .population_size ) / np . float_ ( max_nfe )) * nfe ) + self .population_size ) )
517
+ next_pop_size = round ( (((4.0 - self .population_size ) / max_nfe ) * nfe ) + self .population_size )
518
518
519
519
if next_pop_size < 4 :
520
520
next_pop_size = 4
@@ -529,7 +529,7 @@ def post_selection(self, pop, arc, arc_ind_cnt, task, xb, fxb, **kwargs):
529
529
worst = j if e .f > pop [worst ].f else worst
530
530
pop = np .delete (pop , worst )
531
531
532
- next_arc_size = np . int_ (next_pop_size * self .extern_arc_rate ) # the size of the new archive
532
+ next_arc_size = int (next_pop_size * self .extern_arc_rate ) # the size of the new archive
533
533
if arc_ind_cnt > next_arc_size :
534
534
arc_ind_cnt = next_arc_size
535
535
0 commit comments