30 #ifndef SHARK_ALGORITHMS_DIRECTSEARCH_HYPERVOLUMECALCULATOR_MD_WFG_H 31 #define SHARK_ALGORITHMS_DIRECTSEARCH_HYPERVOLUMECALCULATOR_MD_WFG_H 57 template<
typename Set,
typename VectorType >
61 SIZE_CHECK( points.begin()->size() == refPoint.size() );
63 std::vector<VectorType>
set(points.begin(),points.end());
64 std::sort(
set.begin(),
set.end(), [ ](
VectorType const& x,
VectorType const& y){
return x.front() > y.front();});
65 return wfg(
set,refPoint);
70 template<
class Set,
class VectorType>
71 double wfg(Set
const& points,
VectorType const& refPoint)
const{
73 std::size_t n = points.size();
78 return boxVolume(points[0],refPoint);
81 double volume1 = boxVolume(points[0],refPoint);
82 double volume2 = boxVolume(points[1],refPoint);
83 double volume3 = boxVolume(max(points[0], points[1]),refPoint);
84 return volume1 + volume2 - volume3;
95 for(std::size_t i = 0; i != points.size(); ++i){
96 auto const& point = points[i];
98 std::vector<RealVector> pointset( points.begin()+i+1, points.end() );
99 limitSet(pointset,point);
101 double baseVol = boxVolume(point,refPoint);
102 volume += baseVol - wfg(pointset,refPoint);
108 template<
class Po
intset,
class Po
int>
109 void limitSet(Pointset& pointset, Point
const& point)
const{
110 for(
auto& p: pointset){
111 noalias(p) = max(p,point);
113 std::vector<std::size_t>
ranks(pointset.size());
115 std::size_t end = pointset.size();
128 pointset.erase(pointset.begin() +end, pointset.end());
129 std::sort( pointset.begin(), pointset.end(), [ ](Point
const& x, Point
const& y){
return x.front() > y.front();});
132 template<
class Po
int1,
class Po
int2>
133 double boxVolume(Point1
const& p,Point2
const& ref)
const {
135 for(std::size_t i = 0; i != ref.size(); ++i){
136 volume *= ref(i) - p(i);