Skip to content

Commit 346cfa4

Browse files
MaxBleschsegsell
andauthored
Fix random number draws in simulation (#186)
Co-authored-by: Sebastian Gsell <sebastian.gsell93@gmail.com>
1 parent 159b621 commit 346cfa4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
os:
2222
- ubuntu-latest
2323
python-version:
24-
- '3.10'
2524
- '3.11'
2625
- '3.12'
26+
- '3.13'
2727
steps:
2828
- uses: actions/checkout@v3
2929
- name: create build environment

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ repos:
1010
hooks:
1111
- id: yamllint
1212
- repo: https://github.com/lyz-code/yamlfix
13-
rev: 1.17.0
13+
rev: 1.19.0
1414
hooks:
1515
- id: yamlfix
1616
- repo: https://github.com/pre-commit/pre-commit-hooks
17-
rev: v5.0.0
17+
rev: v6.0.0
1818
hooks:
1919
- id: check-added-large-files
2020
args:
@@ -48,7 +48,7 @@ repos:
4848
# args:
4949
# - --py37-plus
5050
- repo: https://github.com/pycqa/isort
51-
rev: 6.0.1
51+
rev: 7.0.0
5252
hooks:
5353
- id: isort
5454
name: isort
@@ -58,8 +58,8 @@ repos:
5858
# rev: v2.8.0
5959
# hooks:
6060
# - id: setup-cfg-fmt
61-
- repo: https://github.com/psf/black
62-
rev: 25.1.0
61+
- repo: https://github.com/psf/black-pre-commit-mirror
62+
rev: 25.9.0
6363
hooks:
6464
- id: black
6565
language_version: python3.12
@@ -90,7 +90,7 @@ repos:
9090
- id: nbqa-ruff
9191
exclude: tests/sandbox/
9292
- repo: https://github.com/executablebooks/mdformat
93-
rev: 0.7.22
93+
rev: 1.0.0
9494
hooks:
9595
- id: mdformat
9696
additional_dependencies:

src/dcegm/simulation/sim_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,12 @@ def vectorized_utility(consumption_period, state, choice, params, compute_utilit
279279
def realize_stochastic_states(state, choice, key, params, processed_stochastic_funcs):
280280
stochastic_states_next_period = {}
281281
for state_name in processed_stochastic_funcs.keys():
282+
key, subkey = jax.random.split(key)
282283
state_vec = processed_stochastic_funcs[state_name](
283284
params=params, **state, choice=choice
284285
)
285286
stochastic_states_next_period[state_name] = jax.random.choice(
286-
key=key, a=state_vec.shape[0], p=state_vec
287+
key=subkey, a=state_vec.shape[0], p=state_vec
287288
)
288289
return stochastic_states_next_period
289290

0 commit comments

Comments
 (0)