Fix leave parental home process - #510
Merged
Merged
Conversation
…50), i.e. individuals not in a continuous education spell. SimPaths excluded students on current activity status (les_c4 == Student) instead. The two differ for people who re-entered education, who have labC4 = Student but eduSpellFlag = False: they are in the estimation sample but were blocked from leaving home.
- Use eduSpellFlag == True instead of les_c4 == Student, so the filter matches ded == 0. Re-entrant students can now leave home.
- Move the process out of aging() into its own Person.Processes.ConsiderLeavingHome event, scheduled after EducationLevelAlignment so the spell flag is current for the simulated year.
- Move the age and adult-child conditions from the aging() call site into the process.
- Add Parameters.MIN_AGE_LEAVE_PH and
MAX_AGE_ADULT_CHILD for future configurability.
Output will shift, as the household split now happens after the education module.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the “leave parental home” logic to run as its own yearly process (rather than being triggered from aging), specifically positioning it after education updates so continuous-education cases are excluded consistently. As a result, the integration-test expected outputs are updated to reflect the changed simulation trajectory.
Changes:
- Add a dedicated yearly scheduled event to evaluate adult children leaving the parental home after education processes run.
- Refactor
Person.considerLeavingHome()eligibility rules (age bounds, only process adult children above minimum age, exclude continuous education). - Update integration-test expected CSV outputs to match the new simulation results.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/simpaths/model/SimPathsModel.java | Schedules the new ConsiderLeavingHome process after education steps. |
| src/main/java/simpaths/model/Person.java | Adds the process hook and refines the leaving-home logic/filters. |
| src/main/java/simpaths/data/Parameters.java | Introduces MIN_AGE_LEAVE_PH / MAX_AGE_ADULT_CHILD and initializes the max-age bound. |
| src/test/java/simpaths/integrationtest/expected/Statistics21.csv | Updates expected demographics/health/labour aggregate outputs for integration tests. |
| src/test/java/simpaths/integrationtest/expected/Statistics1.csv | Updates expected distributional statistics outputs for integration tests. |
| src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv | Updates expected health-related outputs for integration tests. |
| src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv | Updates expected employment-transition outputs for integration tests. |
| src/test/java/simpaths/integrationtest/expected/AlignmentAdjustmentFactors1.csv | Updates expected alignment-factor outputs for integration tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
915
to
+916
| maxAge = maxAgeModel; | ||
| MAX_AGE_ADULT_CHILD = maxAge; |
Collaborator
Author
There was a problem hiding this comment.
That is intentional.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
-Drop the entity-id suffix from output filenames (Statistics21.csv ->
DemographicStatistics.csv) by exporting singleton collections rather
than bare objects. Row values are unchanged.
-Split Statistics2, which held 51 columns across four domains, and
rename the outputs for what they contain:
Statistics -> WealthIncomeStatistics
Statistics2 -> DemographicStatistics
EmploymentStatistics -> LabourStatistics
AlignmentAdjustmentFactors -> AlignmentStatistics
HealthStatistics -> WellbeingByGender
-HealthStatistics is now a new output for population health by age band.
AgeBandAggregates computes the shared age-band statistics once per year,
so the independently-toggled outputs cannot drift apart.
-Remove 12 calibration residuals reporting simulated minus an outdated
2019 UKHLS target; nothing read them.
-Add OutputReadme, writing README.md beside the CSVs with the run
configuration (population size, years, runs, alignment, bootstrapAll).
-Config keys follow the field renames; old keys are silently ignored.
-Drop the entity-id suffix from output filenames (Statistics21.csv ->
DemographicStatistics.csv) by exporting singleton collections rather
than bare objects. Row values are unchanged.
-Split Statistics2, which held 51 columns across four domains, and
rename the outputs for what they contain:
Statistics -> WealthIncomeStatistics
Statistics2 -> DemographicStatistics
EmploymentStatistics -> LabourStatistics
AlignmentAdjustmentFactors -> AlignmentStatistics
HealthStatistics -> WellbeingByGender
-HealthStatistics is now a new output for population health by age band.
AgeBandAggregates computes the shared age-band statistics once per year,
so the independently-toggled outputs cannot drift apart.
-Remove 12 calibration residuals reporting simulated minus an outdated
2019 UKHLS target; nothing read them.
-Add OutputReadme, writing README.md beside the CSVs with the run
configuration (population size, years, runs, alignment, bootstrapAll).
-Config keys follow the field renames; old keys are silently ignored.
- Guard both denominators in AgeBandAggregates: empty age bands and
bands with no workers no longer divide by zero. Non-empty bands are
unchanged.
- Give WellbeingByGender a distinct entity id per gender group
(Total=1, Male=2, Female=3); the constant id collided on the JPA
primary key across the three rows written each year.
- Rename setStats/getStats2/setStats2 to match their fields.
- Fix stale Statistics.csv reference in default.yml.
…ender.java Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.