21 package org.matsim.core.config.groups;
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
52 this.fileEnding = fileEnding;
67 private static final String
RUNID =
"runId";
69 static final String EVENTS_FILE_FORMAT =
"eventsFileFormat";
84 static final String MOBSIM =
"mobsim";
122 Map<String,String> map = super.getComments();
123 map.put(ROUTINGALGORITHM_TYPE,
"The type of routing (least cost path) algorithm used, may have the values: " + Arrays.toString(
RoutingAlgorithmType.values()));
124 map.put(RUNID,
"An identifier for the current run which is used as prefix for output files and mentioned in output xml files etc.");
126 "Multiple values can be specified separated by commas (',').");
127 map.put(WRITE_EVENTS_INTERVAL,
"iterationNumber % writeEventsInterval == 0 defines in which iterations events are written " +
128 "to a file. `0' disables events writing completely.");
129 map.put(WRITE_TRIPS_INTERVAL,
"iterationNumber % writeEventsInterval == 0 defines in which iterations trips CSV are written " +
130 "to a file. `0' disables trips writing completely.");
131 map.put(WRITE_PLANS_INTERVAL,
"iterationNumber % writePlansInterval == 0 defines (hopefully) in which iterations plans are " +
132 "written to a file. `0' disables plans writing completely. Some plans in early iterations are always written");
133 map.put(LINKTOLINK_ROUTING_ENABLED,
"Default=false. If enabled, the router takes travel times needed for turning moves into account." 134 +
" Can only be used with Dijkstra routing. Cannot be used when TravelTimeCalculator.separateModes is enabled.");
135 map.put(FIRST_ITERATION,
"Default=0. First Iteration of a simulation.");
136 map.put(LAST_ITERATION,
"Default=1000. Last Iteration of a simulation.");
138 map.put(CREATE_GRAPHS,
"Sets whether graphs showing some analyses should automatically be generated during the simulation." +
139 " The generation of graphs usually takes a small amount of time that does not have any weight in big simulations," +
140 " but add a significant overhead in smaller runs or in test cases where the graphical output is not even requested." );
142 map.put(CREATE_GRAPHS_INTERVAL,
"Sets the interval in which graphs are generated. Default is 1. If set to 0, no graphs are generated." +
143 " The generation of graphs usually takes a small amount of time that does not have any weight in big simulations," +
144 " but add a significant overhead in smaller runs or in test cases where the graphical output is not even requested." );
146 map.put(COMPRESSION_TYPE,
"Compression algorithm to use when writing out data to files. Possible values: " + Arrays.toString(
CompressionType.values()));
147 map.put(EVENT_TYPE_TO_CREATE_SCORING_FUNCTIONS,
"Defines when the scoring functions for the population are created. Default=IterationStarts. Possible values: " + Arrays.toString(
EventTypeToCreateScoringFunctions.values()));
149 map.put(MOBSIM,
"Defines which mobility simulation will be used. Currently supported: " + Arrays.toString(
MobsimType.values()) +
IOUtils.
NATIVE_NEWLINE +
"\t\t" +
150 "Depending on the chosen mobsim, you'll have to add additional config modules to configure the corresponding mobsim." +
IOUtils.
NATIVE_NEWLINE +
"\t\t" +
151 "For 'qsim', add a module 'qsim' to the config.");
153 map.put(SNAPSHOT_FORMAT,
"Comma-separated list of visualizer output file formats. `transims' and `otfvis'.");
154 map.put(WRITE_SNAPSHOTS_INTERVAL,
"iterationNumber % " + WRITE_SNAPSHOTS_INTERVAL +
" == 0 defines in which iterations snapshots are written " +
155 "to a file. `0' disables snapshots writing completely");
156 map.put(DUMP_DATA_AT_END,
"true if at the end of a run, plans, network, config etc should be dumped to a file");
157 map.put(CLEAN_ITERS_AT_END,
"Defines what should be done with the ITERS directory when a simulation finished successfully");
158 map.put(MEMORY_OBSERVER_INTERVAL,
"Defines the interval for printing memory usage to the log in [seconds]. Must be positive. Defaults to 60.");
233 if (runid.equals(
"")) {
234 log.info(
"No run Id provided. Setting run Id to null.");
255 boolean isFirst =
true;
256 StringBuilder str =
new StringBuilder();
261 str.append(format.toString());
264 return str.toString();
271 for (String part : parts) {
272 String trimmed = part.trim();
273 if (trimmed.length() > 0) {
285 this.eventsFileFormats = Collections.unmodifiableSet(EnumSet.copyOf(eventsFileFormats));
294 Set<SnapshotFormat> formats = EnumSet.noneOf(
SnapshotFormat.class );
295 for (String part : parts) {
296 String trimmed = part.trim();
297 if (trimmed.length() > 0) {
306 boolean isFirst =
true;
307 StringBuilder str =
new StringBuilder();
312 str.append(format.name());
315 return str.toString();
319 this.snapshotFormat = Collections.unmodifiableSet(EnumSet.copyOf( snapshotFormat) );
388 log.warn(
"Parameter 'createGraphs' is deprecated. Using 'createGraphsInterval' instead. The output_config.xml will contain the new parameter.");
447 int writePlansUntilIteration = 1 ;
449 return this.writePlansUntilIteration ;
452 this.writePlansUntilIteration = val ;
455 int writeEventsUntilIteration = 0 ;
457 return this.writeEventsUntilIteration ;
460 this.writeEventsUntilIteration = val ;
466 log.warn(
"this is not recommended, as it might result in a directory containing output from several model runs" );
470 log.warn(
"Memory observer interval is negative. Simulation will most likely crash.");
CleanIterations getCleanItersAtEnd()
static final String CREATE_GRAPHS
static final String CREATE_GRAPHS_INTERVAL
static final String DUMP_DATA_AT_END
static final String OUTPUT_DIRECTORY
void setCreateGraphs(boolean createGraphs)
static final String NATIVE_NEWLINE
void setSnapshotFormats(final String value)
int writeSnapshotsInterval
int getWriteEventsUntilIteration()
static final String CLEAN_ITERS_AT_END
static final String FIRST_ITERATION
static final String WRITE_TRIPS_INTERVAL
void setRoutingAlgorithmType(final RoutingAlgorithmType type)
boolean linkToLinkRoutingEnabled
final Map< String, String > getComments()
boolean isLinkToLinkRoutingEnabled()
int getWriteEventsInterval()
void setCleanItersAtEnd(CleanIterations cleanItersAtEnd)
void setRunId(final String runid)
void setLinkToLinkRoutingEnabled(final boolean enabled)
int getWritePlansUntilIteration()
void setMobsim(final String mobsim)
void setFirstIteration(final int firstIteration)
static String [] explode(final String str, final char delimiter, final int limit)
void setLastIteration(final int lastIteration)
Set< EventsFileFormat > getEventsFileFormats()
static final String LINKTOLINK_ROUTING_ENABLED
String getEventsFileFormatAsString()
RoutingAlgorithmType routingAlgorithmType
void setMemoryObserverInterval(int memoryObserverInterval)
Set< EventsFileFormat > eventsFileFormats
static final String GROUP_NAME
void setCreateGraphsInterval(int createGraphsInterval)
void setWriteEventsUntilIteration(int val)
static final String COMPRESSION_TYPE
void setOverwriteFileSetting(final OverwriteFileSetting overwriteFileSetting)
String getSnapshotFormatAsString()
void checkConsistency(Config config)
void setEventsFileFormats(final Set< EventsFileFormat > eventsFileFormats)
boolean getDumpDataAtEnd()
static final String SNAPSHOT_FORMAT
void setWritePlansUntilIteration(int val)
int getCreateGraphsInterval()
EventTypeToCreateScoringFunctions getEventTypeToCreateScoringFunctions()
static final String MEMORY_OBSERVER_INTERVAL
Set< SnapshotFormat > snapshotFormat
void setWritePlansInterval(final int writePlansInterval)
static final String RUNID
OverwriteFileSetting getOverwriteFileSetting()
int getWriteTripsInterval()
int getWritePlansInterval()
static final String WRITE_PLANS_INTERVAL
static final String LAST_ITERATION
static final String EVENT_TYPE_TO_CREATE_SCORING_FUNCTIONS
int memoryObserverInterval
int getWriteSnapshotsInterval()
void setWriteSnapshotsInterval(int writeSnapshotsInterval)
void setWriteEventsInterval(final int writeEventsInterval)
void setOutputDirectory(final String outputDirectory)
void setDumpDataAtEnd(boolean dumpDataAtEnd)
static final String WRITE_SNAPSHOTS_INTERVAL
CompressionType getCompressionType()
static final String OVERWRITE_FILE
void setCompressionType(CompressionType type)
static final String ROUTINGALGORITHM_TYPE
RoutingAlgorithmType getRoutingAlgorithmType()
static final String WRITE_EVENTS_INTERVAL
void setWriteTripsInterval(int writeTripsInterval)
final ControllerConfigGroup controller()
void setEventFileFormats(final String value)
EventTypeToCreateScoringFunctions eventTypeToCreateScoringFunctions
OverwriteFileSetting overwriteFileSetting
Collection< SnapshotFormat > getSnapshotFormat()
String getOutputDirectory()
CompressionType(String fileEnding)
int getMemoryObserverInterval()
void setSnapshotFormat(final Collection< SnapshotFormat > snapshotFormat)
CleanIterations cleanItersAtEnd
CompressionType compressionType
void setEventTypeToCreateScoringFunctions(EventTypeToCreateScoringFunctions eventTypeToCreateScoringFunctions)