Skip to contents

Largest number p of contiguous regions whose summed weights reach threshold: repeated random constructions (Philox) grow regions from shuffled seeds and attach enclaves to the adjacent region of least SSD increase, keeping the largest p and then the smallest SSD; an AZP local search that keeps every donor above the threshold then lowers the SSD.

Usage

MaxPRegions(
  X,
  adjacency,
  weights,
  threshold,
  n_construct = 50,
  seed = 0,
  local = TRUE,
  max_iter = 1000
)

Arguments

X

Attribute matrix (units in rows).

adjacency

0/1 contiguity matrix or list of 1-based neighbour vectors.

weights

Per-unit weights for min_weight.

threshold

Minimum summed weight per region.

n_construct

Number of constructions.

seed

Philox seed.

local

Run the local search.

max_iter

Maximum local-search sweeps.

Value

list(labels, p, ssd, region_weights).

References

Duque, J. C., Anselin, L. and Rey, S. J. (2012). The max-p-regions problem. Journal of Regional Science 52, 397-419.

Examples

MaxPRegions(matrix(c(0, 0.1, 0.2, 5, 5.1, 5.2)), list(2, c(1, 3), c(2, 4), c(3, 5), c(4, 6),
  5), rep(1, 6), 3)$p
#> [1] 2