Reputation: 321
I have a model in which my agents are people, and I'd like to take the population density of the area into account. I.e.: I want that in some areas more agents will be generated than in others. Ideally I would like this to be working with a GIS map. How would I start implementing this? I already have a GIS map, the population data files (.grd, .gri, and .vrt).
Upvotes: 0
Views: 119
Reputation: 9421
This is not so simple since there's no anylogic built-int function that will help you...
You have to create your own 2D distribution function f(longitude,latitude)=Z where the higher the Z, the more likely it is for an agent to start in that location. You have to be able to define that function yourself...
Once you have it, an easy, but maybe inefficient way to get a random sample is (assuming Z is normalized to a maximum value of 1) to take a random value from the 3 dimensional space (random latitude, longitude and Z) and if Z ends up being below the Z required for that latitude longitude, then you take that value, otherwise you try again until you find a random value that fits.
You can also use a discrete solution in a similar way, and you can read this website in order to understand how to do it: http://code-spot.co.za/2009/04/15/generating-random-points-from-arbitrary-distributions-for-2d-and-up/
Upvotes: 1