Java Code Examples for org.matsim.core.controler.Controler#addOverridingModule()

The following examples show how to use org.matsim.core.controler.Controler#addOverridingModule() . 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 File: WaitingTimeTest.java    From amodeus with 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 2
Source File: TestScenario.java    From amodeus with GNU General Public License v2.0 6 votes vote down vote up
static public Controler createController(Scenario scenario, EventHandler handler, int vehicleCapacity) {
    Controler controller = new Controler(scenario);

    controller.addOverridingModule(new DvrpModule());
    controller.addOverridingModule(new DvrpTravelTimeModule());
    controller.addOverridingModule(new AmodeusModule());

    controller.addOverridingModule(new AbstractModule() {
        @Override
        public void install() {
            AmodeusUtils.registerGeneratorFactory(binder(), "Single", SingleVehicleGeneratorFactory.class);
            addEventHandlerBinding().toInstance(handler);
        }

        @Provides
        public SingleVehicleGeneratorFactory provideFactory() {
            return new SingleVehicleGeneratorFactory(vehicleCapacity, Id.createLinkId("link1"));
        }
    });

    controller.addOverridingQSimModule(new AmodeusQSimModule());

    controller.configureQSimComponents(AmodeusQSimModule.activateModes(scenario.getConfig()));

    return controller;
}
 
Example 3
Source File: RunRobotaxiExample.java    From matsim-maas with GNU General Public License v2.0 5 votes vote down vote up
public static Controler createControler(Config config, boolean otfvis) {
	Controler controler=TaxiControlerCreator.createControler(config, otfvis);
	controler.addOverridingModule(new TaxiFareModule());

	if (otfvis) {
		controler.addOverridingModule(new OTFVisLiveModule());
	}

	return controler;
}
 
Example 4
Source File: RunStopBasedDrtExample.java    From matsim-maas with GNU General Public License v2.0 5 votes vote down vote up
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 5
Source File: RunDRTClass.java    From matsim-maas with 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 6
Source File: RunDoorToDoorDrtExample.java    From matsim-maas with GNU General Public License v2.0 5 votes vote down vote up
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 7
Source File: AmodeusConfigurator.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
/** Configures a MATSim controller for a standard use case of AMoDeus. */
static public void configureController(Controler controller, MatsimAmodeusDatabase db, ScenarioOptions scenarioOptions) {
    if (controller.getConfig().getModules().containsKey("av")) {
        logger.warn(configurationChangedMessage);
        throw new RuntimeException();
    }

    controller.addOverridingModule(new DvrpModule());
    controller.addOverridingModule(new AmodeusModule(db, scenarioOptions));

    controller.addOverridingQSimModule(new AmodeusQSimModule());
    controller.configureQSimComponents(AmodeusQSimModule.activateModes(AmodeusConfigGroup.get(controller.getConfig())));
}
 
Example 8
Source File: RunTest.java    From amodeus with 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 9
Source File: RunTest.java    From amodeus with 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 10
Source File: RunTest.java    From amodeus with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testBasicSetup() {
    // CONFIG PART

    Config config = ConfigUtils.createConfig(new DvrpConfigGroup(), new AmodeusConfigGroup());

    // Add Amodeus mode
    AmodeusModeConfig modeConfig = new AmodeusModeConfig("av");
    modeConfig.getDispatcherConfig().setType("GlobalBipartiteMatchingDispatcher");
    AmodeusConfigGroup.get(config).addMode(modeConfig);

    config.planCalcScore().getOrCreateModeParams("av");

    // DVRP adjustments
    config.qsim().setSimStarttimeInterpretation(StarttimeInterpretation.onlyUseStarttime);

    // SCENARIO PART

    // Generates a scenario with "av" legs
    Scenario scenario = TestScenarioGenerator.generateWithAVLegs(config);

    // CONTROLLER PART
    Controler controller = new Controler(scenario);

    controller.addOverridingModule(new DvrpModule());
    controller.addOverridingModule(new AmodeusModule());

    controller.addOverridingQSimModule(new AmodeusQSimModule());
    controller.configureQSimComponents(AmodeusQSimModule.activateModes(AmodeusConfigGroup.get(controller.getConfig())));

    // Some analysis listener for testing
    TestScenarioAnalyzer analyzer = new TestScenarioAnalyzer();
    controller.addOverridingModule(analyzer);

    controller.run();

    Assert.assertEquals(0, analyzer.numberOfDepartures - analyzer.numberOfArrivals);
    Assert.assertEquals(100, analyzer.numberOfDepartures);
}
 
Example 11
Source File: PreroutingTest.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void testPreRouting() {
    AmodeusConfigGroup avConfigGroup = new AmodeusConfigGroup();

    AmodeusModeConfig operatorConfig = new AmodeusModeConfig(AmodeusModeConfig.DEFAULT_MODE);
    operatorConfig.setPredictRouteTravelTime(true);
    operatorConfig.getGeneratorConfig().setNumberOfVehicles(100);
    avConfigGroup.addMode(operatorConfig);

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

    operatorConfig.getPricingConfig().setPricePerKm(1.0);

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

    config.plansCalcRoute().setRoutingRandomness(0.0);

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

    StrategySettings strategySettings = new StrategySettings();
    strategySettings.setStrategyName("KeepLastSelected");
    strategySettings.setWeight(1.0);
    config.strategy().addStrategySettings(strategySettings);

    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()) {
        Plan plan = person.getSelectedPlan();

        for (PlanElement element : plan.getPlanElements()) {
            if (element instanceof Leg) {
                Leg leg = (Leg) element;
                AmodeusRoute route = (AmodeusRoute) leg.getRoute();

                Assert.assertTrue(route.getTravelTime().isDefined() && Double.isFinite(route.getTravelTime().seconds()));
                Assert.assertTrue(route.getExpectedDistance().isPresent());
                Assert.assertTrue(route.getWaitingTime().isDefined());
                Assert.assertTrue(route.getPrice().isPresent());
                Assert.assertTrue(route.getPrice().get() > 0.0);
            }
        }
    }
}
 
Example 12
Source File: RunTest.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void testAVExampleWithAccessEgress() {
    AmodeusConfigGroup avConfigGroup = new AmodeusConfigGroup();

    AmodeusModeConfig operatorConfig = new AmodeusModeConfig(AmodeusModeConfig.DEFAULT_MODE);
    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);

    operatorConfig.setUseAccessAgress(true);

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

    Iterator<? extends Person> iterator = scenario.getPopulation().getPersons().values().iterator();
    for (int i = 0; i < 3; i++) {
        Person person = iterator.next();

        for (PlanElement element : person.getSelectedPlan().getPlanElements()) {
            if (element instanceof Activity) {
                Activity activity = (Activity) element;
                activity.setCoord(CoordUtils.plus(activity.getCoord(), new Coord(5.0, 5.0)));
            }
        }
    }

    ActivityParams activityParams = new ActivityParams("amodeus interaction");
    activityParams.setTypicalDuration(1.0);
    config.planCalcScore().addActivityParams(activityParams);

    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);
    Assert.assertEquals(6, analyzer.numberOfInteractionActivities);
}
 
Example 13
Source File: RunTest.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
@Test
public void testAVExampleWithAccessEgressAttribute() {
    AmodeusConfigGroup avConfigGroup = new AmodeusConfigGroup();

    AmodeusModeConfig operatorConfig = new AmodeusModeConfig(AmodeusModeConfig.DEFAULT_MODE);
    operatorConfig.getGeneratorConfig().setNumberOfVehicles(100);
    operatorConfig.getPricingConfig().setPricePerKm(0.48);
    operatorConfig.getPricingConfig().setSpatialBillingInterval(1000.0);
    operatorConfig.getInteractionFinderConfig().setType(LinkAttributeInteractionFinder.TYPE);
    operatorConfig.getInteractionFinderConfig().getParams().put("allowedLinkAttribute", "avflag");
    avConfigGroup.addMode(operatorConfig);

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

    operatorConfig.setUseAccessAgress(true);

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

    for (Link link : scenario.getNetwork().getLinks().values()) {
        if (link.getFromNode().getCoord().getX() == 5000.0) {
            link.getAttributes().putAttribute("avflag", true);
        }
    }

    ActivityParams activityParams = new ActivityParams("amodeus interaction");
    activityParams.setTypicalDuration(1.0);
    config.planCalcScore().addActivityParams(activityParams);

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

    config.qsim().setEndTime(40.0 * 3600.0);
    config.qsim().setSimStarttimeInterpretation(StarttimeInterpretation.onlyUseStarttime);

    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);
    Assert.assertEquals(163, analyzer.numberOfInteractionActivities);
}
 
Example 14
Source File: RunDrtTest.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
static public void run(Config config, Scenario scenario, boolean useAmodeus) {
    // CONFIG PART

    // Set up MATSim configuration to be compatible with DRT
    config.plans().setHandlingOfPlansWithoutRoutingMode(HandlingOfPlansWithoutRoutingMode.useMainModeIdentifier);
    config.qsim().setStartTime(0.0);
    config.qsim().setSimStarttimeInterpretation(StarttimeInterpretation.onlyUseStarttime);

    config.qsim().setNumberOfThreads(1);

    // Set up missing scoring parameters
    config.planCalcScore().getOrCreateModeParams(DRT_MODE);

    // Set up DRT mode
    DrtConfigGroup drtModeConfig = new DrtConfigGroup();
    drtModeConfig.setMode(DRT_MODE);

    drtModeConfig.setMaxTravelTimeBeta(600.0);
    drtModeConfig.setMaxTravelTimeAlpha(1.4);
    drtModeConfig.setMaxWaitTime(600.0);
    drtModeConfig.setStopDuration(60);
    drtModeConfig.setRejectRequestIfMaxWaitOrTravelTimeViolated(true);
    drtModeConfig.setOperationalScheme(OperationalScheme.door2door);

    MultiModeDrtConfigGroup drtConfig = MultiModeDrtConfigGroup.get(config);
    drtConfig.addParameterSet(drtModeConfig);
    DrtConfigs.adjustDrtConfig(drtModeConfig, config.planCalcScore(), config.plansCalcRoute());

    // Create a fleet on the fly
    String vehiclesFile = new File("test_data/drt_vehicles.xml.gz").getAbsolutePath();
    drtModeConfig.setVehiclesFile(vehiclesFile);
    createFleet(vehiclesFile, 100, scenario.getNetwork());

    // Set up DVRP
    DvrpConfigGroup dvrpConfig = DvrpConfigGroup.get(config);
    dvrpConfig.setTravelTimeEstimationAlpha(1.0);
    dvrpConfig.setTravelTimeEstimationBeta(900);

    // SCENARIO PART
    scenario.getPopulation().getFactory().getRouteFactories().setRouteFactory(DrtRoute.class, new DrtRouteFactory());

    // CONTROLLER PART
    Controler controller = new Controler(scenario);

    // Add DVRP and activate modes
    controller.addOverridingModule(new DvrpModule());
    controller.configureQSimComponents(DvrpQSimComponents.activateModes(drtModeConfig.getMode()));

    if (!useAmodeus) {
        // No Amodeus, so we use standard MultiModeDrtModule
        controller.addOverridingModule(new MultiModeDrtModule());
    } else {
        // Add DRT, but NOT with MultiModeDrtModule, but with MultiModeDrtModuleForAmodeus
        // because right now we remove DRT's analysis components as they are not compatible yet
        controller.addOverridingModule(new MultiModeDrtModuleForAmodeus());
    }

    // Here we start overriding things of DRT with Amodeus
    if (useAmodeus) {

        // This is a per-mode config, which usually is contained in a AmodeusConfigGroup,
        // here we only use it to set up a small portion of Amodeus (the dispatching part),
        // and not scoring, waiting times, etc.
        AmodeusModeConfig amodeusModeConfig = new AmodeusModeConfig(drtModeConfig.getMode());

        // We can choose the dispatcher and set additional options. Note that some dispatchers
        // rely heavily on GLPK. You need to install it and then tell JAVA where to find it
        // via -Djava.library.path=/path/to/glpk/lib/jni on the command line.
        amodeusModeConfig.getDispatcherConfig().setType("FeedforwardFluidicRebalancingPolicy");

        // Change, for instance, to "GlobalBipartiteMatchingDispatcher" if you want to
        // test without GLPK!

        // Disable Amodeus-specific output (e.g., for the viewer)
        amodeusModeConfig.getDispatcherConfig().setPublishPeriod(0);

        // Path where to generate or read a VirtualNetwork and TravelData for rebalancing.
        // Note that not all dispatchers need this.
        amodeusModeConfig.getDispatcherConfig().setVirtualNetworkPath(new File("test_data/virtualNetwork").getAbsolutePath());
        amodeusModeConfig.getDispatcherConfig().setTravelDataPath(new File("test_data/travelData").getAbsolutePath());

        // Add a subset of Amodeus modules which usually would be added automatically
        // in the upper-level AmodeusModule.
        controller.addOverridingModule(new VirtualNetworkModeModule(amodeusModeConfig));
        controller.addOverridingModule(new AmodeusModule());

        // Add overriding modules for the Drt <-> Amodeus integration, which override some
        // components of DRT. Later on, we would only override DrtOptimizer, but we are
        // not there yet, because Amodeus internally still works with AmodeusStayTask, etc.
        // and does not understand DrtStayTask, etc.
        controller.addOverridingModule(new AmodeusDrtModule(amodeusModeConfig));
        controller.addOverridingQSimModule(new AmodeusDrtQSimModule(drtModeConfig.getMode()));
    }

    controller.run();
}
 
Example 15
Source File: SocketServer.java    From amod with GNU General Public License v2.0 4 votes vote down vote up
/** runs a simulation run using input data from Amodeus.properties, av.xml and MATSim config.xml
 * 
 * @throws MalformedURLException
 * @throws Exception */

public void simulate(StringSocket stringSocket, int numReqTot, //
        File workingDirectory) throws MalformedURLException, Exception {
    Static.setup();
    /** working directory and options */
    scenarioOptions = new ScenarioOptions(workingDirectory, ScenarioOptionsBase.getDefault());

    /** set to true in order to make server wait for at least 1 client, for
     * instance viewer client, for fals the ScenarioServer starts the simulation
     * immediately */
    boolean waitForClients = scenarioOptions.getBoolean("waitForClients");
    configFile = new File(scenarioOptions.getSimulationConfigName());
    /** geographic information */
    LocationSpec locationSpec = scenarioOptions.getLocationSpec();
    referenceFrame = locationSpec.referenceFrame();

    /** open server port for clients to connect to */
    SimulationServer.INSTANCE.startAcceptingNonBlocking();
    SimulationServer.INSTANCE.setWaitForClients(waitForClients);

    /** load MATSim configs - including av.xml configurations, load routing packages */
    GlobalAssert.that(configFile.exists());
    DvrpConfigGroup dvrpConfigGroup = new DvrpConfigGroup();
    dvrpConfigGroup.setTravelTimeEstimationAlpha(0.05);
    Config config = ConfigUtils.loadConfig(configFile.toString(), new AmodeusConfigGroup(), dvrpConfigGroup);
    config.planCalcScore().addActivityParams(new ActivityParams("activity"));
    // TODO @Sebastian fix this to meaningful values, remove, or add comment
    // this was added because there are sometimes problems, is there a more elegant option?
    for (ActivityParams activityParams : config.planCalcScore().getActivityParams()) {
        activityParams.setTypicalDuration(3600.0);
    }

    /** load MATSim scenario for simulation */
    Scenario scenario = ScenarioUtils.loadScenario(config);
    AddCoordinatesToActivities.run(scenario);
    network = scenario.getNetwork();
    Population population = scenario.getPopulation();
    GlobalAssert.that(Objects.nonNull(network));
    GlobalAssert.that(Objects.nonNull(population));

    Objects.requireNonNull(network);
    MatsimAmodeusDatabase db = MatsimAmodeusDatabase.initialize(network, referenceFrame);
    Controler controller = new Controler(scenario);
    AmodeusConfigurator.configureController(controller, db, scenarioOptions);

    /** try to load link speed data and use for speed adaption in network */
    try {
        File linkSpeedDataFile = new File(scenarioOptions.getLinkSpeedDataName());
        System.out.println(linkSpeedDataFile.toString());
        LinkSpeedDataContainer lsData = LinkSpeedUtils.loadLinkSpeedData(linkSpeedDataFile);
        controller.addOverridingQSimModule(new TrafficDataModule(lsData));
    } catch (Exception exception) {
        System.err.println("Unable to load linkspeed data, freeflow speeds will be used in the simulation.");
        exception.printStackTrace();
    }

    controller.addOverridingModule(new SocketModule(stringSocket, numReqTot));

    /** Custom router that ensures same network speeds as taxis in original data set. */
    controller.addOverridingModule(new AbstractModule() {
        @Override
        public void install() {
            bind(TaxiTravelTimeRouter.Factory.class);
            AmodeusUtils.bindRouterFactory(binder(), TaxiTravelTimeRouter.class.getSimpleName()).to(TaxiTravelTimeRouter.Factory.class);
        }
    });

    /** adding the dispatcher to receive and process string fleet commands */
    controller.addOverridingModule(new AbstractModule() {
        @Override
        public void install() {
            AmodeusUtils.registerDispatcherFactory(binder(), "SocketDispatcherHost", SocketDispatcherHost.Factory.class);
        }
    });

    /** adding an initial vehicle placer */
    controller.addOverridingModule(new AbstractModule() {
        @Override
        public void install() {
            AmodeusUtils.bindGeneratorFactory(binder(), RandomDensityGenerator.class.getSimpleName()).//
            to(RandomDensityGenerator.Factory.class);
        }
    });

    /** run simulation */
    controller.run();

    /** close port for visualizaiton */
    SimulationServer.INSTANCE.stopAccepting();

    /** perform analysis of simulation */
    /** output directory for saving results */
    outputDirectory = new File(config.controler().getOutputDirectory());

}