Skip to content

Commit a1e8984

Browse files
authored
Merge pull request #106 from msmobility/noisedrt
noisedrt + matsim 12 + destination choice speed-up
2 parents 31f35d2 + 0099d9e commit a1e8984

49 files changed

Lines changed: 2300 additions & 354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: java
22
dist: trusty
33
jdk:
4-
- oraclejdk8
4+
- openjdk11
55
jobs:
66
include:
77
- stage: test

pom.xml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,60 @@
2222
<developerConnection>scm:git:git@github.com:msmobility/mito.git</developerConnection>
2323
</scm>
2424
<repositories>
25+
<repository>
26+
<id>matsim</id>
27+
<url>http://dl.bintray.com/matsim/matsim</url>
28+
</repository>
2529
<repository>
2630
<id>bintray-msmobility-maven</id>
2731
<name>bintray</name>
2832
<url>http://dl.bintray.com/msmobility/maven</url>
2933
</repository>
34+
<repository>
35+
<id>oss-jfrog-artifactory</id>
36+
<name>artifactory-snapshots</name>
37+
<url>https://oss.jfrog.org/oss-snapshot-local</url>
38+
</repository>
3039
<repository>
3140
<id>maven2-repository.dev.java.net</id>
3241
<name>Java.net repository</name>
3342
<url>http://download.java.net/maven/2</url>
3443
</repository>
35-
<repository>
36-
<snapshots>
37-
<enabled>true</enabled>
38-
</snapshots>
39-
<id>boundless</id>
40-
<name>Boundless Maven Repository</name>
41-
<url>http://repo.boundlessgeo.com/main</url>
42-
</repository>
43-
<repository>
44-
<id>matsim</id>
45-
<url>http://dl.bintray.com/matsim/matsim</url>
46-
</repository>
4744
</repositories>
4845
<build>
4946
<plugins>
47+
<plugin>
48+
<artifactId>maven-assembly-plugin</artifactId>
49+
<version>3.2.0</version>
50+
<configuration>
51+
<archive>
52+
<manifest>
53+
<addClasspath>true</addClasspath>
54+
<classpathPrefix>lib/</classpathPrefix>
55+
<mainClass>de.tum.bgu.msm.run.scenarios.drtNoise.RunDrtNoise</mainClass>
56+
</manifest>
57+
</archive>
58+
<descriptorRefs>
59+
<descriptorRef>jar-with-dependencies</descriptorRef>
60+
</descriptorRefs>
61+
</configuration>
62+
<executions>
63+
<execution>
64+
<id>make-assembly</id> <!-- this is used for inheritance merges -->
65+
<phase>package</phase> <!-- bind to the packaging phase -->
66+
<goals>
67+
<goal>single</goal>
68+
</goals>
69+
</execution>
70+
</executions>
71+
</plugin>
5072
<plugin>
5173
<groupId>org.apache.maven.plugins</groupId>
5274
<artifactId>maven-compiler-plugin</artifactId>
53-
<version>2.3.2</version>
75+
<version>3.8.0</version>
5476
<configuration>
55-
<source>1.8</source>
56-
<target>1.8</target>
77+
<source>11</source>
78+
<target>11</target>
5779
<showWarnings>false</showWarnings>
5880
<showDeprecation>false</showDeprecation>
5981
<encoding>UTF-8</encoding>
@@ -152,11 +174,6 @@
152174
<artifactId>guava</artifactId>
153175
<version>24.1.1-jre</version>
154176
</dependency>
155-
<dependency>
156-
<groupId>org.jfree</groupId>
157-
<artifactId>jfreechart</artifactId>
158-
<version>1.0.14</version>
159-
</dependency>
160177
<dependency>
161178
<groupId>org.matsim</groupId>
162179
<artifactId>matsim</artifactId>
@@ -188,6 +205,11 @@
188205
</exclusion>
189206
</exclusions>
190207
</dependency>
208+
<dependency>
209+
<groupId>org.matsim.contrib</groupId>
210+
<artifactId>drt</artifactId>
211+
<version>${matsimVersion}</version>
212+
</dependency>
191213
<dependency>
192214
<groupId>org.matsim.contrib</groupId>
193215
<artifactId>accessibility</artifactId>
@@ -211,6 +233,6 @@
211233
</dependencies>
212234
<properties>
213235
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
214-
<matsimVersion>11.0</matsimVersion>
236+
<matsimVersion>12.0</matsimVersion>
215237
</properties>
216238
</project>

resources/log4j.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ log4j.rootLogger=INFO, stdout
22
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
33
log4j.appender.stdout.Target=System.out
44
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5-
log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n
5+
log4j.appender.stdout.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %C %p %c{2}: %m%n

src/main/java/de/tum/bgu/msm/MitoModel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void run() {
6565
long startTime = System.currentTimeMillis();
6666
logger.info("Started the Microsimulation Transport Orchestrator (MITO)");
6767

68-
TravelDemandGenerator ttd = new TravelDemandGenerator(dataSet);
68+
TravelDemandGenerator ttd = new TravelDemandGenerator.Builder(dataSet).build();
6969
ttd.generateTravelDemand(scenarioName);
7070
printOutline(startTime);
7171
}
@@ -117,4 +117,7 @@ public String getScenarioName() {
117117
public void setRandomNumberGenerator(Random random) {
118118
MitoUtil.initializeRandomNumber(random);
119119
}
120+
121+
122+
120123
}

src/main/java/de/tum/bgu/msm/TravelDemandGenerator.java

Lines changed: 160 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import de.tum.bgu.msm.data.DataSet;
44
import de.tum.bgu.msm.io.output.*;
5+
import de.tum.bgu.msm.modules.Module;
56
import de.tum.bgu.msm.modules.modeChoice.ModeChoice;
67
import de.tum.bgu.msm.modules.personTripAssignment.PersonTripAssignment;
78
import de.tum.bgu.msm.modules.plansConverter.MatsimPopulationGenerator;
@@ -21,55 +22,196 @@
2122
* @author Rolf Moeckel
2223
* Created on Sep 18, 2016 in Munich, Germany
2324
*/
24-
public class TravelDemandGenerator {
25+
public final class TravelDemandGenerator {
2526

2627
private static final Logger logger = Logger.getLogger(TravelDemandGenerator.class);
2728
private final DataSet dataSet;
2829

29-
TravelDemandGenerator(DataSet dataSet) {
30+
private final Module tripGeneration;
31+
private final Module personTripAssignment;
32+
private final Module travelTimeBudget;
33+
private final Module distribution;
34+
private final Module modeChoice;
35+
private final Module timeOfDayChoice;
36+
private final Module tripScaling;
37+
private final Module matsimPopulationGenerator;
38+
private final Module longDistanceTraffic;
39+
40+
private TravelDemandGenerator(
41+
DataSet dataSet,
42+
Module tripGeneration,
43+
Module personTripAssignment,
44+
Module travelTimeBudget,
45+
Module distribution,
46+
Module modeChoice,
47+
Module timeOfDayChoice,
48+
Module tripScaling,
49+
Module matsimPopulationGenerator,
50+
Module longDistanceTraffic) {
51+
3052
this.dataSet = dataSet;
53+
54+
this.tripGeneration = tripGeneration;
55+
this.personTripAssignment = personTripAssignment;
56+
this.travelTimeBudget = travelTimeBudget;
57+
this.distribution = distribution;
58+
this.modeChoice = modeChoice;
59+
this.timeOfDayChoice = timeOfDayChoice;
60+
this.tripScaling = tripScaling;
61+
this.matsimPopulationGenerator = matsimPopulationGenerator;
62+
this.longDistanceTraffic = longDistanceTraffic;
63+
}
64+
65+
66+
public static class Builder {
67+
68+
private final DataSet dataSet;
69+
70+
private Module tripGeneration;
71+
private Module personTripAssignment;
72+
private Module travelTimeBudget;
73+
private Module distribution;
74+
private Module modeChoice;
75+
private Module timeOfDayChoice;
76+
private Module tripScaling;
77+
private Module matsimPopulationGenerator;
78+
private Module longDistanceTraffic;
79+
80+
public Builder(DataSet dataSet) {
81+
this.dataSet = dataSet;
82+
tripGeneration = new TripGeneration(dataSet);
83+
personTripAssignment = new PersonTripAssignment(dataSet);
84+
travelTimeBudget = new TravelTimeBudgetModule(dataSet);
85+
distribution = new TripDistribution(dataSet);
86+
modeChoice = new ModeChoice(dataSet);
87+
timeOfDayChoice = new TimeOfDayChoice(dataSet);
88+
tripScaling = new TripScaling(dataSet);
89+
matsimPopulationGenerator = new MatsimPopulationGenerator(dataSet);
90+
if (Resources.instance.getBoolean(Properties.ADD_EXTERNAL_FLOWS, false)) {
91+
longDistanceTraffic = new LongDistanceTraffic(dataSet, Double.parseDouble(Resources.instance.getString(Properties.TRIP_SCALING_FACTOR)));
92+
}
93+
}
94+
95+
public TravelDemandGenerator build() {
96+
return new TravelDemandGenerator(dataSet,
97+
tripGeneration,
98+
personTripAssignment,
99+
travelTimeBudget,
100+
distribution,
101+
modeChoice,
102+
timeOfDayChoice,
103+
tripScaling,
104+
matsimPopulationGenerator,
105+
longDistanceTraffic);
106+
}
107+
108+
public void setTripGeneration(Module tripGeneration) {
109+
this.tripGeneration = tripGeneration;
110+
}
111+
112+
public void setPersonTripAssignment(Module personTripAssignment) {
113+
this.personTripAssignment = personTripAssignment;
114+
}
115+
116+
public void setTravelTimeBudget(Module travelTimeBudget) {
117+
this.travelTimeBudget = travelTimeBudget;
118+
}
119+
120+
public void setDistribution(Module distribution) {
121+
this.distribution = distribution;
122+
}
123+
124+
public void setModeChoice(Module modeChoice) {
125+
this.modeChoice = modeChoice;
126+
}
127+
128+
public void setTimeOfDayChoice(Module timeOfDayChoice) {
129+
this.timeOfDayChoice = timeOfDayChoice;
130+
}
131+
132+
public void setTripScaling(Module tripScaling) {
133+
this.tripScaling = tripScaling;
134+
}
135+
136+
public void setMatsimPopulationGenerator(Module matsimPopulationGenerator) {
137+
this.matsimPopulationGenerator = matsimPopulationGenerator;
138+
}
139+
140+
public void setLongDistanceTraffic(Module longDistanceTraffic) {
141+
this.longDistanceTraffic = longDistanceTraffic;
142+
}
143+
144+
public DataSet getDataSet() {
145+
return dataSet;
146+
}
147+
148+
public Module getTripGeneration() {
149+
return tripGeneration;
150+
}
151+
152+
public Module getPersonTripAssignment() {
153+
return personTripAssignment;
154+
}
155+
156+
public Module getTravelTimeBudget() {
157+
return travelTimeBudget;
158+
}
159+
160+
public Module getDistribution() {
161+
return distribution;
162+
}
163+
164+
public Module getModeChoice() {
165+
return modeChoice;
166+
}
167+
168+
public Module getTimeOfDayChoice() {
169+
return timeOfDayChoice;
170+
}
171+
172+
public Module getTripScaling() {
173+
return tripScaling;
174+
}
175+
176+
public Module getMatsimPopulationGenerator() {
177+
return matsimPopulationGenerator;
178+
}
179+
180+
public Module getLongDistanceTraffic() {
181+
return longDistanceTraffic;
182+
}
31183
}
32184

33-
void generateTravelDemand(String scenarioName) {
185+
public void generateTravelDemand(String scenarioName) {
34186

35187
logger.info("Running Module: Microscopic Trip Generation");
36-
TripGeneration tg = new TripGeneration(dataSet);
37-
tg.run();
188+
tripGeneration.run();
38189
if (dataSet.getTrips().isEmpty()) {
39190
logger.warn("No trips created. End of program.");
40191
return;
41192
}
42193

43-
44194
logger.info("Running Module: Person to Trip Assignment");
45-
PersonTripAssignment personTripAssignment = new PersonTripAssignment(dataSet);
46195
personTripAssignment.run();
47196

48197
logger.info("Running Module: Travel Time Budget Calculation");
49-
TravelTimeBudgetModule ttb = new TravelTimeBudgetModule(dataSet);
50-
ttb.run();
198+
travelTimeBudget.run();
51199

52200
logger.info("Running Module: Microscopic Trip Distribution");
53-
TripDistribution distribution = new TripDistribution(dataSet);
54201
distribution.run();
55202

56203
logger.info("Running Module: Trip to Mode Assignment (Mode Choice)");
57-
ModeChoice modeChoice = new ModeChoice(dataSet);
58204
modeChoice.run();
59205

60206
logger.info("Running time of day choice");
61-
TimeOfDayChoice timeOfDayChoice = new TimeOfDayChoice(dataSet);
62207
timeOfDayChoice.run();
63208

64209
logger.info("Running trip scaling");
65-
TripScaling tripScaling = new TripScaling(dataSet);
66210
tripScaling.run();
67211

68-
MatsimPopulationGenerator matsimPopulationGenerator = new MatsimPopulationGenerator(dataSet);
69212
matsimPopulationGenerator.run();
70213

71214
if (Resources.instance.getBoolean(Properties.ADD_EXTERNAL_FLOWS, false)) {
72-
LongDistanceTraffic longDistanceTraffic = new LongDistanceTraffic(dataSet, Double.parseDouble(Resources.instance.getString(Properties.TRIP_SCALING_FACTOR)));
73215
longDistanceTraffic.run();
74216
}
75217

@@ -85,5 +227,8 @@ void generateTravelDemand(String scenarioName) {
85227
ModeChoicePlots.writeModeChoice(dataSet, scenarioName);
86228
SummarizeData.writeCharts(dataSet, scenarioName);
87229
}
230+
if (Resources.instance.getBoolean(Properties.WRITE_MATSIM_POPULATION, true)) {
231+
SummarizeData.writeMatsimPlans(dataSet, scenarioName);
232+
}
88233
}
89234
}

0 commit comments

Comments
 (0)