Skip to content

Commit

Permalink
updating RNG and income process for double agents in exploded Sharkfi…
Browse files Browse the repository at this point in the history
…n population
  • Loading branch information
sbenthall committed Feb 7, 2024
1 parent 234b3ef commit 1d5d961
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sharkfin/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def explode_agents(self, num):
for j in range(num):
double_agent = deepcopy(agent)
double_agent.seed = rng.integers(0, 2**31 - 1)
double_agent.reset_rng()
double_agent.update_income_process()
exploded_agents.append(double_agent)
exploded_dicts.append(deepcopy(self.population_parameters[i]))

Expand Down
4 changes: 2 additions & 2 deletions sharkfin/tests/test_population_seed_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_random_seeds():
p2a0 = pop1.agent_database["agents"][0]

### Different income seeds within one population
assert(p1a0.PermShkStd.seed != p1a1.PermShkStd.seed)
assert(p1a0.PermShkDstn.seed != p1a1.PermShkDstn.seed)

### Different income seeds across two populations with different seeds
assert(p1a0.PermShkStd.seed != p2a0.PermShkStd.seed)
assert(p1a0.PermShkDstn.seed != p2a0.PermShkDstn.seed)

0 comments on commit 1d5d961

Please sign in to comment.