Skip to content

Commit

Permalink
Update the AgentCount parameter in distribute_params. Fixes SHARKFin …
Browse files Browse the repository at this point in the history
…issue 27
  • Loading branch information
Sebastian Benthall committed Dec 13, 2021
1 parent 91aaf4a commit 749ad8e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PR: [#832](https://github.com/econ-ark/HARK/pull/832). See [this forthcoming REM
* Fix mathematical limits of model example in `example_ConsPortfolioModel.ipynb` [#1047](https://github.com/econ-ark/HARK/pull/1047)
* Update `ConsGenIncProcessModel.py` to use `calc_expectation` method [#1072](https://github.com/econ-ark/HARK/pull/1072)
* Fix bug in `calc_normal_style_pars_from_lognormal_pars` due to math error. [#1076](https://github.com/econ-ark/HARK/pull/1076)
* Fix bug in `distribute_params` so that `AgentCount` parameter is updated.

### 0.11.0

Expand Down
2 changes: 1 addition & 1 deletion HARK/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ def distribute_params(agent, param_name, param_count, distribution):
agent_set = [deepcopy(agent) for i in range(param_count)]

for j in range(param_count):
agent_set[j].AgentCount = int(agent.AgentCount * param_dist.pmf[j])
agent_set[j].assign_parameters(**{'AgentCount': int(agent.AgentCount * param_dist.pmf[j])})
# agent_set[j].__dict__[param_name] = param_dist.X[j]

agent_set[j].assign_parameters(**{param_name: param_dist.X[j]})
Expand Down
1 change: 1 addition & 0 deletions HARK/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@ def test_distribute_params(self):

self.assertTrue(all(['DiscFac' in agent.parameters for agent in self.agents]))
self.assertTrue(all([self.agents[i].parameters['DiscFac'] == dist.approx(3).X[i] for i in range(3)]))
self.assertEqual(self.agents[0].parameters['AgentCount'], 1)


0 comments on commit 749ad8e

Please sign in to comment.