The State Space#

The implementation of the state space in respy allows the user to solve and analyze a wide range of models in an efficient way by storing the essential information about the model and by acting as a precise and simple interface between different components of the model. First and foremost a state space contains a register all possible states of the universe that a particular models allows for. Once a model contains a rich set of features it is vital to not repeat information such as to keep the analysis efficient. respy defines full states implicitly as combinations of more coarse states to avoid any duplication. Furthermore we group states in a way such that all members of one group are treated symmetrically throughout the model solution. The state space moreover contains a set of methods that facilitate required communications between different state space groups. This guide contains an explanation the most important components of the state space.

The Core State Space#

ads

Dense Grid#

The dense grid is a list that contains all states of dense variables. A dense variable is not a deterministic function of past choices and time. Adding another dense variables essentially copies the full state space. The disjunction makes use of this property. By expressing a state as a combination of a dense and a core state we avoid several duplications.

Dense State Space#

The dense state space is the full state space that contains all admissible states. respy does not store the full dense state space explicitly. The concept is nevertheless important since the model solution essentially loops through each dense state.

Period Choice Cores#

The interface of respy allows for flexible choice sets. The period choice core maps period and choice set to a set of core states.

Dense Period Choice Cores#

The period choice core maps period and choice set and dense index to a set of core states. This is the separation of states that the model solution loops over. All of the state space operations work symmetrically on all states within one period. The same mapping is applied to generate the full set of covariates, they are all called at the same time during the backward induction procedure (reordering would not matter) and they all use the same rule to obtain continuation value. That is the reason why they are stored together and why the model solution loops over period and all dense_period_choice_cores within that period perform their operations in parallel.

State Space Location Indices#

To create the state space and to store information efficiently we build simple indices of the objects introduced above. In general we call location indices indices if the defining mapping is injective and keys if the defining mapping is not injective.

Core Indices#

Core indices are row indices for states in the core state space. They are continued over different periods and choice sets in the core.

Core Key#

A core_key is an index for a set of states in the core state space which are in the same period and share the same choice set.

Dense Vector#

A dense vector is combination of values in the dense dimensions.

Dense Index#

A dense index is a position in the dense grid.

Dense Key#

A dense_key is an index for a set of states in the dense state space which are in the same period, share the same choice set, and the same dense vector.

Complex#

A complex key is the basis for core_key and dense_key it is a tuple of a period and a tuple for the choice set which contains booleans for whether a choice is available. The complex index for a dense index also contains the dense vector in the last position.

State Space Methods#

Several methods facilitate communication between different groups in the state space. They are shortly introduced in turn:

Collect Child Indices#

This function assigns each state a function that maps choices into child states.

Get Continuation Values#

This method uses collect child indices to assign each state a function that maps choices into continuation values.