|
self.utils.fast_nondominated_sort(neighbors) |
|
|
|
cnt = 0 |
|
for front in neighbors.fronts: |
|
self.utils.calculate_crowding_distance(front) |
|
cnt += 1 |
|
|
|
#------分析front 0中的解,满足constraint的保留到final solution,并去掉。-------- |
|
to_remove = Population() |
|
to_remove.extend(ind for ind in neighbors if ind.constraint[0] == self.max_sensor) |
|
population_final.extend(ind for ind in neighbors.fronts[0] if ind.constraint[0] == self.max_sensor) |
|
|
|
# print('population_final:',len(population_final)) |
|
|
|
for ind in to_remove: |
|
neighbors.remove(ind) |
Filter solutions through constraints before non-dominated sorting is more efficient.
opt-greedy/CODE/greedy/evolution.py
Lines 102 to 117 in 3c11ad7
Filter solutions through constraints before non-dominated sorting is more efficient.