minotor 11.2.0 → 11.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -3
- package/dist/cli.mjs +54 -21
- package/dist/cli.mjs.map +1 -1
- package/dist/router.cjs.js +1 -1
- package/dist/router.cjs.js.map +1 -1
- package/dist/router.esm.js +1 -1
- package/dist/router.esm.js.map +1 -1
- package/dist/router.umd.js +1 -1
- package/dist/router.umd.js.map +1 -1
- package/dist/routing/rangeResult.d.ts +21 -1
- package/dist/routing/rangeState.d.ts +1 -1
- package/package.json +1 -1
- package/src/routing/__tests__/rangeResult.test.ts +86 -1
- package/src/routing/__tests__/rangeRouter.test.ts +129 -0
- package/src/routing/__tests__/rangeState.test.ts +88 -0
- package/src/routing/rangeResult.ts +21 -1
- package/src/routing/rangeRouter.ts +27 -19
- package/src/routing/rangeState.ts +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
## [11.2.2](https://github.com/aubryio/minotor/compare/v11.2.1...v11.2.2) (2026-04-27)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* prevent higher-round rRAPTOR labels from overwriting equal or better aggregate arrivals ([#69](https://github.com/aubryio/minotor/issues/69)) ([a35c4e2](https://github.com/aubryio/minotor/commit/a35c4e23caab026972fbab78e54c0de2a905feda))
|
package/dist/cli.mjs
CHANGED
|
@@ -22493,7 +22493,8 @@ class PlainRouter {
|
|
|
22493
22493
|
* The result of a Range RAPTOR query.
|
|
22494
22494
|
*
|
|
22495
22495
|
* Contains the complete Pareto-optimal set of journeys for a resolved
|
|
22496
|
-
* destination set
|
|
22496
|
+
* destination set, **or** the full per-departure-time routing state when no
|
|
22497
|
+
* destinations were provided (full-network / isochrone mode).
|
|
22497
22498
|
*
|
|
22498
22499
|
* **Pareto dominance**: journey J1 dominates J2 iff
|
|
22499
22500
|
* `τdep(J1) ≥ τdep(J2) AND τarr(J1) ≤ τarr(J2)`
|
|
@@ -22503,6 +22504,15 @@ class PlainRouter {
|
|
|
22503
22504
|
* strictly earlier *and* arrives strictly earlier than the previous one,
|
|
22504
22505
|
* forming the classic staircase Pareto frontier.
|
|
22505
22506
|
*
|
|
22507
|
+
* **Full-network mode** (empty `destinations`): when no destinations are
|
|
22508
|
+
* supplied to the range query every departure slot in the window becomes its
|
|
22509
|
+
* own run, because destination-based Pareto pruning cannot be applied.
|
|
22510
|
+
* In this mode the destination-specific helpers ({@link getRoutes},
|
|
22511
|
+
* {@link bestRoute}, {@link latestDepartureRoute}, {@link fastestRoute})
|
|
22512
|
+
* return empty results; use {@link allEarliestArrivals},
|
|
22513
|
+
* {@link allShortestDurations}, {@link earliestArrivalAt}, or
|
|
22514
|
+
* {@link shortestDurationTo} instead.
|
|
22515
|
+
*
|
|
22506
22516
|
* Destination handling is delegated to {@link Result}, which expands
|
|
22507
22517
|
* equivalent stops when reconstructing routes or looking up arrivals.
|
|
22508
22518
|
*/
|
|
@@ -22528,6 +22538,10 @@ class RangeResult {
|
|
|
22528
22538
|
*
|
|
22529
22539
|
* Each route in the list departs strictly earlier *and* arrives strictly
|
|
22530
22540
|
* earlier than its predecessor.
|
|
22541
|
+
*
|
|
22542
|
+
* Returns an empty array when no destinations were provided (full-network
|
|
22543
|
+
* mode). Use {@link allEarliestArrivals} or {@link allShortestDurations}
|
|
22544
|
+
* to query individual stops in that case.
|
|
22531
22545
|
*/
|
|
22532
22546
|
getRoutes() {
|
|
22533
22547
|
const routes = [];
|
|
@@ -22547,6 +22561,8 @@ class RangeResult {
|
|
|
22547
22561
|
* at a transit stop.
|
|
22548
22562
|
*
|
|
22549
22563
|
* Defaults to this result's own destination stop(s) when `to` is omitted.
|
|
22564
|
+
* Always pass an explicit `to` stop when operating in full-network mode
|
|
22565
|
+
* (no destinations), otherwise `undefined` is returned.
|
|
22550
22566
|
*
|
|
22551
22567
|
* @param to Optional destination stop ID or set of stop IDs.
|
|
22552
22568
|
* @returns The reconstructed {@link Route} with the earliest arrival,
|
|
@@ -22579,6 +22595,8 @@ class RangeResult {
|
|
|
22579
22595
|
* {@link fastestRoute}.
|
|
22580
22596
|
*
|
|
22581
22597
|
* Defaults to this result's own destination stop(s) when `to` is omitted.
|
|
22598
|
+
* Always pass an explicit `to` stop when operating in full-network mode
|
|
22599
|
+
* (no destinations), otherwise `undefined` is returned.
|
|
22582
22600
|
*
|
|
22583
22601
|
* @param to Optional destination stop ID or set of stop IDs.
|
|
22584
22602
|
* @returns The reconstructed {@link Route} with the latest departure,
|
|
@@ -22603,6 +22621,8 @@ class RangeResult {
|
|
|
22603
22621
|
* spent traveling.
|
|
22604
22622
|
*
|
|
22605
22623
|
* Defaults to this result's own destination stop(s) when `to` is omitted.
|
|
22624
|
+
* Always pass an explicit `to` stop when operating in full-network mode
|
|
22625
|
+
* (no destinations), otherwise `undefined` is returned.
|
|
22606
22626
|
*
|
|
22607
22627
|
* @param to Optional destination stop ID or set of stop IDs.
|
|
22608
22628
|
* @returns The reconstructed fastest {@link Route}, or `undefined` if the
|
|
@@ -22795,9 +22815,16 @@ class RangeRaptorState {
|
|
|
22795
22815
|
isDestination(stop) {
|
|
22796
22816
|
return this.currentRun.isDestination(stop);
|
|
22797
22817
|
}
|
|
22798
|
-
/** Updates
|
|
22818
|
+
/** Updates the per-run aggregate best when improved, and always considers the cross-run shared label. */
|
|
22799
22819
|
updateArrival(stop, time, round) {
|
|
22800
|
-
this.currentRun.
|
|
22820
|
+
const currentRunArrival = this.currentRun.getArrival(stop);
|
|
22821
|
+
const improvesCurrentRunAggregate = currentRunArrival === undefined ||
|
|
22822
|
+
time < currentRunArrival.arrival ||
|
|
22823
|
+
(time === currentRunArrival.arrival &&
|
|
22824
|
+
round < currentRunArrival.legNumber);
|
|
22825
|
+
if (improvesCurrentRunAggregate) {
|
|
22826
|
+
this.currentRun.updateArrival(stop, time, round);
|
|
22827
|
+
}
|
|
22801
22828
|
if (time < this.roundLabels[round][stop]) {
|
|
22802
22829
|
this.roundLabels[round][stop] = time;
|
|
22803
22830
|
this.changedInRound[round].push(stop);
|
|
@@ -22853,6 +22880,7 @@ class RangeRouter {
|
|
|
22853
22880
|
const destinations = Array.from(query.to)
|
|
22854
22881
|
.flatMap((destination) => this.stopsIndex.equivalentStops(destination))
|
|
22855
22882
|
.map((destination) => destination.id);
|
|
22883
|
+
const noDestinations = destinations.length === 0;
|
|
22856
22884
|
const accessLegs = this.accessFinder.collectAccessPaths(query.from, query.options.minTransferTime);
|
|
22857
22885
|
const departureSlots = this.accessFinder.collectDepartureTimes(accessLegs, earliest, latest);
|
|
22858
22886
|
if (departureSlots.length === 0) {
|
|
@@ -22874,15 +22902,18 @@ class RangeRouter {
|
|
|
22874
22902
|
routingState = new RoutingState(latest + 1, destinations, accessLegs, this.timetable.nbStops(), maxRounds);
|
|
22875
22903
|
rangeState.setCurrentRun(routingState);
|
|
22876
22904
|
this.raptor.run(Object.assign(Object.assign({}, query.options), { maxInitialWaitingTime: undefined }), rangeState);
|
|
22877
|
-
|
|
22878
|
-
const
|
|
22879
|
-
|
|
22880
|
-
paretoDestBest.
|
|
22905
|
+
if (!noDestinations) {
|
|
22906
|
+
for (const dest of destinations) {
|
|
22907
|
+
const t = routingState.arrivalTime(dest);
|
|
22908
|
+
if (t < ((_a = paretoDestBest.get(dest)) !== null && _a !== void 0 ? _a : UNREACHED_TIME))
|
|
22909
|
+
paretoDestBest.set(dest, t);
|
|
22910
|
+
}
|
|
22881
22911
|
}
|
|
22882
22912
|
}
|
|
22883
22913
|
for (const { depTime, legs } of departureSlots) {
|
|
22884
|
-
if (trivialDestCovered.size === destinations.length)
|
|
22914
|
+
if (!noDestinations && trivialDestCovered.size === destinations.length) {
|
|
22885
22915
|
break;
|
|
22916
|
+
}
|
|
22886
22917
|
if (routingState === null) {
|
|
22887
22918
|
routingState = new RoutingState(depTime, destinations, legs, this.timetable.nbStops(), maxRounds);
|
|
22888
22919
|
}
|
|
@@ -22891,21 +22922,23 @@ class RangeRouter {
|
|
|
22891
22922
|
}
|
|
22892
22923
|
rangeState.setCurrentRun(routingState);
|
|
22893
22924
|
this.raptor.run(Object.assign(Object.assign({}, query.options), { maxInitialWaitingTime: 0 }), rangeState);
|
|
22894
|
-
let isParetoOptimal =
|
|
22895
|
-
|
|
22896
|
-
const
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22925
|
+
let isParetoOptimal = noDestinations;
|
|
22926
|
+
if (!noDestinations) {
|
|
22927
|
+
for (const dest of destinations) {
|
|
22928
|
+
const arrival = routingState.arrivalTime(dest);
|
|
22929
|
+
if (arrival >= ((_b = paretoDestBest.get(dest)) !== null && _b !== void 0 ? _b : UNREACHED_TIME)) {
|
|
22930
|
+
continue;
|
|
22931
|
+
}
|
|
22932
|
+
if (trivialDests.has(dest) && trivialDestCovered.has(dest)) {
|
|
22933
|
+
paretoDestBest.set(dest, arrival);
|
|
22934
|
+
continue;
|
|
22935
|
+
}
|
|
22901
22936
|
paretoDestBest.set(dest, arrival);
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22906
|
-
trivialDestCovered.add(dest);
|
|
22937
|
+
if (trivialDests.has(dest)) {
|
|
22938
|
+
trivialDestCovered.add(dest);
|
|
22939
|
+
}
|
|
22940
|
+
isParetoOptimal = true;
|
|
22907
22941
|
}
|
|
22908
|
-
isParetoOptimal = true;
|
|
22909
22942
|
}
|
|
22910
22943
|
if (isParetoOptimal) {
|
|
22911
22944
|
paretoRuns.push({
|