R/performance_metrics.R

Defines functions generational_distance

Documented in generational_distance

#' @export
generational_distance <- function(fitness, reference_points) {
    popSize <- nrow(fitness)
    distances <- rep(Inf, popSize)
    aux <- c()
    for (i in 1:popSize) {
        for (j in 1:popSize) {
            aux <- dist(rbind(fitness[i, ], reference_points[j, ]),
                        method = "euclidean")
            if (aux < distances[i]) {
                distances[i] <- aux
            }
        }
        aux <- c()
    }
    distances <- sum(distances) / nrow(reference_points)

    return(distances)
}

Try the rmoo package in your browser

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

rmoo documentation built on Sept. 24, 2022, 9:05 a.m.