MATSIM
Main Page
Related Pages
Packages
Classes
Files
File List
tutorial
programming
example20customTravelTime
RunCustomTravelTimeExample.java
Go to the documentation of this file.
1
/*
2
* *********************************************************************** *
3
* * project: org.matsim.*
4
* * Main.java
5
* * *
6
* * *********************************************************************** *
7
* * *
8
* * copyright : (C) 2014 by the members listed in the COPYING, *
9
* * LICENSE and WARRANTY file. *
10
* * email : info at matsim dot org *
11
* * *
12
* * *********************************************************************** *
13
* * *
14
* * This program is free software; you can redistribute it and/or modify *
15
* * it under the terms of the GNU General Public License as published by *
16
* * the Free Software Foundation; either version 2 of the License, or *
17
* * (at your option) any later version. *
18
* * See also COPYING, LICENSE and WARRANTY file *
19
* * *
20
* * ***********************************************************************
21
*/
22
23
package
tutorial.programming.example20customTravelTime;
24
25
import
org
.
matsim
.
analysis
.
VolumesAnalyzerModule
;
26
import
org
.
matsim
.
core
.
controler
.
AbstractModule
;
27
import
org
.
matsim
.
core
.
controler
.
Controler
;
28
import
org
.
matsim
.
analysis
.
LegHistogramModule
;
29
import
org
.
matsim
.
analysis
.
LinkStatsModule
;
30
import
org
.
matsim
.
core
.
mobsim
.
DefaultMobsimModule
;
31
import
org
.
matsim
.
core
.
replanning
.
StrategyManagerModule
;
32
import
org
.
matsim
.
core
.
router
.
TripRouterModule
;
33
import
org
.
matsim
.
core
.
router
.
costcalculators
.
TravelDisutilityModule
;
34
import
org
.
matsim
.
core
.
router
.
util
.
TravelTime
;
35
import
org
.
matsim
.
core
.
scoring
.
functions
.
CharyparNagelScoringFunctionModule
;
36
import
org
.
matsim
.
core
.
trafficmonitoring
.
FreeSpeedTravelTime
;
37
46
public
class
RunCustomTravelTimeExample
{
47
48
public
static
void
main
(String[] args) {
49
String configFilename =
"examples/equil/config.xml"
;
50
Controler
controler =
new
Controler
(configFilename);
51
controler.
setModules
(
new
AbstractModule
() {
52
@Override
53
public
void
install() {
54
// Include some things from ControlerDefaultsModule.java,
55
// but leave out TravelTimeCalculator.
56
// You can just comment out these lines if you don't want them,
57
// these modules are optional.
58
// For an alternative approach (which uses the defaults and just overrides), see below.
59
install(
new
DefaultMobsimModule
());
60
install(
new
CharyparNagelScoringFunctionModule
());
61
install(
new
TripRouterModule
());
62
install(
new
StrategyManagerModule
());
63
install(
new
LinkStatsModule
());
64
install(
new
VolumesAnalyzerModule
());
65
install(
new
LegHistogramModule
());
66
install(
new
TravelDisutilityModule
());
67
68
// Because TravelTimeCalculatorModule is left out,
69
// we have to provide a TravelTime.
70
// This line says: Use this thing here as the TravelTime implementation.
71
// Try removing this line: You will get an error because there is no
72
// TravelTime and someone needs it.
73
bind(
TravelTime
.class).toInstance(
new
FreeSpeedTravelTime
());
74
}
75
});
76
controler.
run
();
77
}
78
79
// alternative variant:
80
public
static
void
main2
() {
81
String configFilename =
"examples/equil/config.xml"
;
82
Controler
controler =
new
Controler
(configFilename);
83
84
// this uses "addOVERRIDINGModule". It thus uses the Controler defaults, and overrides them or adds to them.
85
controler.
addOverridingModule
(
new
AbstractModule
(){
86
@Override
public
void
install() {
87
this.bind(
TravelTime
.class ).toInstance(
new
FreeSpeedTravelTime
() );
88
}
89
});
90
}
91
}
org.matsim.analysis.VolumesAnalyzerModule
Definition:
VolumesAnalyzerModule.java:28
org.matsim.core.replanning
Definition:
GenericPlanStrategy.java:19
org.matsim.core.mobsim.DefaultMobsimModule
Definition:
DefaultMobsimModule.java:32
org.matsim.core.scoring.functions
Definition:
ActivityTypeOpeningIntervalCalculator.java:1
org.matsim.core.scoring.functions.CharyparNagelScoringFunctionModule
Definition:
CharyparNagelScoringFunctionModule.java:29
tutorial.programming.example20customTravelTime.RunCustomTravelTimeExample
Definition:
RunCustomTravelTimeExample.java:46
org.matsim.core.controler.Controler.addOverridingModule
final void addOverridingModule(AbstractModule abstractModule)
Definition:
Controler.java:410
org.matsim.core.router.costcalculators.TravelDisutilityModule
Definition:
TravelDisutilityModule.java:28
org.matsim.core.replanning.StrategyManagerModule
Definition:
StrategyManagerModule.java:42
org
org.matsim.analysis
Definition:
BinEntry.java:20
org.matsim.core.router.util.TravelTime
Definition:
TravelTime.java:35
org.matsim.core.router.costcalculators
Definition:
FreespeedTravelTimeAndDisutility.java:21
org.matsim.analysis.LinkStatsModule
Definition:
LinkStatsModule.java:33
org.matsim.core.router.util
Definition:
AbstractRoutingNetwork.java:21
tutorial.programming.example20customTravelTime.RunCustomTravelTimeExample.main2
static void main2()
Definition:
RunCustomTravelTimeExample.java:80
org.matsim.core.mobsim
Definition:
DefaultMobsimModule.java:23
org.matsim.core.controler.Controler.setModules
final void setModules(AbstractModule...modules)
Definition:
Controler.java:417
tutorial.programming.example20customTravelTime.RunCustomTravelTimeExample.main
static void main(String[] args)
Definition:
RunCustomTravelTimeExample.java:48
org.matsim.core.controler
Definition:
AbstractController.java:20
org.matsim.core
org.matsim.core.router
Definition:
AbstractFastRouterDelegate.java:21
org.matsim.core.scoring
Definition:
EventsToActivities.java:21
org.matsim.core.controler.Controler.run
final void run()
Definition:
Controler.java:176
org.matsim.core.trafficmonitoring.FreeSpeedTravelTime
Definition:
FreeSpeedTravelTime.java:32
org.matsim.core.router.TripRouterModule
Definition:
TripRouterModule.java:37
org.matsim.core.controler.AbstractModule
Definition:
AbstractModule.java:75
org.matsim.core.trafficmonitoring
Definition:
AbstractTravelTimeAggregator.java:21
org.matsim
org.matsim.analysis.LegHistogramModule
Definition:
LegHistogramModule.java:27
org.matsim.core.controler.Controler
Definition:
Controler.java:64
Generated on Sat Oct 22 2016 11:22:52 for MATSIM by
1.8.8