sa | R Documentation |
Simulated Annealing Algorithm
sa(n = 5000, x = c(-1.9, 1.9))
n |
number of generated points MC |
x |
grid of measurements |
h=function(x) if(is.vector(x)) dim(x)=c(1,2) cos(10*x[,1]^2)-5*x[,1]^2+cos(10*x[,2]^2)-5*x[,2]*2
uwalk = function(x, step = c(0.1, 0.1), valid) xn = x + runif(length(x), -1, 1) * step while (!valid(xn)) xn = x + runif(length(x),-1, 1) * step xn
hv = function(x) !any(x <= -2 | x >= 2)
tempf = function(n) 0.995^(1:n) * 10000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.