You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would you like to enhance and why? Is it related to an issue/problem?
When the decisions of individuals are simulated for one period in _simulate_single_period, we apply the law of motion to get the states of the next period in simulate. The law of motion takes the current choice and advances experiences, previous choices and the period. Then, we have to map the advanced states to their state space indices with map_observations_to_states to get information like wages, etc. from the state space and simulate decisions in the next period.
In _simulate_single_period we have the current choice and the child indices. So, we can simply select the state space indices for the next period without using the law of motion.
_simulate_single_period could pass the child index along all other information back to _simulate. Then, the call to map_observations_to_states in simulate becomes obsolete.
Instead of current_df we could only pass the child indices to _simulate_single_period and the function collects the dataframe rows from the frames by itself.
Caveat
The general idea behind this change is to avoid costly computations especially when the law of motion is complex. At the same time, we are transforming an operation which is CPU bound to something which is IO bound because we have to read states from the disk. We need some testing and benchmarks to see where it pays off.
The text was updated successfully, but these errors were encountered:
What would you like to enhance and why? Is it related to an issue/problem?
When the decisions of individuals are simulated for one period in
_simulate_single_period
, we apply the law of motion to get the states of the next period insimulate
. The law of motion takes the current choice and advances experiences, previous choices and the period. Then, we have to map the advanced states to their state space indices withmap_observations_to_states
to get information like wages, etc. from the state space and simulate decisions in the next period.Describe the solution you'd like
As @mo2561057 noted in #373 (comment), we can take a short-cut.
_simulate_single_period
we have the current choice and the child indices. So, we can simply select the state space indices for the next period without using the law of motion._simulate_single_period
could pass the child index along all other information back to_simulate
. Then, the call tomap_observations_to_states
insimulate
becomes obsolete.current_df
we could only pass the child indices to_simulate_single_period
and the function collects the dataframe rows from the frames by itself.Caveat
The general idea behind this change is to avoid costly computations especially when the law of motion is complex. At the same time, we are transforming an operation which is CPU bound to something which is IO bound because we have to read states from the disk. We need some testing and benchmarks to see where it pays off.
The text was updated successfully, but these errors were encountered: