fpmas-metamodel 1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MetaAgent< AgentBase, PerceptionRange > Class Template Reference

#include <agent.h>

Inheritance diagram for MetaAgent< AgentBase, PerceptionRange >:
Inheritance graph
[legend]
Collaboration diagram for MetaAgent< AgentBase, PerceptionRange >:
Collaboration graph
[legend]

Public Member Functions

 MetaAgent ()
 
 MetaAgent (const std::deque< DistributedId > &contacts)
 
 FPMAS_MOBILITY_RANGE (range)
 
 FPMAS_PERCEPTION_RANGE (range)
 
void create_relations_from_neighborhood ()
 
void create_relations_from_contacts ()
 
void handle_new_contacts ()
 
void move ()
 
const fpmas::api::model::AgentNode * agentNode () const override
 
- Public Member Functions inherited from MetaAgentBase
bool is_in_contacts (DistributedId id)
 
virtual const fpmas::api::model::AgentNode * agentNode () const =0
 
 MetaAgentBase ()
 
 MetaAgentBase (const std::deque< DistributedId > &contacts)
 
const std::deque< DistributedId > & contacts () const
 

Additional Inherited Members

- Static Public Attributes inherited from MetaAgentBase
static std::size_t max_contacts
 
static std::size_t range_size
 
static float contact_weight
 
static MovePolicy move_policy
 
- Protected Member Functions inherited from MetaAgentBase
std::deque< DistributedId > & contacts ()
 

Detailed Description

template<typename AgentBase, typename PerceptionRange>
class MetaAgent< AgentBase, PerceptionRange >

Generic MetaAgentBase implementation.

The create_relations_neighbors_group() and create_relations_from_contacts() are behaviors that can be used to make the graph of contacts evolve.

Template Parameters
AgentBaseimplemented agent interface (fpmas::api::model::GridAgent<...,> or fpmas::api::model::SpatialAgent<...,>)
PerceptionRangetype of mobility and perception range, according to the model type

Constructor & Destructor Documentation

◆ MetaAgent() [1/2]

template<typename AgentBase , typename PerceptionRange >
MetaAgent< AgentBase, PerceptionRange >::MetaAgent ( )
inline

MetaAgent default constructor.

◆ MetaAgent() [2/2]

template<typename AgentBase , typename PerceptionRange >
MetaAgent< AgentBase, PerceptionRange >::MetaAgent ( const std::deque< DistributedId > &  contacts)
inline

MetaAgent constructor.

Parameters
contactsInitial list of contacts

Member Function Documentation

◆ FPMAS_MOBILITY_RANGE()

template<typename AgentBase , typename PerceptionRange >
MetaAgent< AgentBase, PerceptionRange >::FPMAS_MOBILITY_RANGE ( range  )

FPMAS mobility range set up.

◆ FPMAS_PERCEPTION_RANGE()

template<typename AgentBase , typename PerceptionRange >
MetaAgent< AgentBase, PerceptionRange >::FPMAS_PERCEPTION_RANGE ( range  )

FPMAS perception range set up.

◆ create_relations_from_neighborhood()

template<typename AgentBase , typename PerceptionRange >
void MetaAgent< AgentBase, PerceptionRange >::create_relations_from_neighborhood

Picks a random agent in the current perceptions and adds it to the contact list.

If the list was full, the oldest contact is removed.

◆ create_relations_from_contacts()

template<typename AgentBase , typename PerceptionRange >
void MetaAgent< AgentBase, PerceptionRange >::create_relations_from_contacts

Puts two random contacts in relation.

First, a random contact A is selected. Then, attempts to find a random contact B that is not already a contact of A.

If such a contact is found, a link from A to B is created on the NEW_CONTACT layer. Such links must then be handled from A thanks to the handle_new_contacts() method, after a synchronization has been performed (to ensure links migration).

◆ handle_new_contacts()

template<typename AgentBase , typename PerceptionRange >
void MetaAgent< AgentBase, PerceptionRange >::handle_new_contacts

Adds new contacts to the contact list from the NEW_CONTACT layer.

If the contact list is full, oldest contacts are removed to make enough space for new contacts.

◆ move()

template<typename AgentBase , typename PerceptionRange >
void MetaAgent< AgentBase, PerceptionRange >::move

Moves to the next cell according to the current MovePolicy.

◆ agentNode()

template<typename AgentBase , typename PerceptionRange >
const fpmas::api::model::AgentNode * MetaAgent< AgentBase, PerceptionRange >::agentNode ( ) const
inlineoverridevirtual

Returns a pointer to the node containing the agent.

Implements MetaAgentBase.


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