![]() |
fpmas 1.6
|
#include <spatial_model.h>
Public Member Functions | |
virtual std::size_t | countAt (CellType *cell)=0 |
The SpatialAgentMapping API is a key feature required for the distributed SpatialAgent instantiation performed by a SpatialAgentBuilder.
The idea of the SpatialAgentBuilder is that not all processes must instantiate all SpatialAgents of the simulation, or at least the instantiation of all SpatialAgents must not be handled by a single process.
However, in accordance with the FPMAS philosophy, we still want to provide some way to globally initialize a Model, completely abstracting the underlying Cell network distribution, that might be built in a distributed way using a CellNetworkBuilder.
As a counter example, in RepastHPC, a determined part of the environment, represented as a grid, is instantiated on each process, and the user then provides the number of agents that must be initialized on each process, i.e. on each part of the environment. However, this not very flexible, and above all very distribution dependent. In addition, it requires users to be aware of the underlying grid distribution to consistently initialize their agents.
The SpatialAgentMapping is a proposition to solve those issues in a generic, flexible and distributed way. The idea is that, instead of manually instantiating agents and initializing their locations, we can globally provide rules such as "we want to initialize 1000 preys uniformly on our distributed grid". Since such rules are assumed to be computed relatively easily, it is realistic to instantiate them on all processes (for example, loading an external input file). Then, the SpatialAgentBuilder algorithm can instantiate SpatialAgents in a distributed way, only initializing the required number of agents on each Cell LOCAL to current process.
|
pure virtual |
Returns the number of SpatialAgents that must be initialized on the provided Cell.
Notice that the agents instantiation and initialization is not performed by this method, but handled by SpatialAgentBuilder::build().
cell | cell on which agents will be initialized |
Implemented in fpmas::model::UniformAgentMapping, fpmas::model::RandomGridAgentMapping, and fpmas::model::ConstrainedGridAgentMapping.