Skip to content

Commit

Permalink
Merge branch 'main' into allow-general-discrete-grids
Browse files Browse the repository at this point in the history
  • Loading branch information
timmens committed Sep 15, 2024
2 parents e124a18 + ff66bad commit bc77ac6
Show file tree
Hide file tree
Showing 57 changed files with 7,484 additions and 7,590 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.23.0
pixi-version: v0.29.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: test-cpu
Expand All @@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.23.0
pixi-version: v0.29.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: mypy
Expand All @@ -62,7 +62,7 @@ jobs:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.23.0
pixi-version: v0.29.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: test-cpu
Expand Down
25 changes: 23 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: check-useless-excludes
# - id: identity # Prints all files passed to pre-commits. Debugging.
- repo: https://github.com/lyz-code/yamlfix
rev: 1.16.0
rev: 1.17.0
hooks:
- id: yamlfix
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -46,7 +46,7 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.6.5
hooks:
# Run the linter.
- id: ruff
Expand Down Expand Up @@ -74,5 +74,26 @@ repos:
- --wrap
- '88'
files: (README\.md)
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --drop-empty-cells
- --keep-output
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
files: src|tests
additional_dependencies:
- jax>=0.4.20
- numpy
- packaging
- pandas-stubs
args:
- --config=pyproject.toml
ci:
autoupdate_schedule: monthly
skip:
- mypy # installing jax is not possible on pre-commit.ci due to size limits.
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ coverage:
default:
target: 90%
ignore:
- setup.py
- tests/**/*
23 changes: 7 additions & 16 deletions examples/long_running.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
"""Example specification for a consumption-savings model with health and exercise."""

import jax.numpy as jnp
from lcm import DiscreteGrid, LinspaceGrid, Model

# ======================================================================================
# Numerical parameters and constants
# ======================================================================================
N_GRID_POINTS = {
"wealth": 100,
"health": 100,
"consumption": 100,
"exercise": 200,
}

RETIREMENT_AGE = 65
from lcm import DiscreteGrid, LinspaceGrid, Model

# ======================================================================================
# Model functions
Expand Down Expand Up @@ -63,6 +52,8 @@ def consumption_constraint(consumption, wealth, labor_income):
# ======================================================================================
# Model specification and parameters
# ======================================================================================
RETIREMENT_AGE = 65


MODEL_CONFIG = Model(
n_periods=RETIREMENT_AGE - 18,
Expand All @@ -80,24 +71,24 @@ def consumption_constraint(consumption, wealth, labor_income):
"consumption": LinspaceGrid(
start=1,
stop=100,
n_points=N_GRID_POINTS["consumption"],
n_points=100,
),
"exercise": LinspaceGrid(
start=0,
stop=1,
n_points=N_GRID_POINTS["exercise"],
n_points=200,
),
},
states={
"wealth": LinspaceGrid(
start=1,
stop=100,
n_points=N_GRID_POINTS["wealth"],
n_points=100,
),
"health": LinspaceGrid(
start=0,
stop=1,
n_points=N_GRID_POINTS["health"],
n_points=100,
),
},
)
Expand Down
Loading

0 comments on commit bc77ac6

Please sign in to comment.