R/calcIGD.R

Defines functions calcIGD

Documented in calcIGD

#' Inverted Generational Distance
#'
#' Calculate IGD
#'
#' @param Y Matrix of points in the objective space
#' @param Yref Matrix of Pareto-optimal reference points
#'
#' @return igd value (scalar)
#'
#' @export
calcIGD <- function(Y, Yref){
  igd <- sum(apply(Yref, 1,
                   function(yref, Y){
                     min(apply(Y, 1,
                               function(y, yref){
                                 sqrt(sum((y - yref) ^ 2))
                               },
                               yref = yref))
                   },
                   Y = Y)) / nrow(Yref)
  return(igd)
}

Try the MOEADr package in your browser

Any scripts or data that you put into this service are public.

MOEADr documentation built on Jan. 9, 2023, 1:24 a.m.