28 #ifndef SHARK_ALGORITHMS_DIRECTSEARCH_OPERATORS_DOMINATION_FASTNONDOMINATEDSORT_H 29 #define SHARK_ALGORITHMS_DIRECTSEARCH_OPERATORS_DOMINATION_FASTNONDOMINATEDSORT_H 48 template<
class Po
intRange,
class RankRange>
52 std::vector<std::vector<std::size_t> > s(points.size());
54 std::vector<std::size_t> numberOfDominatingPoints(points.size(), 0);
56 std::vector<std::size_t> front;
57 for (std::size_t i = 0; i < points.size(); i++) {
60 for (std::size_t j = 0; j < points.size(); j++) {
66 numberOfDominatingPoints[i]++;
69 if (numberOfDominatingPoints[i] == 0){
75 unsigned frontCounter = 2;
76 std::vector<std::size_t> nextFront;
81 while (!front.empty()) {
84 for(std::size_t element = 0; element != front.size(); ++element) {
86 std::vector<std::size_t>
const& dominatedPoints = s[front[element]];
87 for (std::size_t j = 0; j != dominatedPoints.size(); ++j){
88 std::size_t point = dominatedPoints[j];
89 numberOfDominatingPoints[point]--;
91 if (numberOfDominatingPoints[point] == 0){
92 nextFront.push_back(point);
93 ranks[point] = frontCounter;
99 front.swap(nextFront);