RepastHPC
2.3.1
|
Collection of agents of type T with set semantics. More...
#include <Context.h>
Public Types | |
typedef boost::transform_iterator< SecondElement< T >, typename AgentMap::const_iterator > | const_iterator |
typedef boost::filter_iterator< IsAgentType< T >, typename Context< T >::const_iterator > | const_bytype_iterator |
Public Member Functions | |
virtual | ~Context () |
Destroys this context and the projections it contains. | |
T * | addAgent (T *agent) |
Adds the agent to the context. More... | |
virtual void | addProjection (Projection< T > *projection) |
Adds the specified projection to this context. More... | |
Projection< T > * | getProjection (const std::string &name) |
Get the named Projection. More... | |
void | removeAgent (const AgentId id) |
Removes the specified agent from this context. More... | |
void | removeAgent (T *agent) |
Removes the specified agent from this context. | |
T * | getAgent (const AgentId &id) |
Gets the specified agent. More... | |
void | getRandomAgents (const int count, std::vector< T * > &agents) |
Gets at random the specified count of agents and returns them in the agents vector. More... | |
const_iterator | begin () const |
Gets the start of iterator over the agents in this context. More... | |
const_iterator | end () const |
Gets the end of an iterator over the agents in this context. More... | |
const_bytype_iterator | byTypeBegin (int typeId) const |
Gets the start of an iterator over agents in this context of the specified type. More... | |
const_bytype_iterator | byTypeEnd (int typeId) const |
Gets the end of an iterator over agents in this context of the specified type. More... | |
bool | contains (const AgentId &id) |
Returns true if the specified agent is in this context, otherwise false. | |
int | size () const |
Gets the size (number of agents) in this context. | |
void | addValueLayer (BaseValueLayer *valueLayer) |
Adds a value layer to this context. More... | |
template<typename ValueType , typename Borders > | |
DiscreteValueLayer< ValueType, Borders > * | getDiscreteValueLayer (const std::string &valueLayerName) |
Gets the named discrete value layer from this Context. More... | |
template<typename ValueType , typename Borders > | |
ContinuousValueLayer< ValueType, Borders > * | getContinuousValueLayer (const std::string &valueLayerName) |
Gets the named continuous value layer from this Context. More... | |
template<typename filterStruct > | |
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > | filteredBegin (const filterStruct &fStruct) |
template<typename filterStruct > | |
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > | filteredEnd (const filterStruct &fStruct) |
Creates a filtered iterator over the set of agents in this context and returns it with a value equal to one step past end of the list. More... | |
template<typename filterStruct > | |
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > | byTypeFilteredBegin (const int type, const filterStruct &fStruct) |
Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to the beginning of the list. More... | |
template<typename filterStruct > | |
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > | byTypeFilteredEnd (const int type, const filterStruct &fStruct) |
Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to one past the end of the list. More... | |
void | selectAgents (std::set< T * > &selectedAgents, bool remove=false) |
Gets a set of pointers to all agents in this context. More... | |
void | selectAgents (std::vector< T * > &selectedAgents, bool remove=false) |
Gets a randomly ordered vector of pointers to all agents in this context. More... | |
void | selectAgents (int count, std::set< T * > &selectedAgents, bool remove=false) |
Gets a set of pointers to a specified number of randomly selected agents. More... | |
void | selectAgents (int count, std::vector< T * > &selectedAgents, bool remove=false) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents. More... | |
void | selectAgents (std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1) |
Gets a set of pointers to all agents in this context of a specified type (per their AgentId values). More... | |
void | selectAgents (std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values). More... | |
void | selectAgents (int count, std::set< T * > &selectedAgents, int type, bool remove=false, int popSize=-1) |
Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values). More... | |
void | selectAgents (int count, std::vector< T * > &selectedAgents, int type, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values). More... | |
template<typename filterStruct > | |
void | selectAgents (std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a set of pointers to all agents in this context matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to all agents in this context matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (int count, std::set< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a set of pointers to a specified number of randomly selected agents matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (int count, std::vector< T * > &selectedAgents, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a set of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (int count, std::set< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter. More... | |
template<typename filterStruct > | |
void | selectAgents (int count, std::vector< T * > &selectedAgents, int type, filterStruct &filter, bool remove=false, int popSize=-1) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter. More... | |
void | getProjectionInfo (AgentRequest req, std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > &map, bool secondaryInfo=false, std::set< AgentId > *secondaryIds=0, int destProc=-1) |
Gets the projection information for all projections in this context, for all agents whose IDs are listed in the AgentRequest. More... | |
void | setProjectionInfo (std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > &projInfo) |
Sets the projection information as specified. More... | |
void | cleanProjectionInfo (std::set< AgentId > &agentsToKeep) |
Protected Attributes | |
std::vector< Projection< T > * > | projections |
Collection of agents of type T with set semantics.
Object identity and equality is determined by their AgentId.
the | type objects contained by the Context. The T must extends repast::Agent. |
T * repast::Context< T >::addAgent | ( | T * | agent | ) |
Adds the agent to the context.
Performs a check to ensure that no agent with the same ID (presumably the 'same' agent) has previously been added. If a matching ID is found, the new agent is not added, and the address of the pre-existing agent is returned. If no match is found, the agent is added and the return value is the same as the value passed
agent | the agent to add |
|
virtual |
Adds the specified projection to this context.
All the agents in this context will be added to the Projection. Any agents subsequently added to this context will also be added to the Projection.
projection | the projection to add |
Reimplemented in repast::SharedContext< T >, and repast::SharedContext< repast::relogo::RelogoAgent >.
void repast::Context< T >::addValueLayer | ( | BaseValueLayer * | valueLayer | ) |
Adds a value layer to this context.
valueLayer | the value layer to add |
|
inline |
Gets the start of iterator over the agents in this context.
The iterator derefrences into shared_ptr<T>. The actual agent can be accessed by derefrenceing the iter: (*iter)->getId() for example.
|
inline |
Gets the start of an iterator over agents in this context of the specified type.
The type corresponds to the type component of an agent's AgentId.
typeId | the type of the agent. Only Agents whose agentId.agentType() is equal to this typeId will be included in the iterator |
|
inline |
Gets the end of an iterator over agents in this context of the specified type.
The type corresponds to the type component of an agent's AgentId.
typeId | the type of the agent. Only Agents whose agentId.agentType() is equal to this typeId will be included in the iterator |
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > repast::Context< T >::byTypeFilteredBegin | ( | const int | type, |
const filterStruct & | fStruct | ||
) |
Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to the beginning of the list.
The struct can be any user-defined structure that implements a unary operator (see IsAgentType) that can be passed and which will become a filter to sort across the agent list, e.g.:
struct filter { bool operator()(const boost::shared_ptr<T>& ptr){ return (ptr->getAgentValue() == targetValue;) } }
This should allow filtering of agents by type and on any attribute.
fStruct | an instance of the struct to be used as the filter |
type | the numeric type of agents to be included in the list |
filterStruct | the type of the filter to be applied to the agents |
boost::filter_iterator< filterStruct, typename Context< T >::const_bytype_iterator > repast::Context< T >::byTypeFilteredEnd | ( | const int | type, |
const filterStruct & | fStruct | ||
) |
Creates a filtered iterator over the set of agents in this context of the specified type (per their AgentId values), and returns it with a value equal to one past the end of the list.
The struct can be any user-defined structure that implements a unary operator (see IsAgentType) that can be passed and which will become a filter to sort across the agent list, e.g.:
struct filter { bool operator()(const boost::shared_ptr<T>& ptr){ return (ptr->getAgentValue() == targetValue;) } }
This should allow filtering of agents by type and on any attribute.
fStruct | an instance of the struct to be used as the filter |
type | the numeric type of agents to be included in the list |
filterStruct | the type of the filter to be applied to the agents |
|
inline |
Gets the end of an iterator over the agents in this context.
The iterator derefrences into shared_ptr<T>. The actual agent can be accessed by derefrenceing the iter: (*iter)->getId() for example.
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > repast::Context< T >::filteredBegin | ( | const filterStruct & | fStruct | ) |
Creates a filtered iterator over the set of agents in this context and returns it with a value equal to the beginning of the list. The struct can be any user-defined structure that implements a unary operator (see IsAgentType) that can be passed and which will become a filter to sort across the agent
list, e.g.:
struct filter { bool operator()(const boost::shared_ptr<T>& ptr){ return (ptr->getAgentValue() == targetValue;) } }
This should allow filtering of agents by any attribute.
fStruct | an instance of the struct to be used as the filter @tparam filterStruct the type of the filter to be applied to the agents @return an iterator positioned at the beginning of the list of agents meeting the filter's criteria |
boost::filter_iterator< filterStruct, typename Context< T >::const_iterator > repast::Context< T >::filteredEnd | ( | const filterStruct & | fStruct | ) |
Creates a filtered iterator over the set of agents in this context and returns it with a value equal to one step past end of the list.
The struct can be any user-defined structure that implements a unary operator (see IsAgentType) that can be passed and which will become a filter to sort across the agent list, e.g.:
struct filter { bool operator()(const boost::shared_ptr<T>& ptr){ return (ptr->getAgentValue() == targetValue;) } }
This should allow filtering of agents by any attribute.
fStruct | an instance of the struct to be used as the filter |
filterStruct | the type of the filter to be applied to the agents |
T * repast::Context< T >::getAgent | ( | const AgentId & | id | ) |
Gets the specified agent.
the | id of the agent to get. |
ContinuousValueLayer< ValueType, Borders > * repast::Context< T >::getContinuousValueLayer | ( | const std::string & | valueLayerName | ) |
Gets the named continuous value layer from this Context.
The value layer must have been previously added.
valueLayerName | the name of the value layer to get |
ValueType | the numeric type contained by the value layer |
Borders | the Border type of the value layer |
DiscreteValueLayer< ValueType, Borders > * repast::Context< T >::getDiscreteValueLayer | ( | const std::string & | valueLayerName | ) |
Gets the named discrete value layer from this Context.
The value layer must have been previously added.
valueLayerName | the name of the value layer to get |
ValueType | the numeric type contained by the value layer |
Borders | the Border type of the value layer |
Projection< T > * repast::Context< T >::getProjection | ( | const std::string & | name | ) |
Get the named Projection.
the | name of the projection to get |
void repast::Context< T >::getProjectionInfo | ( | AgentRequest | req, |
std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > & | map, | ||
bool | secondaryInfo = false , |
||
std::set< AgentId > * | secondaryIds = 0 , |
||
int | destProc = -1 |
||
) |
Gets the projection information for all projections in this context, for all agents whose IDs are listed in the AgentRequest.
The general sense of this method can be easily understood: given a list of agents, get the projection information for all of those agents. But there are some subtleties that should be kept in mind.
"The projection information for an agent" is misleading. In fact, the projection information that is needed can vary depending on the context and on the kind of projection.
Generally speaking, spaces return only one kind projection information: coordinate locations for the agent specified. This is the simplest case.
The more complicated case is given by graphs. A graph projection can return different sets of information depending on how that information will have to be used. The basic issue is that a graph projection returns sets of edges, and edges must be connected to other agents; this means that a mechanism must be in place for ensuring that the projection info that arrives can be used, which means that for a given 'ego' agent, all 'alter' agents that are connected to it by edges must also be on the receiving process. (Note: Repast HPC 1.0 versions sent all of the alter agents' content along with the edge send; this version does not do this, partly to minimize the amount of information being packaged and sent but also because the alternative method used is integrated with the normal bookkeeping for sharing agent information across processes (AgentRequests).) In different circumstances, different assumptions can be made about what information will be available on the receiving process. Note that the coordinate information is generally referred to as 'Primary' information, while edge information is 'secondary'; in a third category ('secondary IDs') are the IDs of the alter agents, which can be packaged separately.
The impact of this is that this function is generally called in the following ways:
1) When requesting agents: in this case, a copy of the agent will be sent from one process to another. No secondary information will be sent at all. This is because it is assumed that if an agent participated in a graph on the receiving process, it would already be present on that process and would not be being requested.
2) When synchronizing Projection Information: in this case, some secondary information (edges) is needed: the edges that connect the specified ego agent with edges on the receiving process. No secondary IDs are needed, because the only edges being sent are those that connect to agents on the receiving process, which will be assumed to already be available on that process.
3) When synchronizing Agent Status (moving agents from process to process): in this case, the full collection of projection information is needed, including all of the edges in which the specified agent participates and all of the secondary IDs. (The secondary IDs of agents that are already on the receiving process can be omitted, at least theoretically.) This allows the full reconstruction of Projection Information on the receiving process.
req | List of IDs for agents whose information is requested |
map | A map into which the projection information will be placed. Key values represent the names of the projections in this context. |
secondaryInfo | true if the 'secondary' projection info must also be returned |
secondaryIds | A set of IDs for agents who are referred to by the projection informaton being returned (may be null) |
destProc | The Process that will be receiving this information (the information sent may be customized depending on the destination process). If not specified a larger set of information will be sent. |
void repast::Context< T >::getRandomAgents | ( | const int | count, |
std::vector< T * > & | agents | ||
) |
Gets at random the specified count of agents and returns them in the agents vector.
count | the number of agents to get | |
[out] | agents | a vector where the agents will be returned |
void repast::Context< T >::removeAgent | ( | const AgentId | id | ) |
Removes the specified agent from this context.
id | the id of the agent to remove |
void repast::Context< T >::selectAgents | ( | int | count, |
std::set< T * > & | selectedAgents, | ||
bool | remove = false |
||
) |
Gets a set of pointers to a specified number of randomly selected agents.
If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) |
void repast::Context< T >::selectAgents | ( | int | count, |
std::set< T * > & | selectedAgents, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to a specified number of randomly selected agents matching a user-defined filter.
If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | int | count, |
std::set< T * > & | selectedAgents, | ||
int | type, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values).
If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
void repast::Context< T >::selectAgents | ( | int | count, |
std::set< T * > & | selectedAgents, | ||
int | type, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter.
If the set passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | int | count, |
std::vector< T * > & | selectedAgents, | ||
bool | remove = false |
||
) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents.
If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) |
void repast::Context< T >::selectAgents | ( | int | count, |
std::vector< T * > & | selectedAgents, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents matching a user-defined filter.
If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | int | count, |
std::vector< T * > & | selectedAgents, | ||
int | type, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values).
If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
void repast::Context< T >::selectAgents | ( | int | count, |
std::vector< T * > & | selectedAgents, | ||
int | type, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to a specified number of randomly selected agents of a specified type (per their AgentId values) and matching a user-defined filter.
If the vector passed contains any elements when this method is called, the agents pointed to by those elements will be omitted from the selection.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
count | the number of agents to be selected. If this exceeds the number that can possibly be selected, all possible agents will be selected | |
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | std::set< T * > & | selectedAgents, |
bool | remove = false |
||
) |
Gets a set of pointers to all agents in this context.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) |
void repast::Context< T >::selectAgents | ( | std::set< T * > & | selectedAgents, |
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to all agents in this context matching a user-defined filter.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
that can possibly be selected, all possible agents will be selected
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | std::set< T * > & | selectedAgents, |
int | type, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to all agents in this context of a specified type (per their AgentId values).
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
void repast::Context< T >::selectAgents | ( | std::set< T * > & | selectedAgents, |
int | type, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a set of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter.
If the 'remove' parameter is set to true, any elements in the original set will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
[out] | selectedAgents | a set into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | std::vector< T * > & | selectedAgents, |
bool | remove = false |
||
) |
Gets a randomly ordered vector of pointers to all agents in this context.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
remove | if true, remove any elements originally in the set before the set is returned (default is false) |
void repast::Context< T >::selectAgents | ( | std::vector< T * > & | selectedAgents, |
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to all agents in this context matching a user-defined filter.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::selectAgents | ( | std::vector< T * > & | selectedAgents, |
int | type, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values).
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
void repast::Context< T >::selectAgents | ( | std::vector< T * > & | selectedAgents, |
int | type, | ||
filterStruct & | filter, | ||
bool | remove = false , |
||
int | popSize = -1 |
||
) |
Gets a randomly ordered vector of pointers to all agents in this context of a specified type (per their AgentId values) and matching a user-defined filter.
If the 'remove' parameter is set to true, any elements in the original vector will be removed before the method returns.
The popSize parameter is used when the method is repeatedly called on a population whose size is known. Calls to this method typically begin by determining the size of the (valid) population to be sampled; if this is known, it can be provided here, improving performance.
[out] | selectedAgents | a vector into which the pointers to the agents will be placed |
type | numeric type of agent to be selected | |
filter | user-defined filter specifying any criteria agents to be selected must meet | |
remove | if true, remove any elements originally in the set before the set is returned (default is false) | |
popSize | size of the population from which the sample will be drawn |
filterStruct | the type of the filter to be applied to the agents |
void repast::Context< T >::setProjectionInfo | ( | std::map< std::string, std::vector< repast::ProjectionInfoPacket * > > & | projInfo | ) |
Sets the projection information as specified.
projInfo | map where keys represent projections in this context and the values represent collections of projection information content that will be used to specify the relationships among the agents. |