Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
c119f1d
experimental coefficient validator
andrewbaxter439 Jan 16, 2026
fe4a1e7
experimental safe read excel
andrewbaxter439 Jan 16, 2026
e7969df
added sheet name and BenefitUnit handling to safe excel read
andrewbaxter439 Jan 19, 2026
c624bc2
fixing validator naming and testing
andrewbaxter439 Jan 27, 2026
56355bc
Deleted old plot files and uploaded new do files.
ANBurdett Mar 24, 2026
1151aa6
Merge pull request #440 from ANBurdett/AB_update_validation_files
dav-sonn Mar 25, 2026
4d62467
1. EntityManagerFactory cached as static fields
Mariia-Var Mar 26, 2026
7e8a3a7
Fix non-deterministic UC/Legacy benefit assignment
Mariia-Var Mar 26, 2026
b84c8e7
Replace Statistics3 export with AlignmentAdjustmentFactors
Mariia-Var Mar 26, 2026
b9e4384
Remove all the code/references to IT
dav-sonn Mar 31, 2026
cd46602
Merge pull request #444 from simpaths/MV-develop
justin-ven Mar 31, 2026
fb1d442
Merge pull request #449 from simpaths/cleaning_remove_IT
justin-ven Mar 31, 2026
d5b4510
Remove all remaining hard-coded values #393
dav-sonn Apr 13, 2026
539d63c
Correct Education enum coding
dav-sonn Apr 13, 2026
a3ed985
Merge pull request #452 from simpaths/remove_hardcoded_par
justin-ven Apr 14, 2026
132f9a3
minor
justin-ven Apr 14, 2026
cca2ffb
minor
justin-ven Apr 14, 2026
17da42c
minor
justin-ven Apr 14, 2026
7648b0d
minor
justin-ven Apr 14, 2026
055af2f
minor
justin-ven Apr 14, 2026
4acc3c4
minor
justin-ven Apr 14, 2026
8b656b9
minor
justin-ven Apr 14, 2026
8a9ee48
final
justin-ven Apr 15, 2026
a39fbef
Promote Javadoc headings to h2
dav-sonn Apr 15, 2026
416a592
Add wage-growth uprating option for tax donor income matching
justin-ven Apr 19, 2026
2eeb719
Remove C1b value from RMSE
dav-sonn Apr 20, 2026
ae9eea2
Merge pull request #453 from justin-ven/develop
justin-ven Apr 20, 2026
2dda7ba
minor
justin-ven Apr 21, 2026
7cfbf63
minor
justin-ven Apr 27, 2026
67e58c2
minor
justin-ven Apr 28, 2026
b4f9936
Renaming person relevant fields
LiangShi369 Apr 28, 2026
b961d63
Merge pull request #456 from simpaths/RMSE_correction
justin-ven Apr 28, 2026
7116cbc
benefit unit class relevant fields
LiangShi369 Apr 28, 2026
1767772
first complete draft
justin-ven Apr 28, 2026
93ef007
continued
LiangShi369 Apr 28, 2026
fbdb714
continued 2
LiangShi369 Apr 28, 2026
3c2e635
last batch of update, integration test passed
LiangShi369 Apr 29, 2026
e81bb8b
finalise code adjustment
justin-ven Apr 29, 2026
17ea865
update
LiangShi369 Apr 29, 2026
a598a25
Delete flowchart_review_prompt.md
LiangShi369 Apr 29, 2026
c3600f3
Merge pull request #460 from justin-ven/feature/tax-donor-wage-growth…
justin-ven May 5, 2026
e50b681
Omit redundant social care provision flags
justin-ven May 5, 2026
7799474
Use sinh for care hours and adjust draws
dav-sonn May 5, 2026
166929c
Merge pull request #463 from justin-ven/care-provision-clean-up
dav-sonn May 5, 2026
75f5fcb
Remove IT in input Excel data files
dav-sonn May 6, 2026
0a39553
Merge pull request #464 from simpaths/remove_IT_excel
justin-ven May 6, 2026
44ca683
Refactoring of regression estimates
dariaple May 7, 2026
2c042fb
Create flowchart_review_prompt.md
LiangShi369 May 8, 2026
032fdaf
Update GETTER_SETTER_RENAME_STRATEGY.md
LiangShi369 May 8, 2026
6a26a81
Completed required renamings (discussed on 5 May 2026), integration t…
LiangShi369 May 8, 2026
308736d
Merge develop into getter/setter rename branch
LiangShi369 May 8, 2026
169c767
Add new regressor names in the code
dav-sonn May 11, 2026
db79f59
getter and setter renamed
LiangShi369 May 12, 2026
4fdc0ce
A new batch of renaming in Section 17.4
LiangShi369 May 12, 2026
29a2a63
Merge pull request #468 from simpaths/LS_rename_getters_setters
dav-sonn May 12, 2026
a02aa79
Merge pull request #465 from dariaple/refactored-regressions
justin-ven May 13, 2026
874ad4d
Fix Person getters: update old getter calls
dav-sonn May 13, 2026
51a09bb
Merge pull request #471 from simpaths/fix_PR465
justin-ven May 13, 2026
a7bb133
Validate startYear against the available initial-population and EURO…
Mariia-Var May 14, 2026
85f434d
Port EU's smooth expected-value approach to UK's InSchoolAlignment an…
Mariia-Var May 15, 2026
10596ed
Clean up excel input files:
Mariia-Var May 15, 2026
3e67ea3
Remove old alignment workbook references
Mariia-Var May 15, 2026
c8966c2
Corrected alignment adjustment factors
Mariia-Var May 15, 2026
f2693b1
Merge pull request #473 from simpaths/experimental/safe-test-paramete…
justin-ven May 26, 2026
34abfeb
Update the regression estimates and fix the bug with the Year_transfo…
dav-sonn May 29, 2026
c3a5467
Merge pull request #475 from simpaths/fix_regressions
justin-ven May 31, 2026
4b631db
Add test file in input directory
justin-ven Jun 1, 2026
cd7bcb0
Delete input/test
justin-ven Jun 1, 2026
53a75ca
Create test2
justin-ven Jun 1, 2026
fc38f1d
Delete src/test2
justin-ven Jun 1, 2026
6b944b1
Create test3
justin-ven Jun 1, 2026
184f635
Delete src/test3
justin-ven Jun 1, 2026
c21d1c8
Create test4
justin-ven Jun 1, 2026
3011a99
??
justin-ven Jun 1, 2026
50496b9
Delete validation/test4
justin-ven Jun 1, 2026
476600b
Restore integration tests with numeric tolerance
dav-sonn Jun 1, 2026
76f92f7
Align integration tests to the EU variant
dav-sonn Jun 2, 2026
65e3c3e
Merge pull request #477 from simpaths/restore_integration_tests
dav-sonn Jun 2, 2026
9da4306
Merge remote-tracking branch 'origin/develop' into MV-develop-add-sta…
Mariia-Var Jun 2, 2026
516c5d8
Merge remote-tracking branch 'origin/develop' into MV-cleanup-input-e…
Mariia-Var Jun 2, 2026
9db3b55
Removed outdated employment alignment
Mariia-Var Jun 2, 2026
cc60889
Merge remote-tracking branch 'origin/develop' into MV-port-EUalignmen…
Mariia-Var Jun 2, 2026
1fb0c25
Corrected inSchool alignment logic for E1b process
Mariia-Var Jun 2, 2026
e5c2a5b
Merge remote-tracking branch 'origin/develop' into MV-correct_alignme…
Mariia-Var Jun 2, 2026
9cda541
Updated golden files of Integration test
Mariia-Var Jun 3, 2026
99fba3d
Merge pull request #480 from Mariia-Var/MV-develop-add-startYear-guard
dav-sonn Jun 3, 2026
ed115f0
Potential fix for pull request finding
Mariia-Var Jun 3, 2026
cdf986a
Potential fix for pull request finding
Mariia-Var Jun 3, 2026
24c51e5
Potential fix for pull request finding
Mariia-Var Jun 3, 2026
f68b20a
Apply in-school alignment before yearly school decisions
Mariia-Var Jun 3, 2026
6f273b1
Merge pull request #481 from Mariia-Var/MV-cleanup-input-excel
Mariia-Var Jun 3, 2026
73b90ab
Merge remote-tracking branch 'origin/develop' into MV-correct_alignme…
Mariia-Var Jun 3, 2026
19210af
Merge pull request #482 from Mariia-Var/MV-port-EUalignments-approach
Mariia-Var Jun 3, 2026
eab2def
Merge pull request #483 from Mariia-Var/MV-correct_alignment_factors
Mariia-Var Jun 3, 2026
3607fc3
bump version of actions
amorison Jun 8, 2026
f71050d
Merge pull request #485 from simpaths/am/actions
dav-sonn Jun 9, 2026
75309eb
fixed bug: yBenAmountMonth
LiangShi369 Jun 10, 2026
f51587f
Update BenefitUnit.java
LiangShi369 Jun 10, 2026
0f74f12
Update BenefitUnit.java
LiangShi369 Jun 10, 2026
a85415a
social care revision
dariaple Jun 10, 2026
2d7e592
Fix typo 'Psrtner' to 'Partner' in Person.java
dav-sonn Jun 11, 2026
c00d056
Merge pull request #488 from dariaple/social_care_update
dav-sonn Jun 11, 2026
bf09061
Update reg_income.xlsx
dariaple Jun 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"permissions": {
"allow": [
"Bash(xargs -I {} wc -l {})",
"Bash(mvn clean *)",
"Bash(python -c \"import docx; print\\('python-docx available'\\)\")",
"Bash(python3 -c \"import docx; print\\('ok'\\)\")",
"Bash(where py *)",
"Bash(py --version)",
"Bash(py -c \"import docx; print\\('ok'\\)\")",
"Bash(py -m pip install python-docx -q)",
"Bash(py generate_review.py)",
"Bash(pip show *)",
"PowerShell(Get-Command *)"
]
}
}
36 changes: 18 additions & 18 deletions .github/workflows/SimPathsBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ jobs:
build:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK 19
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: simpaths_jars
path: ./*.jar

run-integration-tests:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK 19
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
- name: Run integration tests
run: mvn verify
- name: Upload Actual CSVs for Inspection
if: failure() # This ensures it only runs when the tests fail
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: actual-simulation-results
path: output/INTEGRATION_TESTS/csv/
Expand All @@ -51,43 +51,43 @@ jobs:
needs: build
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK 19
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: simpaths_jars
path: .
- name: Do one full Setup and Run with SimPathsStart (mimicking GUI run)
run: java -jar singlerun.jar -c UK -s 2019 -g false --rewrite-policy-schedule
- name: Check input db exists
id: check_file
uses: thebinaryfelix/check-file-existence-action@1.0.0
uses: thebinaryfelix/check-file-existence-action@2.0.0
with:
files: 'input/input.mv.db, input/EUROMODpolicySchedule.xlsx, input/DatabaseCountryYear.xlsx'

run-simpaths-persist-root:
needs: build
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK 19
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: simpaths_jars
path: .
- name: Setup run
run: java -jar multirun.jar -DBSetup -config test_create_database.yml
- name: Check input db exists
id: check_file
uses: thebinaryfelix/check-file-existence-action@1.0.0
uses: thebinaryfelix/check-file-existence-action@2.0.0
with:
files: 'input/input.mv.db, input/EUROMODpolicySchedule.xlsx, input/DatabaseCountryYear.xlsx'
- name: Do two runs with persistence to root database
Expand All @@ -97,21 +97,21 @@ jobs:
needs: build
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up JDK 19
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: simpaths_jars
path: .
- name: Setup run
run: java -jar multirun.jar -DBSetup -config test_create_database.yml
- name: Check input db exists
id: check_file
uses: thebinaryfelix/check-file-existence-action@1.0.0
uses: thebinaryfelix/check-file-existence-action@2.0.0
with:
files: 'input/input.mv.db, input/EUROMODpolicySchedule.xlsx, input/DatabaseCountryYear.xlsx'
- name: Do two runs with no persistence
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'

Expand All @@ -39,10 +39,10 @@ jobs:
run: mkdocs build --strict

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v5
with:
path: site/

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
4 changes: 2 additions & 2 deletions .github/workflows/publish-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Set up JDK 19
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
java-version: '19'
distribution: 'temurin'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,5 @@ input/EUROMODoutput/baseline/*

# IntelliJ
.idea/

input/InitialPopulations/original/*
121 changes: 121 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Important: Directory Path Contains Spaces

The project root is `C:\MyFiles\99 DEV ENV\JAS-MINE\SimPaths`. The path contains spaces, so always wrap paths in double quotes in shell/Bash commands, e.g.:

```bash
cd "C:\MyFiles\99 DEV ENV\JAS-MINE\SimPaths"
mvn -f "C:\MyFiles\99 DEV ENV\JAS-MINE\SimPaths\pom.xml" compile
```

## Build & Run Commands

```bash
# Compile only
mvn compile

# Run unit tests (excludes integration tests)
mvn test

# Run a single test class
mvn test -Dtest=MahalanobisDistanceTest

# Run a single test method
mvn test -Dtest=PersonTest#methodName

# Run integration tests (requires pre-built JARs)
mvn failsafe:integration-test

# Build shaded JARs (produces singlerun.jar and multirun.jar in project root)
mvn package

# Run simulation headless via multirun.jar (uses config/default.yml)
java -jar multirun.jar -config config/default.yml

# Run database setup only
java -jar multirun.jar -DBSetup -config config/default.yml

# Run with GUI (single run)
java -jar singlerun.jar
```

Java 19 is required (configured in pom.xml). Dependencies are pulled from Maven Central and JitPack (for JAS-mine).

## Architecture Overview

SimPaths is a **dynamic microsimulation model** built on the [JAS-mine](https://github.com/jasmineRepo) simulation framework. It projects individual and household life histories year-by-year across domains: labour market, health, demographics, social care, and taxes/benefits.

### Simulation entity hierarchy

```
Household — groups BenefitUnits sharing a dwelling (parent–adult-child links)
└─ BenefitUnit — the tax/benefit assessment unit (couple or single + dependent children)
└─ Person — the individual agent (all life-course state is stored here)
```

All three are JPA `@Entity` classes persisted via Hibernate/H2. Each carries a `PanelEntityKey` (id + simulation_time + simulation_run).

### Simulation lifecycle

`SimPathsModel` (extends `AbstractSimulationManager`) owns the main simulation loop. Each year it fires ordered events that update entities via `EventListener.onEvent()`. The sequence covers: mortality → union formation/dissolution → fertility → education → labour market → taxes/benefits → health → social care → statistics collection.

### Key classes to know

| Class | Role |
|---|---|
| `SimPathsModel` | Orchestrates yearly event schedule; holds all population lists |
| `SimPathsStart` | Entry point for single runs (GUI or headless) |
| `SimPathsMultiRun` | Entry point for multi-run / sensitivity analysis |
| `SimPathsCollector` | Collects and exports output statistics each year |
| `Parameters` | Static store for all model parameters and regression coefficients loaded from Excel |
| `ManagerRegressions` | Routes regression evaluation calls to the correct JAS-mine regression objects |
| `Person` / `BenefitUnit` | Core simulation agents — most behavioural logic lives here |

### Tax-benefit imputation (`model/taxes/`)

Tax and benefit outcomes are not calculated analytically. Instead, the model uses **statistical matching**: simulated households are matched to a pre-built donor database derived from EUROMOD/UKMOD output. `TaxDonorDataParser` builds this database; `DonorTaxImputation` performs the matching using a nearest-neighbour key function (`KeyFunction1`–`KeyFunction4`).

### Intertemporal optimisation (`model/decisions/`)

An optional backward-induction module solves for optimal lifetime consumption and labour supply. `ManagerSolveGrids` runs the solution over a multi-dimensional state-space grid (age, health, education, pension, region, etc.). `ManagerPopulateGrids` sets up the grid geometry. This is computationally expensive and disabled by default (`enableIntertemporalOptimisations: false`).

### Regression system

All behavioural equations are estimated externally and loaded at startup from Excel files in `input/`. `Parameters` loads them via JAS-mine's `ExcelAssistant`/`MultiKeyCoefficientMap`. `RegressionName` (enum) names every equation; `ManagerRegressions` dispatches calls by type (linear, probit, ordered probit, multinomial logit, etc.).

### Alignment

Several demographic processes are aligned to external targets (ONS projections, LFS shares) via `ActivityAlignmentV2`, `FertilityAlignment`, `PartnershipAlignment`, `InSchoolAlignment`, `SocialCareAlignment`. Alignment factors are exported to `AlignmentAdjustmentFactors1.csv` each run.

### Configuration

Runs are configured via YAML files in `config/`. `default.yml` documents all available keys with their defaults. CLI flags override YAML values. `SimPathsMultiRun` reads the YAML and reflectively sets fields on `SimPathsModel`, `SimPathsCollector`, and `Parameters`.

### Output

Output is written to `output/<run-timestamp>/csv/` by `SimPathsCollector`. Key files:
- `Statistics1.csv` — income distribution (Gini, percentiles, S-Index)
- `Statistics2.csv` — demographic validation (partnership, employment, health by age/gender)
- `EmploymentStatistics.csv`, `HealthStatistics.csv` — domain-specific time series
- `AlignmentAdjustmentFactors1.csv` — alignment diagnostics

### Integration tests

`RunSimPathsIntegrationTest` runs the full simulation end-to-end using the built JARs and compares CSV output against reference files in `src/test/java/simpaths/integrationtest/expected/`. If a substantive change shifts the output, update the expected files and commit them.

## Domain Knowledge

This section records design principles and non-obvious rationale accumulated through development. Update it as new insights emerge.

### Price levels: SimPaths vs. the tax donor database

All SimPaths financial variables are stored in **real 2015 prices** (`BASE_PRICE_YEAR`). The tax donor database, however, is denominated in **nominal prices of the respective policy year**.

Tax donor matching therefore requires a two-step price bridge:
1. Inflate SimPaths income to policy-year prices before matching.
2. Deflate the imputed financial values from the matched donor record back to 2015 prices.

The default uprating series is `TimeSeriesVariable.Inflation`, sourced from the `inflation` worksheet in `input/economic_time_series.xlsx`. An alternative option (added 2026-04) allows wage growth to be used instead of price growth for the initial matching step, controlled via a config flag.
Loading
Loading