tb: Teitz-Bart algorithm applied to Spatial* and...

Description Usage Arguments Value Examples

View source: R/tbmain.R

Description

This reports the p-median set

Usage

1
tb(swdf1, swdf2, p, metric, verbose = FALSE)

Arguments

swdf1

- first Spatial* or Spatial*DataFrame objects - the 'demand' set

swdf2

- second Spatial* or Spatial*DataFrame objects - the 'supply' set (if omitted, defaults to the same value as swdf1)

p

- either a guess at the initial p-median set of a single integer indicating the size of the set (which is then chosen randomly)

metric

- the distance matrix (defaults to Euclidean computed via euc.dists(swdf1,swdf2) if not supplied)

verbose

- if TRUE print out each swap in the algorithm (default is FALSE)

Value

Set of point indices for p-median (may be local optimum)

Examples

1
2
3
data(meuse)
coordinates(meuse) <- ~x+y
tb(meuse,p=5)

Example output

Loading required package: Rcpp
Loading required package: sp
[1]  75  47 142  12 113

tbart documentation built on May 2, 2019, 2:49 p.m.