R/feature_chull.R

Defines functions feature_chull

Documented in feature_chull

#' Convex hull features.
#'
#' Determines the area of the convex hull and the
#' ratio of the cities which lie on the convex hull in
#' the euklidean space.
#'
#' @param x [\code{\link{tsp_instance}}]\cr
#'   TSP instance.
#' @return [\code{list}].
#' @export
feature_chull = function(x) {
    coords = x$coords
    hull = chull(coords[, 1], coords[, 2])
    area = areapl(coords[hull, ])
    list(
        chull_area = area,
	   chull_points_on_hull = length(hull) / nrow(coords)
    )
}

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.