HARK icon indicating copy to clipboard operation
HARK copied to clipboard

Serializing HARK Solutions for export/import

Open sbenthall opened this issue 2 years ago • 0 comments

In a downstream application (SHARKFin), we are running into a situation where we need to export a HARK solution to disk memory and import it again later. (This is so that solutions can be computed in one job on the cloud, and then used in simulations in a different job.)

It's not clear whether HARK currently supports this. HARK Solutions are currently Python objects whose attributes are other, function-like objects (interpolations, I believe). It may be possible to simply pickle these solutions and unpickle them.

@alanlujan91 and I have both been working on different solution architectures based on xarray that are maybe more promising. In these designs (Alan's and mine are slightly different, IIRC), the solution object has a more accessible representation of the underlying data from which functions (e.g. consumption, value, marginal value, etc.) are interpolated. This underlying data structure would be easier to export/import, as xarray has broad support for this sort of thing.

sbenthall avatar Jan 13 '23 15:01 sbenthall