Base class for environment. More...
#include <bases.h>
Public Member Functions | |
Env () | |
virtual | ~Env () |
virtual shared_ptr< PATCH > | generate_patch (MESH_ITEM) |
virtual shared_ptr< AGENT > | generate_agent (string class_name) |
A template class to generate patch. More... | |
virtual void | update_repo () |
A template class to generate agent. More... | |
void | setup_domain (vector< MESH_ITEM > mesh) |
Sets up the domain by creating patch objects in accordance to mesh objects. More... | |
void | setup_agents (map< string, unsigned > config) |
Creates agents and randomly distributes them in the simulation domain. More... | |
void | step_agents () |
Calls step function of agents. More... | |
void | step_patches () |
Calls step function of patches. More... | |
virtual void | update () |
Update the world. All built-in utilities such as Agent::order_move are executed here. More... | |
void | place_agent (shared_ptr< PATCH > patch, shared_ptr< AGENT > agent) |
Places the given agent in the given patch. Raises an exception if the patch is not available. More... | |
void | place_agent (unsigned patch_index, shared_ptr< AGENT > agent) |
Places the given agent in the given patch index. Raises an exception if the patch is not available. More... | |
void | place_agent_randomly (shared_ptr< AGENT > agent) |
Places the given agent randomly in the domain. Raises exception if no patch is available. More... | |
shared_ptr< PATCH > | find_empty_patch () |
Finds empty patches in the entire domain. More... | |
void | remove_agent (shared_ptr< AGENT > agent) |
void | process_switch () |
Process swtich requests. More... | |
void | process_hatch () |
Process hatch requests. More... | |
void | process_move () |
Process move requests. More... | |
void | process_disappear () |
Process disappear requests. More... | |
virtual void | step () |
map< string, unsigned > | count_agents () |
steps the simulation More... | |
double | memory_usage () |
Env () | |
virtual | ~Env () |
virtual shared_ptr< PATCH > | generate_patch (MESH_ITEM) |
virtual shared_ptr< AGENT > | generate_agent (string class_name) |
A template class to generate patch. More... | |
virtual void | update_repo () |
A template class to generate agent. More... | |
void | setup_domain (vector< MESH_ITEM > mesh) |
Sets up the domain by creating patch objects in accordance to mesh objects. More... | |
void | setup_agents (map< string, unsigned > config) |
Creates agents and randomly distributes them in the simulation domain. More... | |
void | step_agents () |
Calls step function of agents. More... | |
void | step_patches () |
Calls step function of patches. More... | |
virtual void | update () |
Update the world. All built-in utilities such as Agent::order_move are executed here. More... | |
void | place_agent (shared_ptr< PATCH > patch, shared_ptr< AGENT > agent) |
Places the given agent in the given patch. Raises an exception if the patch is not available. More... | |
void | place_agent (unsigned patch_index, shared_ptr< AGENT > agent) |
Places the given agent in the given patch index. Raises an exception if the patch is not available. More... | |
void | place_agent_randomly (shared_ptr< AGENT > agent) |
Places the given agent randomly in the domain. Raises exception if no patch is available. More... | |
shared_ptr< PATCH > | find_empty_patch () |
Finds empty patches in the entire domain. More... | |
void | remove_agent (shared_ptr< AGENT > agent) |
void | process_switch () |
Process swtich requests. More... | |
void | process_hatch () |
Process hatch requests. More... | |
void | process_move () |
Process move requests. More... | |
void | process_disappear () |
Process disappear requests. More... | |
virtual void | step () |
map< string, unsigned > | count_agents () |
steps the simulation More... | |
double | memory_usage () |
Public Attributes | |
std::map< std::string, unsigned > | agents_count |
Keeps the record the agents according to Agent::class_name . More... | |
std::set< string > | agent_classes |
stores a list of Agent::class_name . More... | |
vector< shared_ptr< AGENT > > | agents |
Agent container. More... | |
map< unsigned, shared_ptr< PATCH > > | patches |
Patch container. More... | |
Base class for environment.
Env class stores and coordinates agents and patches.
|
inline |
steps the simulation
Counts the agents according to Agent::class_name
.
map<string,unsigned> Env< ENV, AGENT, PATCH >::count_agents | ( | ) |
steps the simulation
Counts the agents according to Agent::class_name
.
|
inline |
shared_ptr<PATCH> Env< ENV, AGENT, PATCH >::find_empty_patch | ( | ) |
Finds empty patches in the entire domain.
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
void Env< ENV, AGENT, PATCH >::place_agent | ( | shared_ptr< PATCH > | patch, |
shared_ptr< AGENT > | agent | ||
) |
Places the given agent in the given patch. Raises an exception if the patch is not available.
|
inline |
void Env< ENV, AGENT, PATCH >::place_agent | ( | unsigned | patch_index, |
shared_ptr< AGENT > | agent | ||
) |
Places the given agent in the given patch index. Raises an exception if the patch is not available.
|
inline |
void Env< ENV, AGENT, PATCH >::place_agent_randomly | ( | shared_ptr< AGENT > | agent | ) |
Places the given agent randomly in the domain. Raises exception if no patch is available.
|
inline |
void Env< ENV, AGENT, PATCH >::process_disappear | ( | ) |
Process disappear requests.
|
inline |
void Env< ENV, AGENT, PATCH >::process_hatch | ( | ) |
Process hatch requests.
|
inline |
void Env< ENV, AGENT, PATCH >::process_move | ( | ) |
Process move requests.
|
inline |
void Env< ENV, AGENT, PATCH >::process_switch | ( | ) |
Process swtich requests.
|
inline |
|
inline |
|
inline |
void Env< ENV, AGENT, PATCH >::setup_agents | ( | map< string, unsigned > | config | ) |
Creates agents and randomly distributes them in the simulation domain.
void Env< ENV, AGENT, PATCH >::setup_domain | ( | vector< MESH_ITEM > | mesh | ) |
Sets up the domain by creating patch objects in accordance to mesh objects.
|
inlinevirtual |
|
inlinevirtual |
|
inline |
void Env< ENV, AGENT, PATCH >::step_agents | ( | ) |
Calls step function of agents.
|
inline |
void Env< ENV, AGENT, PATCH >::step_patches | ( | ) |
Calls step function of patches.
|
inlinevirtual |
Update the world. All built-in utilities such as Agent::order_move
are executed here.
move
hatch
switch
process disappearing
|
virtual |
Update the world. All built-in utilities such as Agent::order_move
are executed here.
|
inlinevirtual |
|
inlinevirtual |
std::set< string > Env< ENV, AGENT, PATCH >::agent_classes |
stores a list of Agent::class_name
.
vector< shared_ptr< AGENT > > Env< ENV, AGENT, PATCH >::agents |
std::map< std::string, unsigned > Env< ENV, AGENT, PATCH >::agents_count |
Keeps the record the agents according to Agent::class_name
.
map< unsigned, shared_ptr< PATCH > > Env< ENV, AGENT, PATCH >::patches |