Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/dfrouter/RODFFrame.cpp
169665 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2006-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file RODFFrame.cpp
15
/// @author Daniel Krajzewicz
16
/// @author Eric Nicolay
17
/// @author Jakob Erdmann
18
/// @author Michael Behrisch
19
/// @author Melanie Knocke
20
/// @date Thu, 16.03.2006
21
///
22
// Sets and checks options for df-routing
23
/****************************************************************************/
24
#include <config.h>
25
26
#include <iostream>
27
#include <fstream>
28
#include <ctime>
29
#include <utils/options/OptionsCont.h>
30
#include <utils/options/Option.h>
31
#include <utils/common/MsgHandler.h>
32
#include <utils/common/UtilExceptions.h>
33
#include <utils/common/ToString.h>
34
#include <utils/common/SystemFrame.h>
35
#include "RODFFrame.h"
36
#include <utils/common/RandHelper.h>
37
#include <utils/common/SUMOTime.h>
38
39
40
41
// ===========================================================================
42
// method definitions
43
// ===========================================================================
44
void
45
RODFFrame::fillOptions() {
46
OptionsCont& oc = OptionsCont::getOptions();
47
oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
48
49
// insert options sub-topics
50
SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
51
oc.addOptionSubTopic("Input");
52
oc.addOptionSubTopic("Output");
53
oc.addOptionSubTopic("Processing");
54
oc.addOptionSubTopic("Defaults");
55
oc.addOptionSubTopic("Time");
56
57
// register the options
58
// register input-options
59
oc.doRegister("net-file", 'n', new Option_FileName());
60
oc.addSynonyme("net-file", "net");
61
oc.addDescription("net-file", "Input", TL("Loads the SUMO-network FILE"));
62
63
/* never used
64
oc.doRegister("route-files", 'r', new Option_FileName());
65
oc.addDescription("route-files", "Input", TL("Loads SUMO-routes from FILE"));
66
*/
67
68
oc.doRegister("detector-files", 'd', new Option_FileName());
69
oc.addSynonyme("detector-files", "detectors");
70
oc.addDescription("detector-files", "Input", TL("Loads detector descriptions from FILE"));
71
72
oc.doRegister("measure-files", 'f', new Option_FileName());
73
oc.addSynonyme("measure-files", "detflows");
74
oc.addSynonyme("measure-files", "detector-flow-files", true);
75
oc.addDescription("measure-files", "Input", TL("Loads detector flows from FILE(s)"));
76
77
// need to do this here to be able to check for network and route input options
78
SystemFrame::addReportOptions(oc);
79
80
// register output options
81
oc.doRegister("routes-output", 'o', new Option_FileName());
82
oc.addDescription("routes-output", "Output", TL("Saves computed routes to FILE"));
83
84
oc.doRegister("routes-for-all", new Option_Bool(false));
85
oc.addDescription("routes-for-all", "Output", TL("Forces dfrouter to compute routes for in-between detectors"));
86
87
oc.doRegister("detector-output", new Option_FileName());
88
oc.addSynonyme("detector-output", "detectors-output", true);
89
oc.addDescription("detector-output", "Output", TL("Saves typed detectors to FILE"));
90
91
oc.doRegister("detectors-poi-output", new Option_FileName());
92
oc.addDescription("detectors-poi-output", "Output", TL("Saves detector positions as pois to FILE"));
93
94
oc.doRegister("emitters-output", new Option_FileName());
95
oc.addDescription("emitters-output", "Output", TL("Saves emitter definitions for source detectors to FILE"));
96
97
oc.doRegister("vtype", new Option_Bool(false));
98
oc.addDescription("vtype", "Output", TL("Add vehicle types to the emitters file (PKW, LKW)"));
99
100
oc.doRegister("vtype-output", new Option_FileName(StringVector({ "" })));
101
oc.addDescription("vtype-output", "Output", TL("Write generated vehicle types into separate FILE instead of including them into the emitters-output"));
102
103
oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
104
oc.addDescription("emitters-poi-output", "Output", TL("Saves emitter positions as pois to FILE"));
105
106
oc.doRegister("variable-speed-sign-output", new Option_FileName());
107
oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
108
oc.addDescription("variable-speed-sign-output", "Output", TL("Saves variable seed sign definitions for sink detectors to FILE"));
109
110
oc.doRegister("end-reroute-output", new Option_FileName());
111
oc.addDescription("end-reroute-output", "Output", TL("Saves rerouter definitions for sink detectors to FILE"));
112
113
oc.doRegister("validation-output", new Option_FileName());
114
oc.addDescription("validation-output", "Output", TL("Write induction loop definitions for the given detector positions to FILE"));
115
116
oc.doRegister("validation-output.add-sources", new Option_Bool(false));
117
oc.addDescription("validation-output.add-sources", "Output", TL("Add source detectors to the validation output"));
118
119
120
// register processing options
121
// to guess empty flows
122
oc.doRegister("guess-empty-flows", new Option_Bool(false));
123
oc.addDescription("guess-empty-flows", "Processing", TL("Derive missing flow values from upstream or downstream (not working!)"));
124
125
// for guessing source/sink detectors
126
oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
127
oc.addDescription("highway-mode", "Processing", TL("Switches to highway-mode"));
128
129
// for detector reading
130
oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
131
oc.addDescription("ignore-invalid-detectors", "Processing", TL("Only warn about unparseable detectors"));
132
133
// for detector type computation
134
oc.doRegister("revalidate-detectors", new Option_Bool(false));
135
oc.addDescription("revalidate-detectors", "Processing", TL("Recomputes detector types even if given"));
136
137
// for route computation
138
oc.doRegister("revalidate-routes", new Option_Bool(false));
139
oc.addDescription("revalidate-routes", "Processing", TL("Recomputes routes even if given"));
140
141
oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
142
oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
143
oc.addDescription("keep-unfinished-routes", "Processing", TL("Keeps routes even if they have exhausted max-search-depth"));
144
145
oc.doRegister("keep-longer-routes", new Option_Bool(false));
146
oc.addDescription("keep-longer-routes", "Processing", TL("Keeps routes even if a shorter one exists"));
147
148
oc.doRegister("max-search-depth", new Option_Integer(30));
149
oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
150
oc.addDescription("max-search-depth", "Processing", TL("Number of edges to follow a route without passing a detector"));
151
152
oc.doRegister("emissions-only", new Option_Bool(false));
153
oc.addDescription("emissions-only", "Processing", TL("Writes only emission times"));
154
155
oc.doRegister("disallowed-edges", new Option_StringVector(StringVector({ "" })));
156
oc.addDescription("disallowed-edges", "Processing", TL("Do not route on these edges"));
157
158
oc.doRegister("vclass", new Option_String("ignoring"));
159
oc.addDescription("vclass", "Processing", TL("Only route on edges allowing the given vclass"));
160
161
oc.doRegister("keep-turnarounds", new Option_Bool(false));
162
oc.addDescription("keep-turnarounds", "Processing", TL("Allow turnarounds as route continuations"));
163
164
oc.doRegister("min-route-length", new Option_Float(-1));
165
oc.addSynonyme("min-route-length", "min-dist", true);
166
oc.addSynonyme("min-route-length", "min-distance", true);
167
oc.addDescription("min-route-length", "Processing", TL("Minimum distance in meters between start and end node of every route"));
168
169
oc.doRegister("randomize-flows", new Option_Bool(false));
170
oc.addDescription("randomize-flows", "Processing", TL("generate random departure times for emitted vehicles"));
171
172
// flow reading
173
oc.doRegister("time-factor", new Option_String("60", "TIME"));
174
oc.addDescription("time-factor", "Processing", TL("Multiply flow times with TIME to get seconds"));
175
176
oc.doRegister("time-offset", new Option_String("0", "TIME"));
177
oc.addDescription("time-offset", "Processing", TL("Subtracts TIME seconds from (scaled) flow times"));
178
179
oc.doRegister("time-step", new Option_String("60", "TIME"));
180
oc.addDescription("time-step", "Processing", TL("Expected distance between two successive data sets"));
181
182
// saving further structures
183
oc.doRegister("calibrator-output", new Option_Bool(false));
184
oc.addSynonyme("calibrator-output", "write-calibrators", true);
185
oc.addDescription("calibrator-output", "Processing", TL("Write calibrators to FILE"));
186
187
oc.doRegister("include-unused-routes", new Option_Bool(false));
188
oc.addDescription("include-unused-routes", "Processing", TL("Include routes in the output which have no vehicles"));
189
190
//
191
oc.doRegister("revalidate-flows", new Option_Bool(false));
192
oc.addDescription("revalidate-flows", "Processing", TL("Checks whether detectors with calculated flow 0 can attract additional traffic"));
193
194
oc.doRegister("remove-empty-detectors", new Option_Bool(false));
195
oc.addDescription("remove-empty-detectors", "Processing", TL("Removes empty detectors from the list"));
196
197
oc.doRegister("strict-sources", new Option_Bool(false));
198
oc.addDescription("strict-sources", "Processing", TL("Whether edges with unknown status can prevent an edge from becoming a source"));
199
200
oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
201
oc.addDescription("respect-concurrent-inflows", "Processing", TL("Try to determine further inflows to an inbetween detector when computing split probabilities"));
202
203
//
204
oc.doRegister("scale", new Option_Float(1.));
205
oc.addDescription("scale", "Processing", TL("Scale factor for flows"));
206
207
// register defaults options
208
oc.doRegister("departlane", new Option_String());
209
oc.addDescription("departlane", "Defaults", TL("Assigns a default depart lane"));
210
211
oc.doRegister("departpos", new Option_String());
212
oc.addDescription("departpos", "Defaults", TL("Assigns a default depart position"));
213
214
oc.doRegister("departspeed", new Option_String());
215
oc.addDescription("departspeed", "Defaults", TL("Assigns a default depart speed"));
216
217
oc.doRegister("arrivallane", new Option_String());
218
oc.addDescription("arrivallane", "Defaults", TL("Assigns a default arrival lane"));
219
220
oc.doRegister("arrivalpos", new Option_String());
221
oc.addDescription("arrivalpos", "Defaults", TL("Assigns a default arrival position"));
222
223
oc.doRegister("arrivalspeed", new Option_String());
224
oc.addDescription("arrivalspeed", "Defaults", TL("Assigns a default arrival speed"));
225
226
oc.doRegister("speeddev", new Option_Float(0.1));
227
oc.addDescription("speeddev", "Defaults", TL("The default speed deviation of vehicles"));
228
229
// register the simulation settings
230
oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
231
oc.addDescription("begin", "Time", TL("Defines the begin time; Previous defs will be discarded"));
232
233
oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
234
oc.addDescription("end", "Time", TL("Defines the end time; Later defs will be discarded; Defaults to one day"));
235
236
237
// register report options
238
oc.doRegister("report-empty-detectors", new Option_Bool(false));
239
oc.addDescription("report-empty-detectors", "Report", TL("Lists detectors with no flow (enable -v)"));
240
241
oc.doRegister("print-absolute-flows", new Option_Bool(false));
242
oc.addDescription("print-absolute-flows", "Report", TL("Prints aggregated detector flows"));
243
244
// register report options
245
oc.doRegister("no-step-log", new Option_Bool(false));
246
oc.addDescription("no-step-log", "Report", TL("Disable console output of route parsing step"));
247
248
RandHelper::insertRandOptions(oc);
249
}
250
251
252
bool
253
RODFFrame::checkOptions() {
254
return true;
255
}
256
257
258
/****************************************************************************/
259
260