Skip to content

Commit

Permalink
move scenario classes to dedicated package
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Sep 26, 2024
1 parent 4327d34 commit 1ebe6eb
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/matsim/run/RunLausitzDrtScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.matsim.core.controler.Controler;
import org.matsim.core.network.algorithms.MultimodalNetworkCleaner;
import org.matsim.core.utils.geometry.geotools.MGC;
import org.matsim.run.scenarios.LausitzScenario;
import org.matsim.vehicles.Vehicle;
import org.matsim.vehicles.VehicleCapacity;
import org.matsim.vehicles.VehicleType;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/matsim/run/RunLausitzPtScenario.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.matsim.run;

import org.matsim.application.MATSimApplication;
import org.matsim.run.scenarios.LausitzPtScenario;

/**
* Run the Lausitz PT scenario policy case.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/matsim/run/RunLausitzScenario.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.matsim.run;

import org.matsim.application.MATSimApplication;
import org.matsim.run.scenarios.LausitzScenario;

/**
* Run the Lausitz scenario with default configuration.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.matsim.run;

import org.matsim.application.MATSimApplication;
import org.matsim.run.scenarios.LausitzSingleModeScenario;

/**
* Run the Lausitz single mode scenario policy case.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.matsim.run;

import org.matsim.application.MATSimApplication;
import org.matsim.run.scenarios.LausitzSpeedReductionScenario;

/**
* Run the Lausitz speed reduction scenario policy case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Map;
import java.util.Set;

import static org.matsim.run.LausitzScenario.*;
import static org.matsim.run.scenarios.LausitzScenario.*;

@CommandLine.Command(
name = "adapt-freight-plans",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/prepare/PrepareNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import java.util.Set;

import static org.matsim.run.LausitzScenario.*;
import static org.matsim.run.scenarios.LausitzScenario.*;

@CommandLine.Command(
name = "network",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.run;
package org.matsim.run.scenarios;

import org.matsim.api.core.v01.Coord;
import org.matsim.api.core.v01.Id;
Expand Down Expand Up @@ -46,15 +46,15 @@ public static void main(String[] args) {

@Nullable
@Override
protected Config prepareConfig(Config config) {
public Config prepareConfig(Config config) {
// apply all config changes from base scenario class
baseScenario.prepareConfig(config);

return config;
}

@Override
protected void prepareScenario(Scenario scenario) {
public void prepareScenario(Scenario scenario) {
// apply all scenario changes from base scenario class
baseScenario.prepareScenario(scenario);

Expand Down Expand Up @@ -147,7 +147,7 @@ protected void prepareScenario(Scenario scenario) {
}

@Override
protected void prepareControler(Controler controler) {
public void prepareControler(Controler controler) {
// apply all controller changes from base scenario class
baseScenario.prepareControler(controler);
// TODO: add potential new Listeners here
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.run;
package org.matsim.run.scenarios;

import com.google.common.collect.Sets;
import org.matsim.analysis.personMoney.PersonMoneyEventsAnalysisModule;
Expand Down Expand Up @@ -108,7 +108,7 @@ public static void main(String[] args) {

@Nullable
@Override
protected Config prepareConfig(Config config) {
public Config prepareConfig(Config config) {

// Add all activity types with time bins
SnzActivities.addScoringParams(config);
Expand Down Expand Up @@ -184,7 +184,7 @@ protected Config prepareConfig(Config config) {
}

@Override
protected void prepareScenario(Scenario scenario) {
public void prepareScenario(Scenario scenario) {
// add freight and truck as allowed modes together with car
PrepareNetwork.prepareFreightNetwork(scenario.getNetwork());

Expand All @@ -197,7 +197,7 @@ protected void prepareScenario(Scenario scenario) {
}

@Override
protected void prepareControler(Controler controler) {
public void prepareControler(Controler controler) {

//analyse PersonMoneyEvents
controler.addOverridingModule(new PersonMoneyEventsAnalysisModule());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.run;
package org.matsim.run.scenarios;

import com.google.common.collect.Lists;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -43,7 +43,7 @@ public LausitzSingleModeScenario() {

@Nullable
@Override
protected Config prepareConfig(Config config) {
public Config prepareConfig(Config config) {
// apply all config changes from base scenario class
baseScenario.prepareConfig(config);

Expand All @@ -61,7 +61,7 @@ protected Config prepareConfig(Config config) {
}

@Override
protected void prepareScenario(Scenario scenario) {
public void prepareScenario(Scenario scenario) {
// apply all scenario changes from base scenario class
baseScenario.prepareScenario(scenario);

Expand Down Expand Up @@ -91,7 +91,7 @@ protected void prepareScenario(Scenario scenario) {
}

@Override
protected void prepareControler(Controler controler) {
public void prepareControler(Controler controler) {
// apply all controller changes from base scenario class
baseScenario.prepareControler(controler);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.matsim.run;
package org.matsim.run.scenarios;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -47,14 +47,14 @@ public LausitzSpeedReductionScenario() {

@Nullable
@Override
protected Config prepareConfig(Config config) {
public Config prepareConfig(Config config) {
// apply all config changes from base scenario class
baseScenario.prepareConfig(config);
return config;
}

@Override
protected void prepareScenario(Scenario scenario) {
public void prepareScenario(Scenario scenario) {
// apply all scenario changes from base scenario class
baseScenario.prepareScenario(scenario);

Expand All @@ -81,7 +81,7 @@ protected void prepareScenario(Scenario scenario) {
}

@Override
protected void prepareControler(Controler controler) {
public void prepareControler(Controler controler) {
// apply all controller changes from base scenario class
baseScenario.prepareControler(controler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.dashboards.LausitzSimWrapperRunner;
import org.matsim.run.scenarios.LausitzScenario;
import org.matsim.simwrapper.SimWrapperConfigGroup;
import org.matsim.testcases.MatsimTestUtils;

Expand Down
4 changes: 4 additions & 0 deletions src/test/java/org/matsim/run/RunIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
import org.matsim.core.router.TripStructureUtils;
import org.matsim.core.scenario.ScenarioUtils;
import org.matsim.pt.transitSchedule.api.*;
import org.matsim.run.scenarios.LausitzPtScenario;
import org.matsim.run.scenarios.LausitzScenario;
import org.matsim.run.scenarios.LausitzSingleModeScenario;
import org.matsim.run.scenarios.LausitzSpeedReductionScenario;
import org.matsim.simwrapper.SimWrapperConfigGroup;
import org.matsim.testcases.MatsimTestUtils;

Expand Down

0 comments on commit 1ebe6eb

Please sign in to comment.