Skip to content

feat(drt): config-based prebooking logic per DRT mode (#4545)#4852

Merged
sebhoerl merged 3 commits into
matsim-org:mainfrom
samuelhoenle:feat/drt/prebooking-logic-config
Apr 14, 2026
Merged

feat(drt): config-based prebooking logic per DRT mode (#4545)#4852
sebhoerl merged 3 commits into
matsim-org:mainfrom
samuelhoenle:feat/drt/prebooking-logic-config

Conversation

@samuelhoenle

Copy link
Copy Markdown
Contributor

Issue

When using multiple DRT modes with prebooking, ProbabilityBasedPrebookingLogic and AttributeBasedPrebookingLogic can only be installed programmatically via controller.addOverridingQSimModule(). The probability and submissionSlack values are passed as constructor arguments, with no way to set them per-mode in config.xml.

Closes #4545

Change

Following @sebhoerl's suggestion, this adds two new nested parameter set types inside <parameterset type="prebooking">:

<parameterset type="prebooking">
  <parameterset type="logic:probability">
    <param name="probability" value="0.5" />
    <param name="submissionSlack" value="900.0" />
  </parameterset>
</parameterset>

or

<parameterset type="prebooking">
  <parameterset type="logic:attributes">
    <param name="submissionTimeAttributePrefix" value="drtSubmissionTime" />
    <param name="plannedDepartureTimeAttributePrefix" value="drtPlannedDeparture" />
  </parameterset>
</parameterset>

When a logic parameter set is present in config, DrtModeQSimModule auto-installs the corresponding logic -- no manual install() call needed.

Design decisions

  • One-of-many pattern: Both logic param sets share a single field in PrebookingParams via addDefinition(), matching the existing pattern used by DrtConfigGroup for insertion search params. Only one logic type can be active per mode.
  • Configurable attribute prefixes: AttributeBasedPrebookingLogic now supports configurable attribute name prefixes (defaults unchanged). This follows the suggestion that the attribute-based config should "just give the name of the attributes".
  • Backward compatible: Existing programmatic install() calls continue to work. If no logic parameter set is configured, no logic is auto-installed.

Changed files

  • PrebookingParams: register nested logic parameter sets
  • DrtModeQSimModule: auto-install logic from config
  • AttributeBasedPrebookingLogic: support configurable attribute prefixes

New files

  • ProbabilityBasedPrebookingLogicParams, AttributeBasedPrebookingLogicParams: config classes
  • PrebookingLogicConfigTest: unit tests (config round-trip, end-to-end, one-of-many constraint)

Tagging the original author @sebhoerl for review

samuelhoenle and others added 2 commits April 9, 2026 17:18
Add config parameter sets to define prebooking logic type and parameters
per DRT mode via config.xml, removing the need for programmatic installation.

New parameter sets inside <parameterset type="prebooking">:
- <parameterset type="logic:probability"> with probability and submissionSlack
- <parameterset type="logic:attributes"> with configurable attribute name prefixes

Changes:
- PrebookingParams: extend ReflectiveConfigGroupWithConfigurableParameterSets,
  register both logic param sets (one-of-many pattern)
- DrtModeQSimModule: auto-install prebooking logic when config params present
- AttributeBasedPrebookingLogic: support configurable attribute name prefixes
- New ProbabilityBasedPrebookingLogicParams and AttributeBasedPrebookingLogicParams
- New PrebookingLogicConfigTest with 10 unit tests

Fully backward compatible: existing programmatic install() calls still work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
….EPSILON

Add configRoundTrip_multiModeDrt test verifying that two DRT modes with
different prebooking logic types (probability-based and attribute-based)
survive XML serialization/deserialization correctly.

Replace all hardcoded epsilon values (1e-9, 1e-3) with
MatsimTestUtils.EPSILON for consistency with MATSim test conventions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@samuelhoenle samuelhoenle force-pushed the feat/drt/prebooking-logic-config branch from c575012 to fb3f7b0 Compare April 9, 2026 15:18
@sebhoerl

Copy link
Copy Markdown
Contributor

Looks great!

@sebhoerl sebhoerl enabled auto-merge April 14, 2026 11:25
@sebhoerl sebhoerl added this pull request to the merge queue Apr 14, 2026
Merged via the queue into matsim-org:main with commit 1ca2324 Apr 14, 2026
51 checks passed
@samuelhoenle samuelhoenle deleted the feat/drt/prebooking-logic-config branch April 14, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DRT Prebooking: Define probability and slack per mode

2 participants