|
| Model (api::model::AgentGraph &graph, api::scheduler::Scheduler &scheduler, api::runtime::Runtime &runtime, api::model::LoadBalancing &load_balancing) |
|
| Model (const Model &)=delete |
|
| Model (Model &&)=delete |
|
Model & | operator= (const Model &)=delete |
|
Model & | operator= (Model &&)=delete |
|
api::model::AgentGraph & | graph () override |
|
const api::model::AgentGraph & | graph () const override |
|
api::scheduler::Scheduler & | scheduler () override |
|
const api::scheduler::Scheduler & | scheduler () const override |
|
api::runtime::Runtime & | runtime () override |
|
const api::runtime::Runtime & | runtime () const override |
|
const scheduler::Job & | loadBalancingJob () const override |
|
api::model::AgentGroup & | buildGroup (api::model::GroupId id) override |
|
api::model::AgentGroup & | buildGroup (api::model::GroupId id, const api::model::Behavior &behavior) override |
|
void | removeGroup (api::model::AgentGroup &group) override |
|
api::model::AgentGroup & | getGroup (api::model::GroupId id) const override |
|
const std::unordered_map< GroupId, api::model::AgentGroup * > & | groups () const override |
|
AgentEdge * | link (api::model::Agent *src_agent, api::model::Agent *tgt_agent, api::graph::LayerId layer) override |
|
void | unlink (api::model::AgentEdge *edge) override |
|
api::communication::MpiCommunicator & | getMpiCommunicator () override |
|
const api::communication::MpiCommunicator & | getMpiCommunicator () const override |
|
void | clear () override |
|
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 |
|
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.
- Example
- Assuming
Agent1
and Agent2
are predefined user implemented Agents :
G_1, G_2
};
AgentGroup& group_1 = model.buildGroup(G_1);
AgentGroup& group_2 = model.buildGroup(G_2);
group_1.add(new Agent1);
group_2.add(new Agent2);
group_2.add(new Agent1);
model.scheduler().schedule(0, 1, group_1.job());
model.scheduler().schedule(0, 2, group_2.job());
virtual void add(Agent *agent)=0
int GroupId
Definition: model.h:78
- Parameters
-
Implements fpmas::api::model::Model.
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.
- Parameters
-
id | unique group id |
behavior | behavior to execute on agents of the group |
Implements fpmas::api::model::Model.