Skip to content

A small example of how to use MATSim as a library for Subtrans

License

Notifications You must be signed in to change notification settings

CENIA-DEV/subtrans-matsim-project

 
 

Repository files navigation

SUBTRANS - MATSim Test Project

MATSim Info

  • MATSim is designed to model a single day
  • A MATSim run contains a configurable number of iterations, represented by the loop of Figure 1.1 and detailed below. It starts with an initial demand arising from the study area population’s daily activity chains. The modeled persons are called agents in MATSim. During iterations, this initial demand is optimized individually by each agent. Every agent possesses a memory containing a fixed number of day plans,

    Figure 1.1. MATSim Loop.

Project Info

A small example of how to use MATSim as a library.

By default, this project uses the latest (pre-)release. In order to use a different version, edit pom.xml.

A recommended directory structure is as follows:

  • src for sources
  • original-input-data for original input data (typically not in MATSim format)
  • scenarios for MATSim scenarios, i.e. MATSim input and output data. A good way is the following:
    • One subdirectory for each scenario, e.g. scenarios/mySpecialScenario01.
    • This minimally contains a config file, a network file, and a population file.
    • Output goes one level down, e.g. scenarios/mySpecialScenario01/output-from-a-good-run/....

Java Version

The project uses Java 11. Usually a suitable SDK is packaged within IntelliJ or Eclipse. Otherwise, one must install a suitable sdk manually, which is available here

Building and Running it locally

You can build an executable jar-file by executing the following command:

./mvnw clean package

or on Windows:

mvnw.cmd clean package

This will download all necessary dependencies (it might take a while the first time it is run) and create a file matsim-example-project-0.0.1-SNAPSHOT.jar in the top directory. This jar-file can either be double-clicked to start the MATSim GUI, or executed with Java on the command line:

java -jar matsim-santiago-0.0.1-SNAPSHOT.jar

A more detailed version of the command

java -cp matsim-santiago-0.0.1-SNAPSHOT.jar -Xmx2048m org.matsim.project.RunMatsim scenarios\equil\config.xml
  • -cp is a class search path of directories and zip/jar files
  • -Xmx1024m Java Virtual Machine (JVM) option that sets the maximum heap size for the Java process. In this case, it sets the maximum heap size to 1024 megabytes (1 gigabyte)
  • org.matsim.project.RunMatsim is the main class that Java will execute. The actual program logic is within this class.
  • scenarios\equil\config.xml is a command-line argument passed to the org.matsim.project.RunMatsim class. It specifies the path to a configuration file (config.xml)

For our study case of Santiago, Chile

java -cp matsim-santiago-0.0.1-SNAPSHOT.jar -Xmx2048m org.matsim.project.RunMatsim .\scenarios\santiago-chile\config_baseCase10pct.xml *> output.log

Run windows executable with spaces in the filepath

& "C:\Program Files\Java\jdk-11.0.17\bin\java.exe" -Xmx2048m org.matsim.project.RunMatsim C:\inputSantiago\config_baseCase1pct.xml

MATSim Outputs

Licenses

(The following paragraphs need to be adjusted according to the specifications of your project.)

The MATSim program code in this repository is distributed under the terms of the GNU General Public License as published by the Free Software Foundation (version 2). The MATSim program code are files that reside in the src directory hierarchy and typically end with *.java.

The MATSim input files, output files, analysis data and visualizations are licensed under a Creative Commons Attribution 4.0 International License. Creative Commons License

MATSim input files are those that are used as input to run MATSim. They often, but not always, have a header pointing to matsim.org. They typically reside in the scenarios directory hierarchy. MATSim output files, analysis data, and visualizations are files generated by MATSim runs, or by postprocessing. They typically reside in a directory hierarchy starting with output.

Other data files, in particular in original-input-data, have their own individual licenses that need to be individually clarified with the copyright holders.

References

  • Kickhöfer, B., D. Hosse, K. Turner, and A. Tirachini (2016). Creating an open MATSimscenario from open data: The case of Santiago de Chile. VSP Working Paper 16-02. Seehttp://www.vsp.tu-berlin.de/publications. TU Berlin, Transport Systems Planning andTransport Telematics.

About

A small example of how to use MATSim as a library for Subtrans

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Batchfile 47.1%
  • Java 44.3%
  • HTML 4.9%
  • Python 3.7%