Code Monkey home page Code Monkey logo

discrete-mode-choice's Introduction

Discrete Mode Choice for MATSim

Attention! This repository is only kept for historical reasons. The Discrete Mode Choice extension has been converted to the Discrete Mode Choice contrib in the main MATSim repository. It is further maintained there and can be used more easily as a part of MATSim.


The Discrete Mode Choice extension for MATSim makes it easy to define fine-grained and custom mode choice behaviour in MATSim simulations. Have a look at the Getting Started guide to dive right in or have a look at the existing Components if you are already familiar with the basic concepts.

The extensions offers three major pathways for improving mode choice in MATSim:

  • A fully functional replacement of SubtourModeChoice, but with the possibility to easily define custom constraints such as operating areas for certain mobility services or mode restrictions for specific user groups
  • An "importance sampler" for MATSim which samples choice alternatives with utility-based probabilities rather than purely at random and has the potential to speed up convergence
  • A "mode choice in the loop" setup, in which MATSim acts as a bare assignment model, which runs in a loop with a customizable discrete mode choice model

To learn more about these applications (and how you can implement "frozen randomness") into your simulation, have a look at the Getting Started guide.

For more customized applications and set-ups, have a look at Customizing the framework.

Available versions

The DMC extension is currently kept compatible with the following MATSim versions:

MATSim DMC version
Weekly SNAPSHOT 12.0-2019w49 1.0.9 Build Status
Release 11.0 1.0.9-matsim11 Build Status
Release 0.10.1 1.0.9-matsim10 Build Status

Alternatively, you can clone this repository and use the current development version from the develop branch. Currently, it is 1.0.10-dev and compatible with MATSim 12.0-2020w08. However, we recommend using the DMC extension with a stable version of MATSim.

To use the Discrete Mode Choice extension you first need to add the ETH MATSim Bintray repository to your pom.xml:

<repository>
    <id>matsim-eth</id>
    <url>https://dl.bintray.com/matsim-eth/matsim</url>
</repository>

Add the following to your pom.xml dependencies to use the extension with version 1.0.9 and MATSim 11, for instance:

<dependency>
    <groupId>ch.ethz.matsim</groupId>
    <artifactId>discrete_mode_choice</artifactId>
    <version>1.0.9-matsim11</version>
</dependency>

Repository structure

This repository makes use of the GitFlow repository model. This means that development is taking place in the develop branch, while the current production version can be found in the master branch. Note that, contrary to the basic model, we use multiple master branches to maintain versions of the code that are compatible with different releases of MATSim. For instance, master-11 is compatible with MATSim 11. The master branch is kept compatible with the master branch of the MATSim main repository. Backports are always derived from the master branch into the specific backport branches.

For creating the backports, the recommended workflow is as follows: Branch backport-X from master, add changes for compatibility, merge back backport-X into master-X.

Literature

The Discrete Mode Choice extension has been used in the following publications:

discrete-mode-choice's People

Contributors

balacmi avatar ctchervenkov avatar davibicudo avatar sebhoerl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

discrete-mode-choice's Issues

Decoupling from MATSim

Further decouple the code from MATSim and provide a solely text-based or database-based interface

Unable to create injector, see the following errors:

Hi soel,

I download the package and follow the instruction in the gettingstarted.md but when i add the DiscreteModeChoiceModule inside the config_default.xml and run it then it report this error.
No implementation for org.matsim.core.replanning.PlanStrategy annotated with @com.google.inject.name.Named(value=DiscreteModeChoice) was bound.
at org.matsim.core.replanning.StrategyManagerModule.install(StrategyManagerModule.java:87) (via modules: com.google.inject.util.Modules$CombinedModule

I try both way
1st: add it through controler.addOveridingModule then using a helper from modechoie
2nd: add it through config by using DiscreteModeChoiceConfigGroup

THey both have the same error.

Use RoutingMode instead of MainModeIdentifier

In MATSim 12, MainModeIdentifier is only used for reading plans. There is now a TripStructureUtils.getRoutingMode, which retrieves the "routing mode" from any leg in a plan. This routing mode references the originating RoutingModule of the TripRouter. Whenever MainModeIdentifier is used in the MATSim 12 version of DMC, we should now use this routing mode instead of relying on the MainModeIdentifier.

Thread-safe Dijkstra closeable

The thread-safe Dijkstra is closeable now. Probably this should be used in a ShutdownListener or something like that!

Infrastructure for tracking predictions vs. realizations

We need a versatile infrastructure for tracking predictions of certain choice dimensions and the actual observed values in the simulation. For TRB 2018, we did something like that to compare the car travel times that go into the choice model for each trip vs. the car travel times that were observed in the simulation for the trips where the car mode had been chosen.

We need:

  • Something like a PredictionRecorder that is flexible enough to record multiple choice dimensions (for a first version, only double would probably be fine). It should provide methods to obtain a value by getValue(Id<Person> personId, int tripIndex).
  • Something like a ObservationRecorder, which, in essence, is just a MATSim EventListener. However, it must provide something like Optional<Double> getValue(Id<Person> personId, int tripIndex); to determine if a value is even present (maybe the mode has not been chosen) and, if so, provide the observation.
  • Some code that runs of the end of the iteration to stitch together both parts and create, for instance, a CSV file with person_id trip_id estimation observation. Later on, we can push this even further to automatically create a plot that quantifies the offset or something similar.

@ctchervenkov already has come code for that and maybe could take over the issue? :)

Update version

Remove all the old stuff and take v2 as the default version

Interpretation of maximum duration of activities

Currently, we have a problem when the trips are constructed from a list of elements and one of the activities only has a maximum duration. If the leg has NaN travel time, the departure time of the trip will become NaN as well, causing problems with routing.

To test:

  • Set up a test case with a maximum duration activity
  • Assert that the departure time of the resulting trips is not NaN

Transit routing sorts departures

The transit routing is sorting the departures right now. However, only the "closest" one to a certain is needed, hence not the whole array needs to be sorted ...

Improve configuration of ModeAvailability

Currently, we have two ModeAvailability implementations: DefaultModeAvailability and CarModeAvailability. I would propose that this is unified into DefaultModeAvailability, which gets two additional flags through the config file:

  • considerLicense
  • considerCarAvailability

Maybe then we could add a more flexible ModeAvailability where the use of modes can be controlled by config groups (and maybe person attributes).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.