32 #ifndef SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_REFERENCE_VECTOR_ADAPTATION_H 33 #define SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_REFERENCE_VECTOR_ADAPTATION_H 50 template <
typename Indiv
idualType>
57 std::vector<IndividualType>
const & population,
58 RealMatrix & referenceVectors,
59 RealVector & minAngles)
62 const std::size_t sz = f.size();
63 const std::size_t
w = f[0].size();
65 for(std::size_t i = 0; i <
w; ++i)
67 double max = std::numeric_limits<double>::min();
68 double min = std::numeric_limits<double>::max();
69 for(std::size_t j = 0; j < sz; ++j)
71 max = std::max(max, f[j][i]);
72 min = std::min(min, f[j][i]);
75 diff[i] = (d == 0) ? 1 : d;
78 for(std::size_t i = 0; i < referenceVectors.size1(); ++i)
80 row(referenceVectors, i) /= norm_2(row(referenceVectors, i));
89 RealMatrix
const & referenceVectors,
90 RealVector & minAngles)
92 const std::size_t s = referenceVectors.size1();
93 const RealMatrix m = acos(prod(referenceVectors,
94 trans(referenceVectors))) +
95 to_diagonal(RealVector(s, 1e10));
96 for(std::size_t i = 0; i < s; ++i)
98 minAngles[i] = min(row(m, i));
102 template <
typename Archive>
116 #endif // SHARK_ALGORITHMS_DIRECT_SEARCH_OPERATORS_REFERENCE_VECTOR_ADAPTATION_H