SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ROFrame.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Sets and checks options for routing
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <iostream>
34
#include <ctime>
35
#include <stdlib.h>
36
#include <
utils/options/OptionsCont.h
>
37
#include <
utils/options/Option.h
>
38
#include <
utils/common/MsgHandler.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
#include <
utils/common/RandHelper.h
>
41
#include <
utils/common/ToString.h
>
42
#include <
utils/common/SUMOTime.h
>
43
#include "
ROFrame.h
"
44
45
#ifdef CHECK_MEMORY_LEAKS
46
#include <
foreign/nvwa/debug_new.h
>
47
#endif // CHECK_MEMORY_LEAKS
48
49
50
// ===========================================================================
51
// method definitions
52
// ===========================================================================
53
void
54
ROFrame::fillOptions
(
OptionsCont
& oc,
bool
forDuarouter) {
55
// register options
56
// register I/O options
57
oc.
doRegister
(
"output-file"
,
'o'
,
new
Option_FileName
());
58
oc.
addSynonyme
(
"output-file"
,
"output"
);
59
oc.
addDescription
(
"output-file"
,
"Output"
,
"Write generated routes to FILE"
);
60
61
oc.
doRegister
(
"vtype-output"
,
new
Option_FileName
(
""
));
62
oc.
addSynonyme
(
"vtype-output"
,
"vtype"
);
63
oc.
addDescription
(
"vtype-output"
,
"Output"
,
"Write used vehicle types into separate FILE"
);
64
65
oc.
doRegister
(
"net-file"
,
'n'
,
new
Option_FileName
());
66
oc.
addSynonyme
(
"net-file"
,
"net"
);
67
oc.
addDescription
(
"net-file"
,
"Input"
,
"Use FILE as SUMO-network to route on"
);
68
69
oc.
doRegister
(
"additional-files"
,
'd'
,
new
Option_FileName
());
70
oc.
addSynonyme
(
"additional-files"
,
"additional"
);
71
oc.
addSynonyme
(
"additional-files"
,
"taz-files"
);
72
oc.
addSynonyme
(
"additional-files"
,
"districts"
,
true
);
73
oc.
addDescription
(
"additional-files"
,
"Input"
,
"Read additional network data (districts, bus stops) from FILE"
);
74
75
oc.
doRegister
(
"alternative-files"
,
'a'
,
new
Option_FileName
());
76
oc.
addSynonyme
(
"alternative-files"
,
"alternatives-files"
);
77
oc.
addSynonyme
(
"alternative-files"
,
"alternatives"
,
true
);
78
oc.
addDescription
(
"alternative-files"
,
"Input"
,
"Read alternatives from FILE"
);
79
80
oc.
doRegister
(
"flow-files"
,
'f'
,
new
Option_FileName
());
81
oc.
addSynonyme
(
"flow-files"
,
"flows"
);
82
oc.
addSynonyme
(
"flow-files"
,
"flow-definition"
,
true
);
83
oc.
addDescription
(
"flow-files"
,
"Input"
,
"Read flow-definitions from FILE(s)"
);
84
85
if
(forDuarouter) {
86
oc.
doRegister
(
"weight-files"
,
'w'
,
new
Option_FileName
());
87
oc.
addSynonyme
(
"weight-files"
,
"weights"
);
88
oc.
addDescription
(
"weight-files"
,
"Input"
,
"Read network weights from FILE(s)"
);
89
90
oc.
doRegister
(
"lane-weight-files"
,
new
Option_FileName
());
91
oc.
addDescription
(
"lane-weight-files"
,
"Input"
,
"Read lane-based network weights from FILE(s)"
);
92
93
oc.
doRegister
(
"weight-attribute"
,
'x'
,
new
Option_String
(
"traveltime"
));
94
oc.
addSynonyme
(
"weight-attribute"
,
"measure"
,
true
);
95
oc.
addDescription
(
"weight-attribute"
,
"Input"
,
"Name of the xml attribute which gives the edge weight"
);
96
97
std::string plp = getenv(
"PHEMLIGHT_PATH"
) == 0 ?
"./PHEMlight/"
: std::string(getenv(
"PHEMLIGHT_PATH"
));
98
oc.
doRegister
(
"phemlight-path"
,
new
Option_FileName
(plp));
99
oc.
addDescription
(
"phemlight-path"
,
"Input"
,
"Determines where to load PHEMlight definitions from."
);
100
}
101
102
// register the time settings
103
oc.
doRegister
(
"begin"
,
'b'
,
new
Option_String
(
"0"
,
"TIME"
));
104
oc.
addDescription
(
"begin"
,
"Time"
,
"Defines the begin time; Previous trips will be discarded"
);
105
106
oc.
doRegister
(
"end"
,
'e'
,
new
Option_String
(
SUMOTIME_MAXSTRING
,
"TIME"
));
107
oc.
addDescription
(
"end"
,
"Time"
,
"Defines the end time; Later trips will be discarded; Defaults to the maximum time that SUMO can represent"
);
108
109
// register the processing options
110
oc.
doRegister
(
"ignore-errors"
,
new
Option_Bool
(
false
));
111
oc.
addSynonyme
(
"ignore-errors"
,
"continue-on-unbuild"
,
true
);
112
oc.
addDescription
(
"ignore-errors"
,
"Processing"
,
"Continue if a route could not be build"
);
113
114
oc.
doRegister
(
"unsorted-input"
,
new
Option_Bool
(
false
));
115
oc.
addSynonyme
(
"unsorted-input"
,
"unsorted"
);
116
oc.
addDescription
(
"unsorted-input"
,
"Processing"
,
"Assume input is unsorted"
);
117
118
oc.
doRegister
(
"randomize-flows"
,
new
Option_Bool
(
false
));
119
oc.
addDescription
(
"randomize-flows"
,
"Processing"
,
"generate random departure times for flow input"
);
120
121
oc.
doRegister
(
"max-alternatives"
,
new
Option_Integer
(5));
122
oc.
addDescription
(
"max-alternatives"
,
"Processing"
,
"Prune the number of alternatives to INT"
);
123
124
oc.
doRegister
(
"remove-loops"
,
new
Option_Bool
(
false
));
125
oc.
addDescription
(
"remove-loops"
,
"Processing"
,
"Remove loops within the route; Remove turnarounds at start and end of the route"
);
126
127
oc.
doRegister
(
"repair"
,
new
Option_Bool
(
false
));
128
oc.
addDescription
(
"repair"
,
"Processing"
,
"Tries to correct a false route"
);
129
130
oc.
doRegister
(
"weights.interpolate"
,
new
Option_Bool
(
false
));
131
oc.
addSynonyme
(
"weights.interpolate"
,
"interpolate"
,
true
);
132
oc.
addDescription
(
"weights.interpolate"
,
"Processing"
,
"Interpolate edge weights at interval boundaries"
);
133
134
oc.
doRegister
(
"with-taz"
,
new
Option_Bool
(
false
));
135
oc.
addDescription
(
"with-taz"
,
"Processing"
,
"Use origin and destination zones (districts) for in- and output"
);
136
137
if
(forDuarouter) {
138
oc.
doRegister
(
"routing-algorithm"
,
new
Option_String
(
"dijkstra"
));
139
oc.
addDescription
(
"routing-algorithm"
,
"Processing"
,
140
#ifndef HAVE_INTERNAL
// catchall for internal stuff
141
"Select among routing algorithms ['dijkstra', 'astar']"
142
#
else
143
"Select among routing algorithms ['dijkstra', 'astar', 'bulkstar', 'CH', 'CHWrapper']"
144
#endif
145
);
146
147
#ifdef HAVE_INTERNAL // catchall for internal stuff
148
oc.
doRegister
(
"weight-period"
,
new
Option_String
(
"3600"
,
"TIME"
));
149
oc.
addDescription
(
"weight-period"
,
"Processing"
,
"Aggregation period for the given weight files; triggers rebuilding of Contraction Hierarchy"
);
150
#endif
151
}
152
153
// register defaults options
154
oc.
doRegister
(
"departlane"
,
new
Option_String
());
155
oc.
addDescription
(
"departlane"
,
"Defaults"
,
"Assigns a default depart lane"
);
156
157
oc.
doRegister
(
"departpos"
,
new
Option_String
());
158
oc.
addDescription
(
"departpos"
,
"Defaults"
,
"Assigns a default depart position"
);
159
160
oc.
doRegister
(
"departspeed"
,
new
Option_String
());
161
oc.
addDescription
(
"departspeed"
,
"Defaults"
,
"Assigns a default depart speed"
);
162
163
oc.
doRegister
(
"arrivallane"
,
new
Option_String
());
164
oc.
addDescription
(
"arrivallane"
,
"Defaults"
,
"Assigns a default arrival lane"
);
165
166
oc.
doRegister
(
"arrivalpos"
,
new
Option_String
());
167
oc.
addDescription
(
"arrivalpos"
,
"Defaults"
,
"Assigns a default arrival position"
);
168
169
oc.
doRegister
(
"arrivalspeed"
,
new
Option_String
());
170
oc.
addDescription
(
"arrivalspeed"
,
"Defaults"
,
"Assigns a default arrival speed"
);
171
172
oc.
doRegister
(
"defaults-override"
,
new
Option_Bool
(
false
));
173
oc.
addDescription
(
"defaults-override"
,
"Defaults"
,
"Defaults will override given values"
);
174
175
176
// register report options
177
oc.
doRegister
(
"stats-period"
,
new
Option_Integer
(-1));
178
oc.
addDescription
(
"stats-period"
,
"Report"
,
"Defines how often statistics shall be printed"
);
179
180
oc.
doRegister
(
"no-step-log"
,
new
Option_Bool
(
false
));
181
oc.
addDescription
(
"no-step-log"
,
"Report"
,
"Disable console output of route parsing step"
);
182
}
183
184
185
bool
186
ROFrame::checkOptions
(
OptionsCont
& oc) {
187
// check whether the output is valid and can be build
188
if
(!oc.
isSet
(
"output-file"
)) {
189
WRITE_ERROR
(
"No output specified."
);
190
return
false
;
191
}
192
//
193
if
(oc.
getInt
(
"max-alternatives"
) < 2) {
194
WRITE_ERROR
(
"At least two alternatives should be enabled"
);
195
return
false
;
196
}
197
return
true
;
198
}
199
200
201
202
/****************************************************************************/
203
tmp
buildd
sumo-0.21.0+dfsg
src
router
ROFrame.cpp
Generated on Thu Nov 20 2014 19:49:58 for SUMO - Simulation of Urban MObility by
1.8.1.2