miquelramirez / simulpast-cs1

SimulPAST project Case Study #1 Agent Based Simulator
http://www.simulpast.es
4 stars 1 forks source link

HomeRange units and inconsistency handling distances between tiles #19

Open miquelramirez opened 12 years ago

miquelramirez commented 12 years ago

Hi,

there's quite a situation with this. What are the homeRange units? Kilometers? If so, then all of our calculations involving HomeRange (or SocialRange or homeMobilityRange) are just wrong: they're using as units "tiles", rather than their actual dimensions.

If these ranges are in tiles, then they're totally unrealistic (say, 30 tiles are about 900 meters since we're using 31.5x31.5m tiles..)

Besides that, what are the coordinates of a raster value. If it it's say, tile with indices (i,j) then its actual coordinates (with (0,0) being on the top left corner of the raster, and corresponsing to ( w/2, h/2 ) ) would be something like:

( i_w + w/2, j_h + h/2 )

where we take the actual center of the tile as its actual center, w is the tile width (in meters) and h is the tile height (in meters).

I have realized this while trying to fix a problem with the MoveHomeAction::generatePossibleActions, which was sometimes returning no possible Move Home actions at all (which shouldn't happen at all), and seeing that the ranges and the distances didn't make any sense at all.

Note that this means that stuff such as the Sectors (and the Sectors mask) needs to be changed as well.

This is a quite huge thing. As a temporary measure, I will be introducing two new StaticRasters at startup (x-coords and y-coords) so we can perform the computations properly, and change the MoveHomeAction range check and the ForageAction internal computations to take into account this.

However, the foraging will be still very much out of whack (because the Sectors are built with the homeRange taken as "tiles" rather than kilometers) along with the intersection routines to determine the settlement "in range".

xrubio commented 12 years ago

I don't understand the problem...homeRange is defined as cells, and everything should be calculated in cells, not in meters (except for the quantity of biomass in a cell, that uses cellResolution). Could you specify in which code is this an issue...?

miquelramirez commented 12 years ago

Ok, so the units for distance are cells... at all times. Thank you for clarifying this, Xavi.

miquelramirez commented 12 years ago

Places where this is not being consistently used: