Hello, I have a question about instantiating agents in a GIS-based world using the GeoMason package. I'm using MASON (v19) and GeoMason (v1.5), and have been working on a model that is inspired from the ColorWorld example included with GeoMason. In this model, I have loaded a GIS shapefile of a metropolitan area and have merged in Census data for polygon shapes for each of the Census tracts within the area. There are two main agent types that I am working with, DistributionCenter and Vehicle, that interact on top of the GIS layer.
Both DistributionCenter and Vehicle are separate classes. DistributionCenters own a variable that specifies the size of their own vehicle fleet. At model setup, I instantiate my DistributionCenters, and for each DistributionCenter, I access the fleet size variable and instantiate their own fleet Vehicles one at a time before instantiating the next DistributionCenter. Each Vehicle is assigned a location in the GIS world to the exact coordinate location of their parent DistributionCenter (i.e., parked in the DistributionCenter's garage). The DistributionCenter has no move() method however the Vehicles do.
In my model View (i.e., "_withUI"), DistributionCenters and Vehicles each have their own GeomVectorFieldPortrayal. If I instantiate ONLY DistributionCenters, they show up as static agents that are located in the world as expected. If I instantiate ONLY Vehicles, they are created into the world and move around the polygons as expected. The problem I've run into is if I instantiate both during a model run using the process I outlined earlier (I instantiate DistributionCenters one at a time, and each center instantiates their fleet). In this scenario, the DistributionCenters and Vehicles are rendered as expected on the simulation display with Vehicles layered on top of their parent DistributionCenter, however when stepping through the model time, all the Vehicles move as one (instead of independently) and take the DistributionCenter with it, even though the DistributionCenter was never intended to move!
I think I've come up with a hacked solution though I don't understand why it works. What I did was to make a very small adjustment (e.g., +0.00001) to the starting X and Y coordinate location of the Vehicle to make it have an initial starting point that was not exactly the same as the Center or any other Vehicle (no overlap of agents). The result was what I wanted, with Centers remaining static and all the Vehicles moving independently.
Is there a issue with having agents occupying the exact same location in the GIS world? While my hacked solution seems to be somewhat useful for right now, I'm concerned that if I increase the density of agents created during model setup, the same situation might occur.
Any insights would be appreciated!
Thank you!
Brant
|