fpmas 1.6
Public Member Functions | List of all members
fpmas::model::ConstrainedGridAgentMapping Class Reference

#include <grid_agent_mapping.h>

Inheritance diagram for fpmas::model::ConstrainedGridAgentMapping:
Inheritance graph
[legend]
Collaboration diagram for fpmas::model::ConstrainedGridAgentMapping:
Collaboration graph
[legend]

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
 

Detailed Description

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().

Constructor & Destructor Documentation

◆ ConstrainedGridAgentMapping()

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.

Parameters
grid_widthGrid width
grid_heightGrid height
agent_counttotal count of agents to map
max_agent_by_cellmaximum count of agents allowed on each cell

Member Function Documentation

◆ countAt()

std::size_t fpmas::model::ConstrainedGridAgentMapping::countAt ( api::model::GridCell 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().

Parameters
cellcell on which agents will be initialized

Implements fpmas::api::model::SpatialAgentMapping< api::model::GridCell >.


The documentation for this class was generated from the following files: