Closed sriramab closed 8 years ago
Well, the ordering of the grid neighbors has been the object of long debates over the years, if I remember well. It was once fixed, and we decided to make it different at each call, but I dont really remember why (probably to avoid some side effects due to the ordering). I think @benoitgaudou participated to this debate and was in favor of returning randomized lists -- maybe he can shed a light on this issue ?
Hmm, getting a predictable order can be useful to use many ArcGIS like raster operations (window and focal statistics and some others from spatial analyst) in GAMA.
Hi, just an idea about the grid, which is related with my work with Benoit in the past, is the diffusion on the grid. I think that i had impression that randomized order give more likely effect of a parallele diffusion. Cheers.
Hmm, I wonder, because the first step for diffusion of soil (landslides, soil erosion) or water(flood) would need a fixed sequence to apply algorithms. And recently for this task I was reading some CA models and having an order would help a lot.
Unless of course if u meant some other kind of diffusions and algorithms within gama.
I'm afraid there is nothing we will do on this issue. neighbors
is computed in such a way that the result is always randomized, using GAMA random number generator, so that (1) we avoid the side effects of having the neighbors always returned in the same order; (2) it is still replicable if you run the same simulation with the same seed and generator. That said, why dont you declare your own attribute (e.g. list<cell> fixed_neighbors <- neighbors sorted_by (each direction_to self);
or anything like this) and use this one instead of neighbors
?
yes I tried that yesterday, it is buggy. I will report an issue. thank you
Also I would like to report, that with same seed and generator, the sequence differs every time you run the model. that is why I am puzzled. I am defining seed in experiment, is that the right way? experiment floodBates type: gui { /* Insert here the definition of the input and output of the model / float seed <- 0.5140073008712904; output { display bates type: opengl ambient_light: 100 { species cell aspect: box; grid cell triangulation: true; //lines:#black; }
}
}
You define the seed where you want it to be fixed. If you define it in experiment and dont fix it in simulations, then the simulation seeds will be randomly produced using the experiment seed. If you want to obtain a repeatable sequence of neighbors, you have to define your seed in global.
I will explore a bit, because even a reflex causes a change not just experiment. :( a bit confusing ... Thank you, I come back later.
Steps to reproduce
Expected behaviour
I am trying to replicate some ArcGIS type raster operations and I would like that this sequence is restricted/ controlled in clockwise or anti-clockwise direction because it is affecting my calculation every time I call list of neighbours. I fear hard coding a sequence of cells will give different results every time. May be it can be corrected with some internal random seed that controls the sequence of neighbors.
Actual behaviour
different sequence of neighbor cells generated every time.
System and version
MacOS X Mavericks, java 8, gama standalone