Location
Locations can be used in TITAN to differentiate agents by "geography". The primary features of locations are:
- Differentiated parameters via location scaling/overrides
- Allows different demographics or interventions by location
- See params app for details
- Location based assorting (including based on neighboring locations)
- Can have agents assort with agents from their own location vs neighbors vs all others
- Neighboring locations are determined by the
edges
defined inparams.location
- See params app for details on assorting rules
- It is also possible to define edges via a geography CSV (see utils). This is also exposed via the
grid2edges
command line utility (rungrid2edges --help
for usage).
- Migration between locations
- When an agent migrates locations, they adopt the parameters of their new location
- Migration can cause the population numbers in a location to drift over time
- See params app for details
Location
Source code in titan/location.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
__init__(name, defn, params)
This class constructs and represents a location within the model. A location can have an arbitrary geographic granularity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
name of the location |
required |
defn |
ObjMap
|
definition for this location |
required |
params |
ObjMap
|
model parameters |
required |
Source code in titan/location.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
create_params(params)
Scale or override the generic parameters with any location based scaling from params.location.scaling
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
ObjMap
|
model parameters |
required |
Returns:
Type | Description |
---|---|
ObjMap
|
new parameter object with scaled values for this location |
Source code in titan/location.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
init_weights()
Create the containers to hold values and weights for randomly selecting:
- sex_role
- drug_type
- race
- sex_type
Source code in titan/location.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
LocationEdge
Source code in titan/location.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__init__(loc1, loc2, distance, id=None)
Construct a location edge, which holds attributes that relate two Locations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loc1 |
Location
|
the first location |
required |
loc2 |
Location
|
the other location |
required |
distance |
float
|
a measure of distance between the locations |
required |
id |
Optional[int]
|
a unique identifier for this edge |
None
|
Source code in titan/location.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
Geography
Source code in titan/location.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
__init__(params)
Umbrella class to initialize/store locations and location edges for a population
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
ObjMap
|
model parameters |
required |
Source code in titan/location.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|