![]() |
fpmas 1.6
|
#include <model.h>
Public Member Functions | |
virtual AgentGraph & | graph ()=0 |
virtual const AgentGraph & | graph () const =0 |
virtual api::scheduler::Scheduler & | scheduler ()=0 |
virtual const api::scheduler::Scheduler & | scheduler () const =0 |
virtual api::runtime::Runtime & | runtime ()=0 |
virtual const api::runtime::Runtime & | runtime () const =0 |
virtual const api::scheduler::Job & | loadBalancingJob () const =0 |
virtual AgentGroup & | buildGroup (GroupId id)=0 |
virtual AgentGroup & | buildGroup (GroupId id, const Behavior &behavior)=0 |
virtual void | removeGroup (AgentGroup &group)=0 |
virtual AgentGroup & | getGroup (GroupId id) const =0 |
virtual const std::unordered_map< GroupId, AgentGroup * > & | groups () const =0 |
virtual AgentEdge * | link (Agent *src_agent, Agent *tgt_agent, api::graph::LayerId layer)=0 |
virtual void | unlink (AgentEdge *edge)=0 |
virtual api::communication::MpiCommunicator & | getMpiCommunicator ()=0 |
virtual const api::communication::MpiCommunicator & | getMpiCommunicator () const =0 |
virtual void | clear ()=0 |
Protected Member Functions | |
virtual void | insert (GroupId id, AgentGroup *group)=0 |
Model API.
A Model defines and instantiates all the components required to run an FPMAS Multi-Agent simulation.
|
protectedpure virtual |
Inserts an AgentGroup into this model.
id | id of the group |
group | agent group to insert |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Model's Runtime, used to execute the scheduler().
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Model's Runtime, used to execute the scheduler().
Implemented in fpmas::model::detail::Model.
|
pure virtual |
A predefined LoadBalancing Job.
This Job can be scheduled to define when and at which frequency the LoadBalancing algorithm (and the graph distribution) will be performed.
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Builds a new AgentGroup associated to this Model.
The user can add its own Agents to the built group, and schedule it so that Agents will be executed. More precisely, the default behavior defined by this group calls the Agent::act() method, that do nothing by default but can be overriden by the user. Other behaviors can be specified using the addGroup(GroupId, const Behavior&) method.
Notice that each AgentGroup is expected to be associated to a unique GroupId. The FPMAS_DEFINE_GROUPS() macro can be used to easily generate unique GroupIds.
Agent1
and Agent2
are predefined user implemented Agents : id | unique group id |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Builds a new AgentGroup associated to this Model.
The user can add its own Agents to the built group, and schedule it so that Agents will be executed.
Jobs generated by the build AgentGroup will execute the specified behavior
on agents contained in the group.
The behavior
s storage duration must be greater or equal to this AgentGroup storage duration.
Each AgentGroup is expected to be associated to a unique GroupId. The FPMAS_DEFINE_GROUPS() macro can be used to easily generate unique GroupIds.
id | unique group id |
behavior | behavior to execute on agents of the group |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Removes the specified group from the model.
All local agents are removed from group, and the group is deleted.
group | group to remove from the model |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Gets a reference to an AgentGroup previously created with buildGroup().
Behavior is undefined if the specified ID does not correspond to a previously built group.
id | group id |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Returns the map of AgentGroups currently defined in the Model.
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Defines a new relation from src_agent
to tgt_agent
on the given layer
, that can be interpreted as a relation type.
The FPMAS_DEFINE_LAYERS() macro can be used to easily generate LayerIds
.
src_agent | source agent |
tgt_agent | target agent |
layer | layer id |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Delete a previously defined agent relation, unlinking the corresponding edge.
edge | edge to unlink |
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Returns the MPI communicator used by this model.
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Returns the MPI communicator used by this model.
Implemented in fpmas::model::detail::Model.
|
pure virtual |
Erases all agents from the Model.
This is assumed to be performed by all the processes in the same epoch, even if the operation itself does not necessarily requires communications (since it is assumed that all agents are erased from any process anyway).
Implemented in fpmas::model::detail::Model.