Learn R Programming

pedometrics (version 0.3-0)

spSANN: Spatial simulated annealing

Description

Funtion to optimize spatial point patterns using spatial simulated annealing.

Usage

spSANN(points, candidates, x.max, x.min, y.max, y.min, fun, ...,
       iterations = 10000, plotit = TRUE, boundary,
       acceptance = list(initial = 0.99, cooling = iterations / 10),
       stopping = list(max.count = 200), progress = TRUE, verbose = TRUE)

Arguments

points
A data.frame or matrix containing the set of point locations to be optimized.
candidates, x.max, x.min, y.max, y.min
See spJitterFinite and Details for more information.
fun
A function used the calculate the criterion that has to be minimized during the optimization.
...
Arguments passed to the objective function defined with fun. See Details for more information.
iterations
Integer value defining the maximum number of iterations that should be used for the optimization. See Details for more information.
plotit
Logical value for ploting the optimization results. This includes a) the progress of the objective function values and acceptance probabilities, and b) the original points, the perturbed points and the progress of the maximum perturbation in the x and y c
boundary
A SpatialPolygon defining the boundary of the spatial domain. It is mandatory if plotit = TRUE
acceptance
A list with two sub-arguments: initial and . initial is a numeric value between 0 and 1 defining the initial acceptance probability. Defaults to initial = 0.99. cooling is a numeric value defining the ex
stopping
A list with one sub-argument: max.count. max.count is an integer value defining the maximum allowable number of iterations without improvement of the objective function value. This is also known as the freezing criterion. Default
progress
Logical value for printing a progress bar. Defaults to progress = TRUE.
verbose
Logical value for printing messages about the progress of the optimization.

Value

  • A data.frame or matrix with the coordinates of the optimized spatial points with attributes:
    • the objective function values for the starting system configuration and all iterations
    • the running time of the algorithm

Details

Search graph{ The search graph corresponds to the set of effective candidate locations for a point being jittered in a given iteration. The size of the search graph, i.e. the maximum distance that a point can be moved around, is correlated with the concept of temperature. A larger search graph is equivalent to higher temperatures, which potentially result in more movement or agitation of the set of points or particles.

The current version of spSANN implements a linear cooling schedule depending upon the number of iterations to control the size of the search graph. The equations are as follows:

x.max.b <- x.max.a - k / iterations * (x.max.a - x.min) y.max.b <- y.max.a - k / iterations * (y.max.a - y.min)

where x.max.a and y.max.a are the maximum allowed shift in the x and y coordinates in the current iteration, x.min and y.min are the minimum required shift in the x and y coordinates, and x.max.b and y.max.b are the maximum allowed shift in the x and y coordinates in the next iteration. iterations is the total number of iterations and k is the current iteration. } Acceptance probability{ The acceptance probability is the chance of accepting a new system configuration that is worse than the current system configuration. The concept of acceptance probability is related with that of temperature. A higher acceptance probability is equivalent to higher temperatures, which potentially result in more movement or agitation of the set of points or particles.

Using a low initial acceptance probability turn the spatial simulated annealing into a greedy algorithm. It will converge in a shorter time, but the solution found is likely to be a local optimum instead of the global optimum. Using a high initial acceptance probability (>0.8) usually is the wisest choice.

An exponential cooling schedule depending upon the number of iterations is used in the current version of spSANN to control the acceptance probability. The acceptance probability at each iteration is calculates as follows:

actual_prob <- acceptance$initial * exp(-k / acceptance$cooling)

where actual_prob is the acceptance probability at the k-th iteration, acceptance$initial is the initial acceptance probability, and acceptance$cooling is the exponential cooling factor. } Starting system configuration{ Unidimensional objective functions such as objPairs and objPoints are dependent on the starting system configuration by definition. This means that, depending on the parameters passed to spSANN, many points will likely to stay close to their starting positions. It would be reasonable to use a starting system configuration that is close to the global optimal, but such thing is not feasible.

Increasing the initial acceptance probability does not guarantee the independence from the starting system configuration. The most efficient option in the current version of spSANN is to start using the entire spatial domain as search graph. This is set using the interval of the x and y coodinates to set x.max and y.max. See above.} Number of iterations{ The number of iterations has a large influence on the performance of the spatial simulated annealing algorithm. The larger the number of possible system configurations, the higher should the number of iterations be.

The number of possible system configurations increases with:

  • a high initial acceptance probability
  • the use of an infinite set of candidate locations
  • the use of a very dense finite set of candidate locations
}

References

Brus, D. J.; Heuvelink, G. B. M. Optimization of sample patterns for universal kriging of environmental variables. Geoderma. v. 138, p. 86-95, 2007.

Pebesma, E.; Skoien, J. with contributions from Baume, O.; Chorti, A.; Hristopulos, D.T.; Melles, S.J.; Spiliopoulos, G. intamapInteractive: procedures for automated interpolation - methods only to be used interactively, not included in intamap package. R package version 1.1-10. 2013. http://CRAN.R-project.org/package=intamapInteractive

Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; Vetterling, W. T. Numerical recipes in Fortran 77 - the art of scientific computing. Cambridge: Press Syndicate of the University of Cambridge, v. 1, p. 973, 1992.

Russel, S.; Norvig, P. Artificial intelligence: a modern approach. Upper Saddle River: Prentice Hall, p. 1132, 2010.

Van Groenigen, J.-W. Constrained optimisation of spatial sampling: a geostatistical approach. Wageningen: Wageningen University, p. 148, 1999. Vasat, R.; Heuvelink, G. B. M.; Boruvka, L. Sampling design optimization for multivariate soil mapping. Geoderma. v. 155, p. 147-153, 2010.

See Also

ssaOptim, spJitterFinite, objPoints, objPairs, do.call.

Examples

Run this code
data(meuse.grid)
boundary <- meuse.grid
coordinates(boundary) <- ~ x + y
proj4string(boundary) <- CRS("+init=epsg:28992")
gridded(boundary) <- TRUE
boundary <- as(boundary, "SpatialPolygons")
boundary <- gUnionCascaded(boundary)
candidates <- meuse.grid[, 1:2]
coordinates(candidates) <- ~ x + y
proj4string(candidates) <- CRS("+init=epsg:28992")
candidates <- coordinates(candidates)
which_pts <- sample(c(1:dim(candidates)[1]), 50)
points <- candidates[which_pts, ]
x.max <- diff(bbox(boundary)[1, ])
x.min <- 40
y.max <- diff(bbox(boundary)[2, ])
y.min <- 40
iterations <- 10000
acceptance <- list(initial = 0.99, cooling = iterations / 10)
opt <-
  spSANN(points = points, candidates, x.max, x.min, y.max, y.min, 
         #fun = objMSSD, dist.mat = dist_mat, pred.grid = candidates,
         fun = objPoints, lags = 7, cutoff = max_dist/2,
         lags.type = "exponential", criterion = "distribution",
         iterations = iterations, boundary, acceptance = acceptance,
         stopping = list(max.count = 200), progress = TRUE, verbose = TRUE,
         plotit = TRUE)

Run the code above in your browser using DataLab