![]() |
fpmas 1.6
|
#include <grid_agent_mapping.h>
Public Member Functions | |
ConstrainedGridAgentMapping (DiscreteCoordinate grid_width, DiscreteCoordinate grid_height, std::size_t agent_count, std::size_t max_agent_by_cell) | |
std::size_t | countAt (api::model::GridCell *cell) override |
virtual std::size_t | countAt (api::model::GridCell *cell)=0 |
api::model::SpatialAgentMapping implementation for grid environments.
The ConstrainedGridAgentMapping allows to uniformly distribute agents over a grid, while specifying a maximum count of agents by cell.
The RandomMapping::rd random generator is used, and can be seeded with RandomMapping::seed() or fpmas::seed().
fpmas::model::ConstrainedGridAgentMapping::ConstrainedGridAgentMapping | ( | DiscreteCoordinate | grid_width, |
DiscreteCoordinate | grid_height, | ||
std::size_t | agent_count, | ||
std::size_t | max_agent_by_cell | ||
) |
ConstrainedGridAgentMapping constructor.
agent_count
agents will be uniformly distributed on the grid defined by (grid_width, grid_height)
, considering the origin at (0, 0)
, with max_agent_by_cell
as the maximum capacity of each cell.
grid_width | Grid width |
grid_height | Grid height |
agent_count | total count of agents to map |
max_agent_by_cell | maximum count of agents allowed on each cell |
|
overridevirtual |
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 |
Implements fpmas::api::model::SpatialAgentMapping< api::model::GridCell >.