Allow mode costs to vary by population segment - #405
Merged
Conversation
Contributor
Author
|
Integration status: local validation is green with editable 0.1.1 builds of both dependency PRs (616 unit tests, 16 integration tests with 1 skipped, and a warning-free Sphinx build). The current Read the Docs failure is dependency ordering only: PyPI still exposes 0.1.0, so it cannot resolve mobility-mode-sequence-search==0.1.1 yet. Rerun hosted checks after the two package PRs are merged and tagged v0.1.1. |
FlxPo
force-pushed
the
feature/population-segment-utilities
branch
from
July 31, 2026 18:54
fa8b1e1 to
5674465
Compare
FlxPo
force-pushed
the
feature/population-segment-utilities
branch
from
July 31, 2026 18:55
5674465 to
cae6430
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
+ Coverage 82.99% 83.20% +0.21%
==========================================
Files 233 234 +1
Lines 16039 16294 +255
==========================================
+ Hits 13312 13558 +246
- Misses 2727 2736 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Motivation
Transport behaviour does not use one set of mode-cost coefficients for every traveller. For example, pupils, households without cars, or residents of a policy area may have different constants, values of time, or distance costs. Until now, modelling that distinction required separate runs or ad hoc project code.
A naive implementation would also run destination and mode search once per population segment. That repeats shared preparation, scales with the number of demand subgroups, and becomes especially wasteful for partial-population assumptions. This PR represents distinct coefficient combinations as compact utility profiles and searches them together.
This PR is stacked on #404 and depends on:
Changes
PopulationSegmentdefinitions toPopulation, with selectors for country, CSP, home zone, city category, and car ownership.ParameterValue.by_population_segment()for mode cost constants, costs of time, and costs of distance; segment values can contain scenario and iteration values.max_persons_per_demand_subgroup.0.1.1of both Rust packages and invalidate affected destination/mode caches.Example (if relevant)
The 30% subgroup uses the segment value and the 70% complement keeps the default. Both remain in one model run.
AI-assisted contribution
Select one:
If substantial, briefly describe:
Checklist