HARK
HARK copied to clipboard
Object for representation constraints on control variables / domain /optimization bounds
Often a control variable has a limited domain.
For example, c <= m
, or consumption must be less than current market resources.
This constraint is in effect a bound on the optimization problem as they agent chooses how much to consume.
Rather than have this constraint be hard-coded into each model's solution code, it would be better if information about this bounds were part of model configuration.
The scipy
library has a dedicated Bounds
object for precisely this purpose. (It also has Constraint
objects; I'm not sure how these are used differently.)
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.Bounds.html https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.LinearConstraint.html?highlight=constraint#scipy.optimize.LinearConstraint
A difference between scipy's Bound
object and what we would need is that Bound
uses arrays of floats, whereas the information we need is a relation between model variables that would be instantiated as something like a Bound when the optimization is performed.
I believe this functionality is called the Domain in the Dolo syntax:
https://github.com/EconForge/dolo.py/blob/bde421efe00ecc7cb78b2cead1594b0729aa3a7c/doc/source/modeling_language.rst#domain-section
Maybe there is some part of Dolo that we could use for this feature.