View source: R/scheduleSPSANN.R
scheduleSPSANN  R Documentation 
Set the control parameters of the annealing schedule.
scheduleSPSANN(
initial.temperature = 0.001,
chains = 500,
x.max,
x.min = 0,
y.max,
y.min = 0,
cellsize,
stopping = ceiling(chains * 0.5),
chain.length = 1,
temperature.decrease = 0.95,
initial.acceptance = c(0.95, 0.99)
)
initial.temperature 
Numeric value larger than zero (0) defining the initial temperature of
the system. A low 
chains 
Integer value defining the maximum number of Markov chain, i.e. the number of
cycles of jitters at which the temperature and the size of the neighbourhood should be kept
constant. Defaults to 
x.max, x.min, y.max, y.min 
Numeric value defining the minimum and maximum quantity of random
noise to be added to the Cartesian x and ycoordinates. The units are the same as of the
Cartesian x and ycoordinates. If missing, they are estimated from 
cellsize 
Vector with two positive numeric values defining the spacing in the x and ycoordinates
between the candidate locations in 
stopping 
Integer value defining the maximum allowable number of Markov chains without
improvement of the objective function value. Defaults to 
chain.length 
Integer value larger than zero (0) defining the length of each Markov chain
relative to the number of samples. Defaults to 
temperature.decrease 
Numeric value between zero (0) and one (1) used as a multiplying
factor to decrease the temperature at the end of each Markov chain. Defaults to

initial.acceptance 
(Optional) Vector with two positive numeric values between zero (0) and
one (1) defining the minimum and maximum initial acceptance probabilities. The initial acceptance
probability is the proportion of candidate spatial sample configurations that should be accepted
in the first Markov chain. The optimization is stopped and a warning is issued if the value is
not within the predefined range. Defaults to 
There are multiple mechanism to generate a new sample configuration out of an existing one. The main step consists of randomly perturbing the coordinates of a single sample, a process known as ‘jittering’. These mechanisms can be classified based on how the set of candidate locations for the samples is defined. For example, one could use an infinite set of candidate locations, that is, any location in the spatial domain can be selected as a new sample location after a sample is jittered. All that is needed is a polygon indicating the boundary of the spatial domain. This method is more computationally demanding because every time an existing sample is jittered, it is necessary to check if the new sample location falls in spatial domain.
Another approach consists of using a finite set of candidate locations for the samples. A finite set of candidate locations is created by discretising the spatial domain, that is, creating a fine (regular) grid of points that serve as candidate locations for the jittered sample. This is a less computationally demanding jittering method because, by definition, the new sample location will always fall in the spatial domain.
Using a finite set of candidate locations has two important inconveniences. First, not all locations in the spatial domain can be selected as the new location for a jittered sample. Second, when a sample is jittered, it may be that the new location already is occupied by another sample. If this happens, another location has to be iteratively sought for, say, as many times as the size of the sample configuration. In general, the larger the size of the sample configuration, the more likely it is that the new location already is occupied by another sample. If a solution is not found in a reasonable time, the the sample selected to be jittered is kept in its original location. Such a procedure clearly is suboptimal.
spsann uses a more elegant method which is based on using a finite set of candidate locations
coupled with a form of twostage random sampling as implemented in spcosa::spsample()
.
Because the candidate locations are placed on a finite regular grid, they can be taken as the
centre nodes of a finite set of grid cells (or pixels of a raster image). In the first stage, one
of the “grid cells” is selected with replacement, i.e. independently of already being
occupied by another sample. The new location for the sample chosen to be jittered is selected
within that “grid cell” by simple random sampling. This method guarantees that virtually
any location in the spatial domain can be selected. It also discards the need to check if the new
location already is occupied by another sample, speeding up the computations when compared to the
first two approaches.
The search graph corresponds to the set of effective candidate locations for a sample location selected to be jittered. The size of the search graph, i.e. area within which a sample location can be moved around, is related to 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 sample locations.
The current version of the spsannpackage uses a linear cooling schedule which depends upon the number of jitters to control the size of the search graph. The equations are
x_max = x_max0  (chains_i / chains) * (x_max0  x_min) + x_cellsize + x_min0
and
y_max = y_max0  (chains_i / chains) * (y_max0  y_min) + y_cellsize + y_min0
,
where $x_max0$ and $y_max0$ are the maximum allowed shifts in the x and ycoordinates in the first chain, $x_min$ and $y_min$ are the minimum required shifts in the x and ycoordinates, $x_max$ and $y_max$ are the maximum allowed shifts in the x and ycoordinates during the next chain, $chains$ and $chain_i$ are the total and current chains, and $x_cellsize$ and $y_cellsize$ are the grid spacing in the x and ycoordinates. Because $x_cellsize$ and $y_cellsize$ can be equal to zero when a finite set of candidate locations is used, $x_min0$ and $y_min0$ are the maximum nearest neighbour distance in the x and ycoordinates between candidate locations.
A list with a set of control parameters of the annealing schedule.
spsann always computes the distance between two locations (points) as the Euclidean distance between them. This computation requires the optimization to operate in the twodimensional Euclidean space, i.e. the coordinates of the sample, candidate and evaluation locations must be Cartesian coordinates, generally in metres or kilometres. spsann has no mechanism to check if the coordinates are Cartesian: you are the sole responsible for making sure that this requirement is attained.
Alessandro SamuelRosa alessandrosamuelrosa@gmail.com
Aarts, E. H. L.; Korst, J. H. M. Boltzmann machines for travelling salesman problems. _European Journal of Operational Research_S, v. 39, p. 7995, 1989.
Černý, V. Thermodynamical approach to the travelling salesman problem: an efficient simulation algorithm. Journal of Optimization Theory and Applications, v. 45, p. 4151, 1985.
Brus, D. J.; Heuvelink, G. B. M. Optimization of sample patterns for universal kriging of environmental variables. Geoderma, v. 138, p. 8695, 2007.
Kirkpatrick, S.; Gelatt, C. D.; Vecchi, M. P. Optimization by simulated annealing. Science, v. 220, p. 671680, 1983.
Metropolis, N.; Rosenbluth, A. W.; Rosenbluth, M. N.; Teller, A. H.; Teller, E. Equation of state calculations by fast computing machines. The Journal of Chemical Physics, v. 21, p. 10871092, 1953.
van Groenigen, J.W.; Stein, A. Constrained optimization of spatial sampling using continuous simulated annealing. Journal of Environmental Quality. v. 27, p. 10781086, 1998.
Webster, R.; Lark, R. M. Field sampling for environmental science and management. London: Routledge, p. 200, 2013.
optimACDC
, optimCORR
,
optimDIST
, optimMKV
,
optimMSSD
, optimPPL
,
optimSPAN
, optimUSER
.
#####################################################################
# NOTE: The settings below are unlikely to meet your needs. #
#####################################################################
schedule < scheduleSPSANN(initial.temperature = 100, cellsize = 30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.