Skip to content

Commit

Permalink
Apply automatic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka authored and github-actions[bot] committed Jul 19, 2023
1 parent 564bec0 commit 894d049
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
Binary file added extras/ObjectiveReduction_v1.zip
Binary file not shown.
51 changes: 51 additions & 0 deletions extras/hypeIndicatorExact.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
% HYPEINDICATOREXACT calculates the HypE fitness
% HYPEINDICATOREXACT( POINTS, BOUNDS, K ) calculates the HypE
% fitness for objective vectors POINTS.
%
% POINTS: objective vectors as rows, all to be minimized
% BOUNDS: reference point
% K: parameter of HypE
%
% Example: f = hypeIndicatorExact( [1 3; 3 1], [4 4], 1 )

function f = hypeIndicatorExact( points, bounds, k )
Ps = size(points,1);
if( k < 0 )
k = Ps;
end
actDim = size(points,2);
if( length(bounds) == 1 )
bounds = repmat(bounds, actDim, 1);
end
pvec = 1 : 1 : size(points,1);

alpha = [];
for i = 1 : k
j = 1:i-1;
alpha(i) = prod( (k-j) ./ (Ps - j ) )./i;
end

f = hypesub( size(points,1), points, actDim, bounds, pvec, alpha, k );

function [h] = hypesub( l, A, actDim, bounds, pvec, alpha, k )
h = zeros(1,l);
[S,i] = sortrows(A,actDim);
pvec = pvec(i);
for i = 1 : size(S,1)
if( i < size(S,1) )
extrusion = S( i+1, actDim ) - S( i, actDim );
else
extrusion = bounds(actDim) - S( i, actDim );
end
if( actDim == 1 )
if( i > k )
break;
end
if( alpha >= 0 )
h( pvec(1:i) ) = h( pvec(1:i) ) + extrusion * alpha(i);
end
elseif( extrusion > 0 )
h = h + extrusion*hypesub( l, S(1:i,:), actDim - 1, ...
bounds, pvec(1:i), alpha, k );
end
end
48 changes: 48 additions & 0 deletions extras/hypeIndicatorSampled.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
% HYPEINDICATORSAMPLED calculates the HypE fitness
% HYPEINDICATORSAMPLED( POINTS, BOUNDS, K, NROFSAMPLES )
% samples the HypE fitness values for objective vectors POINTS.
%
% POINTS: objective vectors as rows, all to be minimized
% BOUNDS: reference point
% K: parameter of HypE
% NROFSAMPLES: nr of samples to be used
%
% Example: f = hypeIndicatorExact( [1 3; 3 1], [4 4], 1, 10000 )

function F = hypeIndicatorSampled( points, bounds, k, nrOfSamples)
[nrP, dim] = size(points);
F = zeros(1,nrP);

alpha = zeros(1,nrP);
for i = 1 : k
j = 1:i-1;
alpha(i) = prod( (k-j) ./ (nrP - j ) )./i;
end


if( length(bounds) == 1 )
bounds = repmat( bounds,1, dim );
end

BoxL = min(points);

S = rand(nrOfSamples,dim)*diag( bounds - BoxL) ...
+ ones( nrOfSamples,dim)*diag(BoxL);

dominated = zeros( nrOfSamples, 1 );
for j = 1 : nrP
B = S - repmat(points(j,:),nrOfSamples,1);
ind = find( sum( B >= 0, 2) == dim);
dominated(ind) = dominated(ind) + 1;
end

for j = 1 : nrP
B = S - repmat(points(j,:),nrOfSamples,1);
ind = find( sum( B >= 0, 2) == dim);
x = dominated(ind);
F(j) = sum( alpha(x) );
end
F = F'*prod( bounds - BoxL)/nrOfSamples;



Binary file added extras/weightedHypervolume.zip
Binary file not shown.

0 comments on commit 894d049

Please sign in to comment.