![]() |
fpmas 1.6
|
#include <grid.h>
Public Member Functions | |
DiscretePoint | locationPoint () const override |
random::FPMAS_AGENT_RNG & | rd () override |
void | seed (std::FPMAS_AGENT_RNG::result_type seed) override |
![]() | |
void | initLocation (model::GridCell *cell) override |
DistributedId | locationId () const override |
model::GridCell * | locationCell () const override |
![]() | |
AgentBase ()=default | |
AgentBase (const AgentBase &agent)=default | |
AgentBase (AgentBase &&)=default | |
AgentBase & | operator= (const AgentBase &agent)=default |
AgentBase & | operator= (AgentBase &&) |
GroupId | groupId () const override |
std::vector< GroupId > | groupIds () const override |
void | setGroupId (api::model::GroupId id) override |
void | addGroupId (api::model::GroupId id) override |
void | removeGroupId (api::model::GroupId id) override |
api::model::AgentGroup * | group () override |
const api::model::AgentGroup * | group () const override |
std::vector< const api::model::AgentGroup * > | groups () const override |
std::vector< api::model::AgentGroup * > | groups () override |
void | setGroup (api::model::AgentGroup *group) override |
void | addGroup (api::model::AgentGroup *group) override |
void | removeGroup (api::model::AgentGroup *group) override |
void | setGroupPos (api::model::GroupId gid, std::list< api::model::Agent * >::iterator pos) override |
std::list< api::model::Agent * >::iterator | getGroupPos (api::model::GroupId gid) const override |
api::model::TypeId | typeId () const override |
api::model::Agent * | copy () const override |
void | copyAssign (api::model::Agent *agent) override |
void | moveAssign (api::model::Agent *agent) override |
api::model::AgentNode * | node () override |
const api::model::AgentNode * | node () const override |
void | setNode (api::model::AgentNode *node) override |
api::model::Model * | model () override |
const api::model::Model * | model () const override |
void | setModel (api::model::Model *model) override |
api::model::AgentTask * | task () override |
const api::model::AgentTask * | task () const override |
api::model::AgentTask * | task (api::model::GroupId id) override |
const api::model::AgentTask * | task (api::model::GroupId id) const override |
void | setTask (api::model::AgentTask *task) override |
void | setTask (api::model::GroupId id, api::model::AgentTask *task) override |
const std::unordered_map< api::model::GroupId, api::model::AgentTask * > & | tasks () override |
virtual void | act () override |
Neighbors< NeighborAgentType > | outNeighbors () const |
Neighbors< NeighborAgentType > | outNeighbors (api::graph::LayerId layer) const |
Neighbors< NeighborAgentType > | inNeighbors () const |
Neighbors< NeighborAgentType > | inNeighbors (api::graph::LayerId layer) const |
![]() | |
virtual DistributedId | locationId () const=0 |
virtual model::GridCell * | locationCell () const=0 |
virtual void | initLocation (Cell *cell)=0 |
virtual const Range< model::GridCell > & | mobilityRange () const=0 |
virtual const Range< model::GridCell > & | perceptionRange () const=0 |
![]() | |
virtual GroupId | groupId () const =0 |
virtual std::vector< GroupId > | groupIds () const =0 |
virtual void | setGroupId (GroupId id)=0 |
virtual void | addGroupId (GroupId id)=0 |
virtual void | removeGroupId (GroupId id)=0 |
virtual AgentGroup * | group ()=0 |
virtual const AgentGroup * | group () const =0 |
virtual std::vector< AgentGroup * > | groups ()=0 |
virtual std::vector< const AgentGroup * > | groups () const =0 |
virtual void | setGroup (AgentGroup *group)=0 |
virtual void | addGroup (AgentGroup *group)=0 |
virtual void | removeGroup (AgentGroup *group)=0 |
virtual void | setGroupPos (api::model::GroupId gid, std::list< Agent * >::iterator pos)=0 |
virtual std::list< Agent * >::iterator | getGroupPos (api::model::GroupId gid) const =0 |
virtual TypeId | typeId () const =0 |
virtual Agent * | copy () const =0 |
virtual void | copyAssign (Agent *agent)=0 |
virtual void | moveAssign (Agent *agent)=0 |
virtual AgentNode * | node ()=0 |
virtual const AgentNode * | node () const =0 |
virtual void | setNode (AgentNode *node)=0 |
virtual Model * | model ()=0 |
virtual const Model * | model () const =0 |
virtual void | setModel (Model *model)=0 |
virtual AgentTask * | task ()=0 |
virtual const AgentTask * | task () const =0 |
virtual void | setTask (AgentTask *task)=0 |
virtual AgentTask * | task (GroupId id)=0 |
virtual const AgentTask * | task (GroupId id) const =0 |
virtual void | setTask (GroupId id, AgentTask *task)=0 |
virtual const std::unordered_map< GroupId, AgentTask * > & | tasks ()=0 |
virtual void | act ()=0 |
virtual void | handleNewMove ()=0 |
virtual void | handleNewPerceive ()=0 |
virtual DiscretePoint | locationPoint () const =0 |
virtual api::random::Generator< std::FPMAS_AGENT_RNG::result_type > & | rd ()=0 |
virtual void | seed (std::FPMAS_AGENT_RNG::result_type seed)=0 |
Protected Member Functions | |
void | moveTo (GridCellType *cell) override |
void | moveTo (DiscretePoint point) override |
![]() | |
void | updateLocation (model::GridCell *cell) |
void | handleNewMove () override |
void | handleNewPerceive () override |
void | moveTo (DistributedId id) override |
Neighbors< model::GridCell > | mobilityField () const |
Neighbors< NeighborType > | perceptions () const |
![]() | |
virtual void | moveTo (DiscretePoint point)=0 |
![]() | |
virtual void | moveTo (DistributedId id)=0 |
virtual void | moveTo (Cell *cell)=0 |
virtual void | moveTo (DiscretePoint point)=0 |
api::model::GridAgent implementation.
AgentType | final GridAgent type (i.e. the most derived type from this GridAgent) |
GridCellType | Type of cells constituting the Grid on which the agent is moving. Must extend api::model::GridCell. |
Derived | direct derived class, or at least the next class in the serialization chain |
|
overrideprotected |
Moves to the input Cell.
The input Cell is not required to be contained in the current mobility field of this SpatialAgent, what allows:
The execution of a DistributedMoveAlgorithm is required to commit the operation and update mobility fields and perceptions. However, this can be handled automatically on specific AgentGroups: see SpatialModel::buildMoveGroup().
More precisely, the current location, if defined, is unlinked, and so does the mobility field and perceptions, and a link from this SpatialAgent to cell
is created on the NEW_LOCATION
layer. In consequence, the behavior of locationCell() is undefined until a DistributedMoveAlgorithm is executed.
Notice that performing an other moveTo() operation before the previous is committed produces an undefined behavior.
cell | cell to which this SpatialAgent should move. |
|
overrideprotectedvirtual |
Moves to the Cell at the specified point.
Notice that it is assumed that at most one GridCell can be located at each point
.
If no Cell at point
can be found in the current mobility field, an OutOfMobilityFieldException is thrown.
point | discrete coordinates |
OutOfMobilityFieldException |
Implements fpmas::api::model::GridAgentBase.
|
inlineoverridevirtual |
Returns the current location of the GridAgent as discrete coordinates.
The behavior of this method is similar to the SpatialAgent::locationId() method: considering the moveTo(DiscretePoint) method, the agent can move using this kind of operations:
Implements fpmas::api::model::GridAgentBase.
|
inlineoverridevirtual |
Returns a reference to the sequential random number bound to this agent.
The implementation should ensure that each agent produces an indenpendent random number sequence.
This can be perfomed:
Implements fpmas::api::model::RandomAgent.
|
inlineoverridevirtual |
Seeds the generator bound to this agent.
Implements fpmas::api::model::RandomAgent.