Skip to content

Commit

Permalink
Merge pull request #210 from pph-collective/exit-enter-docs
Browse files Browse the repository at this point in the history
docs(enter_exit): update docstrings for entrance and exit
  • Loading branch information
s-bessey authored Dec 22, 2021
2 parents 4bf3b6a + fd4ab03 commit eee1937
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins:
heading_level: 3
watch:
- titan
- run_titan.py

markdown_extensions:
- admonition
Expand Down
11 changes: 10 additions & 1 deletion titan/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def update_all_agents(self):
1. End relationships with no remaining duration
2. Agent exit/entrance
2. Agent exit/entrance with [exit][titan.model.TITAN.exit] and [enter][titan.model.TITAN.enter]
3. Agent migration (if enabled)
4. Update partner assignments (create new relationships as needed)
5. Create an agent zero (if enabled and the time is right)
Expand Down Expand Up @@ -367,6 +367,9 @@ def agents_interact(self, rel: "ag.Relationship"):
def exit(self):
"""
Allow agents to exit model.
Determine probability of agent exit based on demographics for each model
exit class [params.classes.exit] and remove agent from the model as necessary.
"""
if self.exits == {}:
return
Expand Down Expand Up @@ -422,6 +425,12 @@ def exit(self):
def enter(self):
"""
Create new agents and/or replace exited agents.
Based on enter/exit pairs [params.enter_exit], create new agents through the following strategies:
* new_agent: draw agent characteristics from model params
* replace: use exited agent's characteristics to get new characteristics
"""
for strategy in self.params.enter_exit.values():
entrance = self.params.classes.enter[strategy.entry_class]
Expand Down

0 comments on commit eee1937

Please sign in to comment.