Skip to content

Commit

Permalink
add dominates and isDominated
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbossek committed Apr 29, 2015
1 parent 2feed4c commit 3b05616
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ S3method(is.supported,ecr_operator)
S3method(print,ecr_control)
S3method(print,ecr_result)
export(doTheEvolution)
export(dominates)
export(getBestIndividual)
export(getOperatorCheckFunction)
export(getOperatorDefaultParameters)
export(getOperatorName)
export(getSupportedRepresentations)
export(is.supported)
export(isDominated)
export(isEcrOperator)
export(makeBinaryGenerator)
export(makeBitFlipMutator)
Expand Down
12 changes: 12 additions & 0 deletions R/dominates.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' Check if a vector dominates another vector.
#'
#' @param x [\code{numeric}]\cr
#' First vector.
#' @param y [\code{numeric}]\cr
#' Second vector.
#' @return [\code{logical(1)}] Does \code{x} dominate \code{y}?
#' @export
dominates = function(x, y) {
stopifnot(length(x) == length(y))
return(all(x <= y) && any(x < y))
}
12 changes: 12 additions & 0 deletions R/isDominated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' Check whether a vector is dominated by another vector.
#'
#' @param x [\code{numeric}]\cr
#' First vector.
#' @param y [\code{numeric}]\cr
#' Second vector.
#' @return [\code{logical(1)}] Returns \code{TRUE} if \code{x} is dominated by
#' \code{y} and \code{FALSE} otherwise.
#' @export
isDominated = function(x, y) {
return(dominates(y, x))
}
22 changes: 22 additions & 0 deletions man/dominates.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/dominates.R
\name{dominates}
\alias{dominates}
\title{Check if a vector dominates another vector.}
\usage{
dominates(x, y)
}
\arguments{
\item{x}{[\code{numeric}]\cr
First vector.}

\item{y}{[\code{numeric}]\cr
Second vector.}
}
\value{
[\code{logical(1)}] Does \code{x} dominate \code{y}?
}
\description{
Check if a vector dominates another vector.
}

23 changes: 23 additions & 0 deletions man/isDominated.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/isDominated.R
\name{isDominated}
\alias{isDominated}
\title{Check whether a vector is dominated by another vector.}
\usage{
isDominated(x, y)
}
\arguments{
\item{x}{[\code{numeric}]\cr
First vector.}

\item{y}{[\code{numeric}]\cr
Second vector.}
}
\value{
[\code{logical(1)}] Returns \code{TRUE} if \code{x} is dominated by
\code{y} and \code{FALSE} otherwise.
}
\description{
Check whether a vector is dominated by another vector.
}

0 comments on commit 3b05616

Please sign in to comment.