R/feature_nnds.R

Defines functions feature_nnds

Documented in feature_nnds

#' Nearest neighbor features.
#'
#' Statistics describing the distribution of distances of each city
#' to its nearest neighbor.
#'
#' @param x [\code{\link{tsp_instance}}]\cr
#'   TSP instance.
#' @return [\code{list}].
#' @export
feature_nnds = function(x) {
  d = x$dists
  diag(d) = Inf
  numvec_feature_statistics(apply(d, 1, min), "nnds")
}

Try the tspmeta package in your browser

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

tspmeta documentation built on May 2, 2019, 2:43 a.m.