-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add function to compute dominated hypervolume (not finished)
- Loading branch information
1 parent
7318a75
commit ee9a8b1
Showing
16 changed files
with
1,473 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ Imports: | |
Suggests: | ||
testthat (>= 0.9.1) | ||
ByteCompile: yes | ||
LazyData: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#' Computation of the dominated hypervolume. | ||
#' | ||
#' Given a set of points \code{x}, this function computes the dominated hypervolume | ||
#' of the points regarding the reference point \code{ref.point}. If the latter | ||
#' is not provided, one is automatically determined by computing the maximum | ||
#' in each dimension. | ||
#' | ||
#' @param x [\code{matrix}]\cr | ||
#' Matrix of points. | ||
#' @param ref.point [\code{numeric} | \code{NULL}]\cr | ||
#' Reference point. Set to the maximum in each dimension by default if not provided. | ||
#' @return [\code{numeric(1)}] Dominated hypervolume. | ||
#' @export | ||
computeDominatedHypervolume = function(x, ref.point = NULL) { | ||
# sanity checks | ||
assertMatrix(x, mode = "numeric", any.missing = FALSE) | ||
if (any(is.infinite(x))) { | ||
warningf("Set of points contains infinite %i values.", which(is.infinite(x))) | ||
return(NaN) | ||
} | ||
|
||
if (is.null(ref.point)) { | ||
ref.point = apply(x, 1, max) | ||
} | ||
|
||
if (length(ref.point) != nrow(x)) { | ||
stopf("Set of points and reference point need to have the same dimension, but | ||
set of points has dimension %i and reference points has dimension %i.", nrow(x), length(ref.point)) | ||
} | ||
|
||
if (any(is.infinite(ref.point))) { | ||
warningf("Reference point contains infinite %i values.", which(is.infinite(ref.point))) | ||
return(NaN) | ||
} | ||
|
||
return(.Call("computeDominatedHypervolumeC", as.numeric(x), ref.point)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
#' @import parallelMap | ||
#' @import reshape2 | ||
#' @import gridExtra | ||
NULL | ||
#' @useDynLib ecr | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
% Generated by roxygen2 (4.1.1): do not edit by hand | ||
% Please edit documentation in R/computeDominatedHypervolume.R | ||
\name{computeDominatedHypervolume} | ||
\alias{computeDominatedHypervolume} | ||
\title{Computation of the dominated hypervolume.} | ||
\usage{ | ||
computeDominatedHypervolume(x, ref.point = NULL) | ||
} | ||
\arguments{ | ||
\item{x}{[\code{matrix}]\cr | ||
Matrix of points.} | ||
|
||
\item{ref.point}{[\code{numeric} | \code{NULL}]\cr | ||
Reference point. Set to the maximum in each dimension by default if not provided.} | ||
} | ||
\value{ | ||
[\code{numeric(1)}] Dominated hypervolume. | ||
} | ||
\description{ | ||
Given a set of points \code{x}, this function computes the dominated hypervolume | ||
of the points regarding the reference point \code{ref.point}. If the latter | ||
is not provided, one is automatically determined by computing the maximum | ||
in each dimension. | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
all: $(SHLIB) | ||
|
||
hv.o: hv.c | ||
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DVARIANT=4 -c -o hv.o hv.c | ||
|
||
avl.o: avl.c | ||
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DVARIANT=4 -c -o avl.o avl.c |
Oops, something went wrong.