Skip to contents

Chooses p sites minimising sum_i w_i min_j d_ij: exact enumeration when choose(m, p) <= max_enum, otherwise greedy addition plus Teitz-Bart vertex substitution.

Usage

PMedian(
  p,
  demand = NULL,
  sites = NULL,
  dist = NULL,
  weights = NULL,
  max_enum = 2e+05
)

Arguments

p

Number of sites.

demand, sites

Coordinate matrices (sites default to demand).

dist

Demand-by-site distance matrix (instead of coordinates).

weights

Demand weights.

max_enum

Enumeration limit.

Value

list(sites (1-based), assignment, objective, method).

References

Hakimi, S. L. (1964). Optimum locations of switching centers and the absolute centers and medians of a graph. Operations Research 12, 450-459. Teitz, M. B. and Bart, P. (1968). Operations Research 16, 955-961.

Examples

PMedian(2, rbind(c(0, 0), c(1, 0), c(10, 0), c(11, 0)))$objective
#> [1] 2