-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
duplicated selected locations in spjitter #13
Comments
You are right: there is no check because spsann assumes that you are using an infinite set of candidate locations. But I guess that spsann is making the wrong assumption. |
I agree that this is very unlikely to select twice the exact same candidate location in an infinite set of candidate location. But it could... I now realize that by implementing a check on whether the candidate location is already occupied, you would probably solve (we need to think this through) the other issue that I raised: optimizing based on a finite set of candidate locations. This is an important problem, for example when one wants to thin an existing network with known and finite number of candidate locations. No need to implement a new spJitter function then. |
I have just implemented the check when using |
Hello! I'm still encountering this problem using SPSANN and optimUSER, even though I have set cellsize to 0! |
I have limited time to work on this now. You are welcome to submit a pull request. |
Sorry, I do not remember what and where it was done. |
When I run the optimization with cellsize = 0, i.e. with a finite number of candidate locations, the algorithm selects same location several times. Below a reproducible example.
library(sp)
data(meuse.grid, package = "sp")
schedule <- scheduleSPSANN( chains = 10, initial.temperature = 10, temperature.decrease = 0.5, x.max = 1540, y.max = 2060, x.min = 0, y.min = 0, cellsize = 0)
set.seed(2001)
res <- optimCLHS( points = 400, candi = meuse.grid[,c('x', 'y')], covars = meuse.grid[, c(1,5)], use.coords = F, schedule = schedule, track=F, plotit = F)
res.pt <- res$points
coordinates(res.pt) <- ~x+y
zerodist(res.pt)
I understand that the algorithm selects a random location inside a pixel of size
cellsize
around the candidate location. But when I setcellsize=0
, this should normally not happen I guess. This means that there is not check to ensure that the selected location is not already occupied.The text was updated successfully, but these errors were encountered: