shade-econ / sequence-jacobian

A unified framework to solve and analyze heterogeneous-agent macro models.
MIT License
253 stars 149 forks source link

Problem with using multiple HetBlocks -- can only have one 'D' in steady state dict #4

Closed wilburtownsend closed 3 years ago

wilburtownsend commented 3 years ago

Hi there. I'm a student in Ludwig's grad class and am using these packages for my term paper. My application has multiple HetBlocks (representing households in different locations). However, the package stores the steady state distribution of the HetBlock in the steady state dictionary under key 'D'. I think that prevents us from having multiple HetBlocks with different steady state distributions.

An easy solution would be to add a D_name attribute to the HetBlock class containing the name of the steady state distribution. Then each reference to ss['D'] could be replaced with ss[self.D_name]. Lmk if you'd like me to make & push that change.

caimichael commented 3 years ago

Hey Wilbur,

Yes you're right that currently the distribution name is hard-coded as "D", which induces issues when using multiple HetBlocks. We're actually in the process of doing a fairly major refactor, part of which will include separating namespaces of the distributional variables output by HetBlocks as part of a new steady state output container, so this will be a feature of an updated package a little bit down the road.

If for now it's convenient for you to just use a hot fix in your own copy of the repository, we will make a new release (hopefully in the next month or two) that will handle these name clashes.

Michael

wilburtownsend commented 3 years ago

Sure that makes sense :)