Skip to content

Commit

Permalink
treat vars in decision calls consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
gboehl committed Aug 27, 2024
1 parent 0104bc8 commit 65059aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions econpizza/parser/build_generic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ def func_stst_rep_agent(y, func_pre_stst, func_eqns):
def func_stst_het_agent(y, func_pre_stst, find_stat_wf, func_forw_stst, func_eqns):

x, par = func_pre_stst(y)
x = x[..., None]

wf, decisions_output, cnt_backw = find_stat_wf(
x, par)
dist, cnt_forw = func_forw_stst(decisions_output)

# TODO: for more than one dist this should be a loop...
# add time dimension for every object
x = x[..., None]
decisions_output_array = (do[..., None] for do in decisions_output)
# TODO: for more than one dist this should be a loop...
dist_array = dist[..., None]

aux = (wf, decisions_output, cnt_backw), (dist, cnt_forw)
Expand Down
2 changes: 1 addition & 1 deletion econpizza/parser/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def check_initial_values(model, shocks, init_guesses, fixed_values, init_wf, pre
# run func_pre_stst to translate init values into vars & pars
init_vals, par = func_pre_stst(
d2jnp(init_guesses), d2jnp(fixed_values), pre_stst_mapping)
init_vals = init_vals[..., None]

# collect some information needed later
model['context']['init_run'] = {}
Expand All @@ -91,6 +90,7 @@ def check_initial_values(model, shocks, init_guesses, fixed_values, init_wf, pre
model['context']['init_run']['dists'] = dists_init

# final test of main function
init_vals = init_vals[..., None]
test = model['context']['func_eqns'](init_vals, init_vals, init_vals, init_vals, jnp.zeros(
len(shocks)), par, jnp.array(dists_init)[..., None], (doi[...,None] for doi in decisions_output_init))

Expand Down

0 comments on commit 65059aa

Please sign in to comment.