Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Enumerations | Functions | Variables
SelectionModes
Collaboration diagram for SelectionModes:

Enumerations

enum class  Utopia::SelectionMode {
  Utopia::SelectionMode::condition = 0 , Utopia::SelectionMode::sample = 1 , Utopia::SelectionMode::probability = 2 , Utopia::SelectionMode::clustered_simple = 20 ,
  Utopia::SelectionMode::position = 100 , Utopia::SelectionMode::boundary = 101 , Utopia::SelectionMode::lanes = 102
}
 Possible selection modes; availability depends on choice of manager. More...
 

Functions

std::string Utopia::selection_mode_to_string (const SelectionMode &mode)
 Given a SelectionMode enum value, return the corresponding string key.
 

Variables

const std::map< std::string, SelectionModeUtopia::selection_mode_map
 A map from strings to Select enum values.
 

Detailed Description

Enumeration Type Documentation

◆ SelectionMode

Possible selection modes; availability depends on choice of manager.

For further details, consult the actual implementations.

Warning
Associated integer values may be subject to change.
Enumerator
condition 

Select if a condition is fulfilled.

sample 

Select a random sample of entities with a known sample size.

probability 

Select an entity with a given probability.

clustered_simple 

Select entity clusters using a simple neighborhood-based algorithm.

Uses the "simple" algorithm: From a given start population, iterate over neighbors and attach them with a certain probability.

Note
Currently only implemented for CellManager, but expandable to all managers that provide a neighborhood interface for the entities they manage.
position 

(For CellManager only) Selects cells at given positions in space

boundary 

(For CellManager only) Select the boundary cells of a grid

lanes 

(For CellManager only) Selects horizontal or vertical lanes of cells

78 {
79 // .. Working on entities . . . . . . . . . . . . . . . . . . . . . . . . .
81 condition = 0,
82
84 sample = 1,
85
87 probability = 2,
88
89 // .. Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90 // (Offset by 20 to accomodate different algorithms)
92
100
101 // .. Only relevant for CellManager . . . . . . . . . . . . . . . . . . . .
102 // (Offset by 100)
104 position = 100,
105
107 boundary = 101,
108
110 lanes = 102
111
112 // .. Only relevant for AgentManager . . . . . . . . . . . . . . . . . . .
113 // (Offset by 200)
114
115 // .. Only relevant for GraphManager . . . . . . . . . . . . . . . . . . .
116 // (Offset by 300)
117
118 // NOTE When adding new enum members, take care to update the
119 // select_key_map!
120};
@ lanes
(For CellManager only) Selects horizontal or vertical lanes of cells
@ condition
Select if a condition is fulfilled.
@ position
(For CellManager only) Selects cells at given positions in space
@ sample
Select a random sample of entities with a known sample size.
@ probability
Select an entity with a given probability.
@ boundary
(For CellManager only) Select the boundary cells of a grid
@ clustered_simple
Select entity clusters using a simple neighborhood-based algorithm.

Function Documentation

◆ selection_mode_to_string()

std::string Utopia::selection_mode_to_string ( const SelectionMode mode)

Given a SelectionMode enum value, return the corresponding string key.

This iterates over the selection_mode_map and returns the first key that matches the given enum value.

143 {
144 for (const auto& m : selection_mode_map) {
145 if (m.second == mode) {
146 return m.first;
147 }
148 }
149 // Entry is missing; this should not happen, as the map is meant to
150 // include all possible enum values. Inform about it ...
151 throw std::invalid_argument("The given entity selection mode is not "
152 "available! Are all SelectionMode values represented in the map?");
153};
const std::map< std::string, SelectionMode > selection_mode_map
A map from strings to Select enum values.
Definition select.hh:124

Variable Documentation

◆ selection_mode_map

const std::map<std::string, SelectionMode> Utopia::selection_mode_map
Initial value:
{
{"condition", SelectionMode::condition},
{"sample", SelectionMode::sample},
{"probability", SelectionMode::probability},
{"position", SelectionMode::position},
{"boundary", SelectionMode::boundary},
{"lanes", SelectionMode::lanes},
{"clustered_simple", SelectionMode::clustered_simple}
}

A map from strings to Select enum values.

124 {
125 // General
126 {"condition", SelectionMode::condition},
127 {"sample", SelectionMode::sample},
128 {"probability", SelectionMode::probability},
129
130 // CellManager
131 {"position", SelectionMode::position},
132 {"boundary", SelectionMode::boundary},
133 {"lanes", SelectionMode::lanes},
134
135 // Clustered
136 {"clustered_simple", SelectionMode::clustered_simple}
137};