recmapGRASP {recmap} | R Documentation |
Greedy Randomized Adaptive Search Procedure Wrapper Function for recmap
Description
Implements a metaheuristic for recmap
based on GRASP.
Usage
recmapGRASP(Map, fitness = .recmap.fitness, n.samples = nrow(Map) * 2,
fitness.cutoff = 1.7, iteration.max = 10)
Arguments
Map |
defines the input map regions formatted as |
fitness |
a fitness function |
n.samples |
number of samples. |
fitness.cutoff |
cut-off value. |
iteration.max |
maximal number of iteration. |
Value
returns a list of the input Map
, the best solution of GRASP,
and a recmap
object containing the cartogram.
Author(s)
Christian Panse
References
Feo TA, Resende MGC (1995). "Greedy Randomized Adaptive Search Procedures." Journal of Global Optimization, 6(2), 109-133. ISSN 1573-2916. doi:10.1007/BF01096763.
See Also
Examples
## US example
getUS_map <- function(){
usa <- data.frame(x = state.center$x,
y = state.center$y,
# make the rectangles overlapping by correcting
# lines of longitude distance.
dx = sqrt(state.area) / 2
/ (0.8 * 60 * cos(state.center$y * pi / 180)),
dy = sqrt(state.area) / 2 / (0.8 * 60),
z = sqrt(state.area),
name = state.name)
usa$z <- state.x77[, 'Population']
US.Map <- usa[match(usa$name,
c('Hawaii', 'Alaska'), nomatch = 0) == 0, ]
class(US.Map) <- c('recmap', 'data.frame')
US.Map
}
## Not run:
res <- recmapGRASP(getUS_map())
plot(res$Map, main = "Input Map")
plot(res$Cartogram, main = "Output Cartogram")
## End(Not run)
[Package recmap version 1.0.17 Index]