Partnering
get_mean_rel_duration(params)
Find the average partnership duration by bond type
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
ObjMap
|
The current model's parameters |
required |
Source code in titan/partnering.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
get_partnership_duration(params, rand_gen, bond_type, race)
Get duration of a relationship drawn from bins or a distribution per the params [params.partnership.duration]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
ObjMap
|
model parameters |
required |
rand_gen |
np random number generator |
required | |
bond_type |
str
|
type of bond for the relationship whose duration is being determined |
required |
Returns:
Type | Description |
---|---|
int
|
number of time steps the partnership should endure |
Source code in titan/partnering.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
|
select_partner(agent, partnerable_agents, sex_partners, pwid_agents, params, rand_gen, bond_type)
Get a partner for the agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent |
agent in need of a partner |
required | |
partnerable_agents |
Set[Agent]
|
agents that can be selected as a partner |
required |
sex_partners |
Dict
|
mapping from sex_type to agents in the population that can sleep with that sex_type |
required |
pwid_agents |
AgentSet
|
agents with |
required |
params |
ObjMap
|
model parameters |
required |
rand_gen |
random number generator |
required | |
bond_type |
str
|
type of relationship that is being formed with the partner |
required |
Returns:
Type | Description |
---|---|
Optional[Agent]
|
new partner or |
Source code in titan/partnering.py
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 |
|
sex_possible(agent_sex_type, partner_sex_type, sex_types)
Determine if sex is possible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent_sex_type |
str
|
name of agent's sex type |
required |
partner_sex_type |
str
|
name of partner's sex type |
required |
sex_types |
ObjMap
|
params defining in scope sex types |
required |
Returns:
Type | Description |
---|---|
bool
|
whether sex is possible between agents of these sex types |
Source code in titan/partnering.py
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 |
|