def recalculate_fitnesses(ospace, objectives): ospace_sqdist = spea2._squared_distances(ospace) return np.asarray( [spea2._raw_strength_2(ospace, i) + spea2._density_estimator(ospace_sqdist, i) for i in range(len(ospace))] )
def recalculate_fitnesses(data, objectives): ospace_sqdist = spea2._squared_distances(data[:,-(1 + objectives):-1]) data[:,-1] = np.asarray([spea2._raw_strength_2(data[:,-(1 + objectives):-1], i) + spea2._density_estimator(ospace_sqdist, i) for i in range(len(data))])