Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add late diversion constraint for drt detours #2455

Merged
merged 20 commits into from
May 30, 2024

Conversation

nkuehnel
Copy link
Member

proposal:
usually, customers do not like being diverted shortly before their arrival, even though their time window would permit.
This PR introduces a hard constraint to the default DRT algorithm to allow setting a time from which it is no longer allowed to divert for new requests if a boarded passenger is very close to dropoff. By default it is set to 0 (as before).

Feedback / reviews welcome
@michalmac

@nkuehnel nkuehnel requested a review from michalmac March 17, 2023 16:19
// there is an existing stop following the new insertion
if(nextWaypoint instanceof Waypoint.Stop && nextWaypoint != insertion.pickup.newWaypoint) {
// passengers are being dropped off == may be close to arrival
if(!((Waypoint.Stop) nextWaypoint).task.getDropoffRequests().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the second next waypoint is dropping off and is within the defined time limit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. This means we need to iterate over all scheduled stops!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... all scheduled stops within the fixedApproachTime horizon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michalmac
I updated the code to check for all scheduled stops and check whether the actual detour caused is >0 (in some configurations it could also be that the new insertion is after the next stop and only adds an additional passenger to an existing stop without increasing stop duration, in which case there wouldn't be any additional detour)

"3 minutes away from her destination, even though her time window would allow it." +
" Delayed detour just before arrival are usually perceived very negatively.")
@PositiveOrZero // used only for stopbased DRT scheme
public double fixedApproachTime = 0;// [m];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixedApproachTime is too general. It will be very hard to memorise what it means. I think we need a name that would be more expressive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "allowDetourBeforeArrivalThreshold"?

@nkuehnel nkuehnel changed the title fixed approach time for drt dropoffs allowDetourBeforeArrivalThreshold time for drt dropoffs Mar 25, 2023
@nkuehnel nkuehnel marked this pull request as ready for review March 25, 2023 11:51
@nkuehnel
Copy link
Member Author

added a small test as well

@michalmac
Copy link
Member

@nkuehnel Let me know when it's ready for re-review. Thanks!

@nkuehnel
Copy link
Member Author

@michalmac it is, I guess :)

Copy link
Member

@michalmac michalmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few comments. Please consider them.

@nkuehnel
Copy link
Member Author

Picked this old PR up again and updated it to latest matsim/ addressed old review comments

@nkuehnel nkuehnel changed the title allowDetourBeforeArrivalThreshold time for drt dropoffs Add late diversion constraint for drt detours May 28, 2024
@nkuehnel nkuehnel enabled auto-merge (squash) May 30, 2024 09:28
@nkuehnel nkuehnel merged commit 870a0f7 into matsim-org:master May 30, 2024
47 checks passed
@nkuehnel nkuehnel deleted the fixedApproachDrtDropoffs branch May 30, 2024 10:28
nkuehnel added a commit to moia-oss/matsim-libs that referenced this pull request Jun 7, 2024
* combined distribution of tour start and duration

* add routing test with multiple same options

* build(deps): bump info.picocli:picocli from 4.7.5 to 4.7.6

Bumps [info.picocli:picocli](https://github.com/remkop/picocli) from 4.7.5 to 4.7.6.
- [Release notes](https://github.com/remkop/picocli/releases)
- [Changelog](https://github.com/remkop/picocli/blob/main/RELEASE-NOTES.md)
- [Commits](remkop/picocli@v4.7.5...v4.7.6)

---
updated-dependencies:
- dependency-name: info.picocli:picocli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps-dev): bump net.bytebuddy:byte-buddy from 1.14.14 to 1.14.15

Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.14.14 to 1.14.15.
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](raphw/byte-buddy@byte-buddy-1.14.14...byte-buddy-1.14.15)

---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* add javadoc comment to constructor of OTFVisLiveModule

* factor out drt optimization constraint params from drt config group  (matsim-org#3252)

* factor out drt optimization constraint params from drt config group as preparatory work for service differentiation
* ensure backwards compatibility with previous drt config design

* add python script to analysis kid data

* add new events for new times distribution

* add todo

* change format of list creation

* make output files of the class configurable

* add trip filter for trip start OR end in shp area (matsim-org#3269)

* read first 5 lines of csv to check delimiter (matsim-org#3271)

* inline abstract module attributes and get rid of them

* Allow for storing multiple DrtOptimizationConstraintsParams

* recognize EPSG:4326 as equal to WGS84 when using special coordinate transformations (matsim-org#3276)

* Add test

* update to geotools 31 (resolve transitive dependency conflicts) (matsim-org#3272)

* update to geotools 31

* update geotools import statements

* remove gt-opengis as it is discontinued

* build(deps): bump io.grpc:grpc-all from 1.63.0 to 1.64.0

Bumps [io.grpc:grpc-all](https://github.com/grpc/grpc-java) from 1.63.0 to 1.64.0.
- [Release notes](https://github.com/grpc/grpc-java/releases)
- [Commits](grpc/grpc-java@v1.63.0...v1.64.0)

---
updated-dependencies:
- dependency-name: io.grpc:grpc-all
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump org.mockito:mockito-core from 5.11.0 to 5.12.0

Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.11.0 to 5.12.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.11.0...v5.12.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump org.mockito:mockito-junit-jupiter

Bumps [org.mockito:mockito-junit-jupiter](https://github.com/mockito/mockito) from 5.11.0 to 5.12.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.11.0...v5.12.0)

---
updated-dependencies:
- dependency-name: org.mockito:mockito-junit-jupiter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* update gtfs2matsim in application contrib (matsim-org#3278)

* build(deps): bump com.google.code.gson:gson from 2.10.1 to 2.11.0

Bumps [com.google.code.gson:gson](https://github.com/google/gson) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/google/gson/releases)
- [Changelog](https://github.com/google/gson/blob/main/CHANGELOG.md)
- [Commits](google/gson@gson-parent-2.10.1...gson-parent-2.11.0)

---
updated-dependencies:
- dependency-name: com.google.code.gson:gson
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Move optimization constraints params to optimizer package

* add middleman for drt optimization constraints

* re-order replanning parameter comments to make them more understandable (matsim-org#3280)

* ---
updated-dependencies:
- dependency-name: jakarta.validation:jakarta.validation-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* ---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump org.apache.commons:commons-compress from 1.26.1 to 1.26.2

Bumps org.apache.commons:commons-compress from 1.26.1 to 1.26.2.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-compress
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump com.google.protobuf:protobuf-java from 4.26.1 to 4.27.0

Bumps [com.google.protobuf:protobuf-java](https://github.com/protocolbuffers/protobuf) from 4.26.1 to 4.27.0.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-java
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix bug in bicycle score handler (matsim-org#3288)

* fix bicycle score handler

* update test cases

* update events

* use new population comparison

* fix: prebooked drt with variable stop durations and group sizes (matsim-org#3290)

* fix: prebooked drt with variable stop durations and group sizes

* fix logic

* Documentation mode choice + make mode choice analysis standard (matsim-org#3285)

* add comments to clarify configs

* add ModeChoiceCoverageControlerListener as default analysis

* fix tests

* fix tests

* Bump org.assertj:assertj-core from 3.25.3 to 3.26.0

Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.25.3 to 3.26.0.
- [Release notes](https://github.com/assertj/assertj/releases)
- [Commits](assertj/assertj@assertj-build-3.25.3...assertj-build-3.26.0)

---
updated-dependencies:
- dependency-name: org.assertj:assertj-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* MATSim Application: Improve network params estimators (matsim-org#3292)

* adding todos for network param improvements

* more flexible reference models

* prepare capacity models, use the new predictor interface

* handle nan values

* Added hbs.py to calculate sapacity

* implemented capacities from HBS

* change parentheses

* update calculation

* update comments

* also create features from link attributes

* adding features useful for intersections

* update features

* handle non existing links

* catch errors in sample network

* round capacity

* also round freespeed factor

* use correct lane attribute

* warn if number of lanes does not match

* add more standard features

* don't classify secondary roads as residential

* use capacity bounds as in the old model

* refactored, option to only decease existing values

* fix calcCurvature bug

* remove TODO

* added curvature to hbs.py (only the structure, not the calculation)

* calculate geh value for traffic counts

* add capacities based on cuvature for landstrassen, add cuvature calculation

---------

Co-authored-by: frievoe97 <[email protected]>

* Added a test scenario for a construction site between Morges and Renens on the line Lausanne - Geneva (matsim-org#3283)

Co-authored-by: u238053 <[email protected]>
Co-authored-by: rakow <[email protected]>

* add corrections for inaccuracies in some of the calculations (matsim-org#3263)

* add backwards compatibility for dvrp matrix and drt zone system configs (matsim-org#3294)

* add backwards compatibility for dvrp matrix and drt zone system config params

* fix test issue

* addresses matsim-org#3173 (comment)

* add back service area filter for drt zones (matsim-org#3295)

* Add late diversion constraint for drt detours (matsim-org#2455)

* fixed approach time for drt dropoffs

* allowDetourBeforeArrivalThreshold

* break early when following stops are above the threshold

* catch case when there are no scheduled stops

* minor config updates

* fix bug

* add test for late detour prohibition

* add one more test

* update detour before arrival threshold

* address review comments

* simplify method, rename to lateDiversionThreshold

* rename method

* Bump net.bytebuddy:byte-buddy from 1.14.16 to 1.14.17

Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.14.16 to 1.14.17.
- [Release notes](https://github.com/raphw/byte-buddy/releases)
- [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md)
- [Commits](raphw/byte-buddy@byte-buddy-1.14.16...byte-buddy-1.14.17)

---
updated-dependencies:
- dependency-name: net.bytebuddy:byte-buddy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump org.apache.maven.plugins:maven-enforcer-plugin from 3.4.1 to 3.5.0

Bumps [org.apache.maven.plugins:maven-enforcer-plugin](https://github.com/apache/maven-enforcer) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/apache/maven-enforcer/releases)
- [Commits](apache/maven-enforcer@enforcer-3.4.1...enforcer-3.5.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-enforcer-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* add dependency for geotools-api (matsim-org#3302)

* Bump org.hsqldb:hsqldb from 2.7.2 to 2.7.3

Bumps org.hsqldb:hsqldb from 2.7.2 to 2.7.3.

---
updated-dependencies:
- dependency-name: org.hsqldb:hsqldb
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump com.google.errorprone:error_prone_annotations from 2.27.1 to 2.28.0

Bumps [com.google.errorprone:error_prone_annotations](https://github.com/google/error-prone) from 2.27.1 to 2.28.0.
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.27.1...v2.28.0)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_annotations
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* make header of detailed_distance_stats listen to custom delimiter (matsim-org#3309)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: rakow <[email protected]>
Co-authored-by: Paul Heinrich <[email protected]>
Co-authored-by: Paul Heinrich <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michal Maciejewski <[email protected]>
Co-authored-by: Kai Nagel <[email protected]>
Co-authored-by: kainagel <[email protected]>
Co-authored-by: Ricardo Ewert <[email protected]>
Co-authored-by: Ricardo Ewert <[email protected]>
Co-authored-by: simei94 <[email protected]>
Co-authored-by: marecabo <[email protected]>
Co-authored-by: rakow <[email protected]>
Co-authored-by: vsp-gleich <[email protected]>
Co-authored-by: Sebastian Hörl <[email protected]>
Co-authored-by: frievoe97 <[email protected]>
Co-authored-by: NicDul <[email protected]>
Co-authored-by: u238053 <[email protected]>
Co-authored-by: Joschka Bischoff <[email protected]>
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.

2 participants