Skip to content

Commit

Permalink
add mode2mode specific transfer constants to SwissRailRaptor
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbischoff committed Dec 22, 2023
1 parent 0553601 commit 2432321
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
*/
public class SwissRailRaptorConfigGroup extends ReflectiveConfigGroup {

private static final Logger log = LogManager.getLogger(SwissRailRaptorConfigGroup.class);
public static final String GROUP = "swissRailRaptor";

private static final String PARAM_USE_RANGE_QUERY = "useRangeQuery";
Expand Down Expand Up @@ -707,6 +706,7 @@ public Map<String, String> getComments() {
comments.put(PARAM_INTERMODAL_ACCESS_EGRESS_MODE_SELECTION, PARAM_INTERMODAL_ACCESS_EGRESS_MODE_SELECTION_DESC);
comments.put(PARAM_USE_CAPACITY_CONSTRAINTS, PARAM_USE_CAPACITY_CONSTRAINTS_DESC);
comments.put(PARAM_TRANSFER_WALK_MARGIN, PARAM_TRANSFER_WALK_MARGIN_DESC);
comments.put(PARAM_INTERMODAL_ACCESS_EGRESS_MODE_SELECTION,PARAM_INTERMODAL_ACCESS_EGRESS_MODE_SELECTION_DESC);
return comments;
}

Expand All @@ -718,7 +718,7 @@ protected void checkConsistency(Config config) {

Verify.verify(config.plans().getHandlingOfPlansWithoutRoutingMode().equals(HandlingOfPlansWithoutRoutingMode.reject), "Using intermodal access and egress in "
+ "combination with plans without a routing mode is not supported.");
Verify.verify(intermodalAccessEgressSettings.size() >= 1, "Using intermodal routing, but there are no access/egress "
Verify.verify(!intermodalAccessEgressSettings.isEmpty(), "Using intermodal routing, but there are no access/egress "
+ "modes defined. Add at least one parameterset with an access/egress mode and ensure "
+ "SwissRailRaptorConfigGroup is loaded correctly.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
package ch.sbb.matsim.routing.pt.raptor;

import ch.sbb.matsim.config.SwissRailRaptorConfigGroup;
import org.matsim.api.core.v01.population.Person;
import org.matsim.facilities.Facility;
import org.matsim.pt.transitSchedule.api.TransitStopFacility;
import org.matsim.utils.objectattributes.attributable.Attributes;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -39,12 +43,12 @@ public class RaptorStaticConfig {
public enum RaptorOptimization {
/**
* Use this option if you plan to calculate simple from-to routes
* (see {@link SwissRailRaptor#calcRoute(org.matsim.facilities.Facility, org.matsim.facilities.Facility, double, org.matsim.api.core.v01.population.Person)}).
* (see {@link SwissRailRaptor#calcRoute(Facility, Facility, double, double, double, Person, Attributes, RaptorRouteSelector)}
*/
OneToOneRouting,
/**
* Use this option if you plan to calculate one-to-all least-cost-path-trees
* (see {@link SwissRailRaptor#calcTree(org.matsim.pt.transitSchedule.api.TransitStopFacility, double, RaptorParameters)}).
* (see {@link SwissRailRaptor#calcTree(TransitStopFacility, double, RaptorParameters, Person)} ).
*/
OneToAllRouting }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
import ch.sbb.matsim.config.SwissRailRaptorConfigGroup.ModeMappingForPassengersParameterSet;
import ch.sbb.matsim.config.SwissRailRaptorConfigGroup.RangeQuerySettingsParameterSet;
import ch.sbb.matsim.config.SwissRailRaptorConfigGroup.RouteSelectorParameterSet;
import ch.sbb.matsim.routing.pt.raptor.RaptorStopFinder.Direction;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.matsim.api.core.v01.TransportMode;
import org.matsim.core.config.Config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.matsim.api.core.v01.population.PlanElement;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.ScoringConfigGroup.ModeParams;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ModeParams;
import org.matsim.core.population.routes.NetworkRoute;
import org.matsim.core.population.routes.RouteUtils;
import org.matsim.core.router.DefaultRoutingModules;
Expand All @@ -53,20 +53,13 @@
import org.matsim.pt.router.TransitRouter;
import org.matsim.pt.routes.TransitPassengerRoute;
import org.matsim.pt.transitSchedule.TransitScheduleUtils;
import org.matsim.pt.transitSchedule.api.Departure;
import org.matsim.pt.transitSchedule.api.TransitLine;
import org.matsim.pt.transitSchedule.api.TransitRoute;
import org.matsim.pt.transitSchedule.api.TransitRouteStop;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
import org.matsim.pt.transitSchedule.api.TransitScheduleFactory;
import org.matsim.pt.transitSchedule.api.TransitStopFacility;
import org.matsim.pt.transitSchedule.api.*;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.objectattributes.attributable.AttributesImpl;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;

import static org.junit.jupiter.api.Assertions.*;

Expand Down Expand Up @@ -499,7 +492,7 @@ void testCoordFarAway() {
Fixture f = new Fixture();
f.init();
TransitRouter router = createTransitRouter(f.schedule, f.config, f.network);
double x = +42000;
double x = 42000;
double x1 = -2000;
List<? extends PlanElement> legs = router.calcRoute(DefaultRoutingRequest.withoutAttributes(new FakeFacility(new Coord(x1, 0)), new FakeFacility(new Coord(x, 0)), 5.5*3600, null)); // should map to stops A and I
assertEquals(3, legs.size());
Expand Down

0 comments on commit 2432321

Please sign in to comment.