Java Code Examples for org.matsim.core.config.Config

The following examples show how to use org.matsim.core.config.Config. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: amodeus   Source File: TShareDispatcher.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    VirtualNetwork<Link> virtualNetwork = inject.getModal(new TypeLiteral<VirtualNetwork<Link>>() {
    });

    return new TShareDispatcher(network, config, operatorConfig, travelTime, router, eventsManager, //
            db, virtualNetwork);
}
 
Example 2
protected FirstComeFirstServedStrategy(Network network, //
        Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);

    double[] networkBounds = NetworkUtils.getBoundingBox(network.getNodes().values());
    this.unassignedRoboTaxis = new TreeMaintainer<>(networkBounds, this::getRoboTaxiLoc);
    this.unassignedRequests = new TreeMultipleItems<>(PassengerRequest::getSubmissionTime);
    this.requestsLastHour = new TreeMultipleItems<>(PassengerRequest::getSubmissionTime);

    FastAStarLandmarksFactory factory = new FastAStarLandmarksFactory(Runtime.getRuntime().availableProcessors());
    LeastCostPathCalculator calculator = EasyMinTimePathCalculator.prepPathCalculator(network, factory);
    timeDb = new CachedNetworkTimeDistance(calculator, MAXLAGTRAVELTIMECALCULATION, TimeDistanceProperty.INSTANCE);

    this.kockelmanRebalancing = new BlockRebalancing(network, timeDb, MINNUMBERROBOTAXISINBLOCKTOREBALANCE, BINSIZETRAVELDEMAND, dispatchPeriod, REBALANCINGGRIDDISTANCE);
}
 
Example 3
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    // TODO: Eventually, if this should be individual for multiple Amodeus modes, this needs to become modal!
    ParkingStrategy parkingStrategy = inject.get(ParkingStrategy.class);
    ParkingCapacity avSpatialCapacityAmodeus = inject.get(ParkingCapacity.class);

    return new ParkHighCapacityDispatcher(network, config, operatorConfig, travelTime, router, eventsManager, db, Objects.requireNonNull(parkingStrategy),
            Objects.requireNonNull(avSpatialCapacityAmodeus));
}
 
Example 4
Source Project: amod   Source File: SocketDispatcherHost.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    // TODO: Probably worth configuring this in some other way (not binding String and int)
    int numReqTot = inject.get(int.class);
    StringSocket stringSocket = inject.get(StringSocket.class);

    return new SocketDispatcherHost(network, config, operatorConfig, travelTime, router, eventsManager, //
            stringSocket, numReqTot, db);
}
 
Example 5
Source Project: amodeus   Source File: WaitingTimeTest.java    License: GNU General Public License v2.0 6 votes vote down vote up
static Controler createController(AmodeusConfigGroup avConfigGroup) {
    Config config = ConfigUtils.createConfig(avConfigGroup, new DvrpConfigGroup());
    Scenario scenario = TestScenarioGenerator.generateWithAVLegs(config);

    PlanCalcScoreConfigGroup.ModeParams modeParams = config.planCalcScore().getOrCreateModeParams(AmodeusModeConfig.DEFAULT_MODE);
    modeParams.setMonetaryDistanceRate(0.0);
    modeParams.setMarginalUtilityOfTraveling(8.86);
    modeParams.setConstant(0.0);

    Controler controler = new Controler(scenario);
    controler.addOverridingModule(new DvrpModule());
    controler.addOverridingModule(new AmodeusModule());
    controler.addOverridingQSimModule(new AmodeusQSimModule());

    controler.configureQSimComponents(AmodeusQSimModule.activateModes(avConfigGroup));

    return controler;
}
 
Example 6
protected ExtDemandSupplyBeamSharing(Network network, //
        Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, //
        MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(60);
    SafeConfig safeConfig = SafeConfig.wrap(operatorConfig.getDispatcherConfig());
    sharingPeriod = safeConfig.getInteger("sharingPeriod", 10); // makes sense to choose this value similar to the pickup duration
    double rMax = safeConfig.getDouble("rMax", 1000.0);
    double phiMax = Pi.in(100).multiply(RealScalar.of(safeConfig.getDouble("phiMaxDeg", 5.0) / 180.0)).number().doubleValue();
    beamExtensionForSharing = new BeamExtensionForSharing(rMax, phiMax);
    double[] networkBounds = NetworkUtils.getBoundingBox(network.getNodes().values());
    this.requestMaintainer = new TreeMaintainer<>(networkBounds, this::getLocation);
    this.unassignedRoboTaxis = new TreeMaintainer<>(networkBounds, this::getRoboTaxiLoc);
}
 
Example 7
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    VirtualNetwork<Link> virtualNetwork = inject.getModal(new TypeLiteral<VirtualNetwork<Link>>() {
    });

    AbstractVirtualNodeDest abstractVirtualNodeDest = new RandomVirtualNodeDest();
    AbstractRoboTaxiDestMatcher abstractVehicleDestMatcher = new GlobalBipartiteMatching(EuclideanDistanceCost.INSTANCE);
    return new AdaptiveRealTimeRebalancingPolicy( //
            config, operatorConfig, travelTime, //
            router, eventsManager, network, virtualNetwork, //
            abstractVirtualNodeDest, abstractVehicleDestMatcher, db);
}
 
Example 8
protected GlobalBipartiteMatchingDispatcher(Network network, Config config, //
        AmodeusModeConfig operatorConfig, TravelTime travelTime, //
        AmodeusRouter router, EventsManager eventsManager, //
        MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(30);
    DistanceHeuristics distanceHeuristics = //
            dispatcherConfig.getDistanceHeuristics(DistanceHeuristics.EUCLIDEAN);
    System.out.println("Using DistanceHeuristics: " + distanceHeuristics.name());
    distanceFunction = distanceHeuristics.getDistanceFunction(network);
    this.network = network;
    /** matching algorithm - standard is a solution to the assignment problem with the Hungarian method */
    SafeConfig safeConfig = SafeConfig.wrap(operatorConfig.getDispatcherConfig());
    bipartiteMatcher = new ConfigurableBipartiteMatcher(network, new DistanceCost(distanceFunction), //
            safeConfig);
}
 
Example 9
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    VirtualNetwork<Link> virtualNetwork = inject.getModal(new TypeLiteral<VirtualNetwork<Link>>() {
    });

    TravelData travelData = inject.getModal(TravelData.class);

    AbstractVirtualNodeDest abstractVirtualNodeDest = new RandomVirtualNodeDest();
    AbstractRoboTaxiDestMatcher abstractVehicleDestMatcher = new GlobalBipartiteMatching(EuclideanDistanceCost.INSTANCE);
    return new FeedforwardFluidicRebalancingPolicy(config, operatorConfig, travelTime, router, eventsManager, network, virtualNetwork, //
            abstractVirtualNodeDest, abstractVehicleDestMatcher, travelData, db);
}
 
Example 10
Source Project: amodeus   Source File: DFRStrategy.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    VirtualNetwork<Link> virtualNetwork = inject.getModal(new TypeLiteral<VirtualNetwork<Link>>() {
    });

    TravelData travelData = inject.getModal(TravelData.class);

    return new DFRStrategy(network, virtualNetwork, config, operatorConfig, travelTime, router, //
            eventsManager, travelData, db);
}
 
Example 11
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    VirtualNetwork<Link> virtualNetwork = inject.getModal(new TypeLiteral<VirtualNetwork<Link>>() {
    });

    TravelData travelData = inject.getModal(TravelData.class);

    AbstractVirtualNodeDest abstractVirtualNodeDest = new RandomVirtualNodeDest();
    AbstractRoboTaxiDestMatcher abstractVehicleDestMatcher = new GlobalBipartiteMatching(EuclideanDistanceCost.INSTANCE);
    return new FeedforwardFluidicTimeVaryingRebalancingPolicy(config, operatorConfig, travelTime, router, eventsManager, network, virtualNetwork, abstractVirtualNodeDest,
            abstractVehicleDestMatcher, travelData, db);
}
 
Example 12
protected PartitionedDispatcher( //
        Config config, //
        AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, //
        ParallelLeastCostPathCalculator router, //
        EventsManager eventsManager, //
        VirtualNetwork<Link> virtualNetwork, //
        MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);

    if (Objects.isNull(virtualNetwork))
        throw new IllegalStateException(
                "The VirtualNetwork is not set. Make sure you active DefaultVirtualNetworkModule in the ScenarioServer, OR provide a custom VirtualNetwork via injection.");

    this.virtualNetwork = Objects.requireNonNull(virtualNetwork);
}
 
Example 13
protected SharedPartitionedDispatcher( //
        Config config, //
        AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, //
        ParallelLeastCostPathCalculator router, //
        EventsManager eventsManager, //
        VirtualNetwork<Link> virtualNetwork, //
        MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);

    if (virtualNetwork == null)
        throw new IllegalStateException(
                "The VirtualNetwork is not set. Make sure you active DefaultVirtualNetworkModule in the ScenarioServer, OR provide a custom VirtualNetwork via injection.");

    this.virtualNetwork = Objects.requireNonNull(virtualNetwork);
}
 
Example 14
protected RestrictedLinkCapacityDispatcher(Network network, //
        Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, //
        MatsimAmodeusDatabase db, ParkingStrategy parkingStrategy, //
        ParkingCapacity avSpatialCapacityAmodeus) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(60);
    SafeConfig safeConfig = SafeConfig.wrap(operatorConfig.getDispatcherConfig());
    sharingPeriod = safeConfig.getInteger("sharingPeriod", 10); // makes sense to choose this value similar to the pickup duration
    double rMax = safeConfig.getDouble("rMax", 1000.0);
    double phiMax = Pi.in(100).multiply(RealScalar.of(safeConfig.getDouble("phiMaxDeg", 5.0) / 180.0)).number().doubleValue();
    beamExtensionForSharing = new BeamExtensionForSharing(rMax, phiMax);
    this.networkBounds = NetworkUtils.getBoundingBox(network.getNodes().values());
    this.requestMaintainer = new TreeMaintainer<>(networkBounds, this::getLocation);

    /** PARKING EXTENSION */
    this.parkingStrategy = parkingStrategy;
    DistanceHeuristics distanceHeuristics = //
            dispatcherConfig.getDistanceHeuristics(DistanceHeuristics.ASTARLANDMARKS);
    this.parkingStrategy.setRuntimeParameters(avSpatialCapacityAmodeus, network, distanceHeuristics.getDistanceFunction(network));
    /** PARKING EXTENSION */
}
 
Example 15
Source Project: amodeus   Source File: RunTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testStuckScoring() {
    AmodeusConfigGroup avConfigGroup = new AmodeusConfigGroup();

    AmodeusModeConfig operatorConfig = new AmodeusModeConfig(AmodeusModeConfig.DEFAULT_MODE);
    operatorConfig.getGeneratorConfig().setNumberOfVehicles(0);
    avConfigGroup.addMode(operatorConfig);

    AmodeusScoringConfig scoringParams = operatorConfig.getScoringParameters(null);
    scoringParams.setMarginalUtilityOfWaitingTime(-0.84);

    Config config = ConfigUtils.createConfig(avConfigGroup, new DvrpConfigGroup());
    Scenario scenario = TestScenarioGenerator.generateWithAVLegs(config);
    config.planCalcScore().getOrCreateModeParams(AmodeusModeConfig.DEFAULT_MODE); // Refactor av

    Controler controler = new Controler(scenario);
    controler.addOverridingModule(new DvrpModule());
    controler.addOverridingModule(new AmodeusModule());
    controler.addOverridingQSimModule(new AmodeusQSimModule());

    controler.configureQSimComponents(AmodeusQSimModule.activateModes(avConfigGroup));

    controler.run();

    for (Person person : scenario.getPopulation().getPersons().values()) {
        Assert.assertEquals(-1000.0, person.getSelectedPlan().getScore(), 1e-6);
    }
}
 
Example 16
Source Project: amodeus   Source File: RunTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testMultiOD() {
    AmodeusConfigGroup avConfigGroup = new AmodeusConfigGroup();

    AmodeusModeConfig operatorConfig = new AmodeusModeConfig(AmodeusModeConfig.DEFAULT_MODE);
    operatorConfig.getDispatcherConfig().setType(MultiODHeuristic.TYPE);
    operatorConfig.getGeneratorConfig().setNumberOfVehicles(100);
    operatorConfig.getPricingConfig().setPricePerKm(0.48);
    operatorConfig.getPricingConfig().setSpatialBillingInterval(1000.0);
    avConfigGroup.addMode(operatorConfig);

    AmodeusScoringConfig scoringParams = operatorConfig.getScoringParameters(null);
    scoringParams.setMarginalUtilityOfWaitingTime(-0.84);

    Config config = ConfigUtils.createConfig(avConfigGroup, new DvrpConfigGroup());
    Scenario scenario = TestScenarioGenerator.generateWithAVLegs(config);

    PlanCalcScoreConfigGroup.ModeParams modeParams = config.planCalcScore().getOrCreateModeParams(AmodeusModeConfig.DEFAULT_MODE); // Refactor av
    modeParams.setMonetaryDistanceRate(0.0);
    modeParams.setMarginalUtilityOfTraveling(8.86);
    modeParams.setConstant(0.0);

    Controler controler = new Controler(scenario);
    controler.addOverridingModule(new DvrpModule());
    controler.addOverridingModule(new AmodeusModule());
    controler.addOverridingQSimModule(new AmodeusQSimModule());

    controler.configureQSimComponents(AmodeusQSimModule.activateModes(avConfigGroup));

    TestScenarioAnalyzer analyzer = new TestScenarioAnalyzer();
    controler.addOverridingModule(analyzer);

    controler.run();

    Assert.assertEquals(0, analyzer.numberOfDepartures - analyzer.numberOfArrivals);
}
 
Example 17
public static void run(Config config, boolean otfvis) {
    //Creates a MATSim Controler and preloads all DRT related packages
    Controler controler = DrtControlerCreator.createControler(config, otfvis);

    //this is optional, adds fares to DRT
    controler.addOverridingModule(new DrtFareModule());

    //starts the simulation
    controler.run();
}
 
Example 18
public static void main(String[] args) {

		Config config = ConfigUtils.loadConfig("scenarios/cottbus/drtconfig_stopbased.xml",
				new MultiModeDrtConfigGroup(), new DvrpConfigGroup(),
                new OTFVisConfigGroup(), new DrtFaresConfigGroup());
        run(config, false);
    }
 
Example 19
Source Project: matsim-maas   Source File: RunDRTClass.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void run(Config config, boolean otfvis) {
	Controler controler = DrtControlerCreator.createControler(config, otfvis);
	controler.addOverridingModule(new DrtFareModule());
	final SimpleVKTCounter vktCounter = new SimpleVKTCounter();
	controler.addOverridingModule(new AbstractModule() {
		public void install() {
			this.addEventHandlerBinding().toInstance(vktCounter);
		}
	});
	controler.run();
	Logger.getLogger(RunDRTClass.class).info("VKT traveled in last iteration: " + Math.round(vktCounter.getVkt_counted()) + " km");
}
 
Example 20
public static void run(Config config, boolean otfvis) {
	//Creates a MATSim Controler and preloads all DRT related packages
	Controler controler = DrtControlerCreator.createControler(config, otfvis);

	//this is optional, adds fares to DRT
	controler.addOverridingModule(new DrtFareModule());

	//starts the simulation
	controler.run();
}
 
Example 21
public static void main(String[] args) {

		Config config = ConfigUtils.loadConfig(COTTBUS_DOOR2DOOR_CONFIG, new MultiModeDrtConfigGroup(),
				new DvrpConfigGroup(),
				new OTFVisConfigGroup(), new DrtFaresConfigGroup());
		run(config, false);
	}
 
Example 22
protected DemandSupplyBalancingDispatcher(Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, Network network, //
        MatsimAmodeusDatabase db) {
    super(config, operatorConfig, travelTime, router, eventsManager, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(10);
    double[] networkBounds = NetworkUtils.getBoundingBox(network.getNodes().values());
    this.requestMaintainer = new TreeMaintainer<>(networkBounds, this::getLocation);
    this.unassignedRoboTaxis = new TreeMaintainer<>(networkBounds, this::getRoboTaxiLoc);
}
 
Example 23
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new DemandSupplyBalancingDispatcher( //
            config, operatorConfig, travelTime, //
            router, eventsManager, network, db);
}
 
Example 24
Source Project: amodeus   Source File: TShareDispatcher.java    License: GNU General Public License v2.0 5 votes vote down vote up
protected TShareDispatcher(Network network, Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, //
        MatsimAmodeusDatabase db, VirtualNetwork<Link> virtualNetwork) {
    super(config, operatorConfig, travelTime, router, eventsManager, virtualNetwork, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(30);
    DistanceHeuristics distanceHeuristics = dispatcherConfig.getDistanceHeuristics(DistanceHeuristics.EUCLIDEAN);
    System.out.println("Using DistanceHeuristics: " + distanceHeuristics.name());
    distanceCashed = new CachedNetworkTimeDistance(
            EasyMinDistPathCalculator.prepPathCalculator(network, new FastAStarLandmarksFactory(Runtime.getRuntime().availableProcessors())), //
            180000.0, TimeDistanceProperty.INSTANCE);
    travelTimeCalculator = new CachedNetworkTimeDistance(
            EasyMinTimePathCalculator.prepPathCalculator(network, new FastAStarLandmarksFactory(Runtime.getRuntime().availableProcessors())), //
            180000.0, TimeDistanceProperty.INSTANCE);
    bipartiteMatchingUtils = new TShareBipartiteMatchingUtils();

    /** T-Share specific */
    SafeConfig safeConfig = SafeConfig.wrap(operatorConfig.getDispatcherConfig());
    pickupDelayMax = Quantity.of(safeConfig.getInteger("pickupDelayMax", 10 * 60), SI.SECOND);
    drpoffDelayMax = Quantity.of(safeConfig.getInteger("drpoffDelayMax", 30 * 60), SI.SECOND);

    /** initialize grid with T-cells */
    QuadTree<Link> linkTree = FastQuadTree.of(network);
    for (VirtualNode<Link> virtualNode : virtualNetwork.getVirtualNodes()) {
        System.out.println("preparing grid cell: " + virtualNode.getIndex());
        gridCells.put(virtualNode, new GridCell(virtualNode, virtualNetwork, distanceCashed, travelTimeCalculator, linkTree));
    }
    dualSideSearch = new DualSideSearch(gridCells, virtualNetwork);
    System.out.println("According to the reference, a rectangular {@link VirtualNetwork} should be used.");
    System.out.println("Ensure that VirtualNetworkCreators.RECTANGULAR is used.");
}
 
Example 25
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new DynamicRideSharingStrategy(network, config, operatorConfig, travelTime, router, eventsManager, db);
}
 
Example 26
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new FirstComeFirstServedStrategy(network, config, operatorConfig, travelTime, router, eventsManager, db);
}
 
Example 27
/** PARKING EXTENSION
 * 
 * @param parkingStrategy
 * @param avSpatialCapacityAmodeus */

public ParkHighCapacityDispatcher(Network network, //
        Config config, AmodeusModeConfig operatorConfig, //
        TravelTime travelTime, AmodeusRouter router, EventsManager eventsManager, //
        MatsimAmodeusDatabase db, ParkingStrategy parkingStrategy, //
        ParkingCapacity avSpatialCapacityAmodeus) {

    super(config, operatorConfig, travelTime, router, eventsManager, db);
    DispatcherConfigWrapper dispatcherConfig = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig());
    dispatchPeriod = dispatcherConfig.getDispatchPeriod(30); // if want to change value, change in av file, here only for backup
    rebalancePeriod = dispatcherConfig.getRebalancingPeriod(60); // same as above
    capacityOfTaxi = operatorConfig.getGeneratorConfig().getCapacity();

    links = new ArrayList<>(network.getLinks().values());
    Collections.shuffle(links, randGen);

    FastAStarLandmarksFactory factory = new FastAStarLandmarksFactory(Runtime.getRuntime().availableProcessors());
    LeastCostPathCalculator lcpc = EasyMinTimePathCalculator.prepPathCalculator(network, factory);
    ttc = new TravelTimeComputation(lcpc, sizeLimitOfCache);
    rtvGG = new AdvancedRTVGenerator(capacityOfTaxi, pickupDurationPerStop, dropoffDurationPerStop);
    rvGenerator = new AdvanceTVRVGenerator(pickupDurationPerStop, dropoffDurationPerStop);
    checkingUpdateMenuOrNot = new CheckingUpdateMenuOrNot();

    /** PARKING EXTENSION */
    this.parkingStrategy = parkingStrategy;
    DistanceHeuristics distanceHeuristics = DispatcherConfigWrapper.wrap(operatorConfig.getDispatcherConfig()).getDistanceHeuristics(DistanceHeuristics.ASTARLANDMARKS);
    this.parkingStrategy.setRuntimeParameters(avSpatialCapacityAmodeus, network, distanceHeuristics.getDistanceFunction(network));
    /** PARKING EXTENSION */

}
 
Example 28
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new HighCapacityDispatcher(network, config, operatorConfig, travelTime, router, eventsManager, db);
}
 
Example 29
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new NorthPoleSharedDispatcher(network, config, operatorConfig, travelTime, router, eventsManager, db);
}
 
Example 30
@Override
public AmodeusDispatcher createDispatcher(InstanceGetter inject) {
    Config config = inject.get(Config.class);
    MatsimAmodeusDatabase db = inject.get(MatsimAmodeusDatabase.class);
    EventsManager eventsManager = inject.get(EventsManager.class);

    AmodeusModeConfig operatorConfig = inject.getModal(AmodeusModeConfig.class);
    Network network = inject.getModal(Network.class);
    AmodeusRouter router = inject.getModal(AmodeusRouter.class);
    TravelTime travelTime = inject.getModal(TravelTime.class);

    return new ExtDemandSupplyBeamSharing(network, config, operatorConfig, travelTime, router, eventsManager, db);
}