SUMO - Simulation of Urban MObility
RODFFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2006-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
21 // Sets and checks options for df-routing
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <iostream>
35 #include <fstream>
36 #include <ctime>
38 #include <utils/options/Option.h>
41 #include <utils/common/ToString.h>
43 #include "RODFFrame.h"
45 #include <utils/common/SUMOTime.h>
46 
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
52 void
55  oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
56 
57  // insert options sub-topics
58  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
59  oc.addOptionSubTopic("Input");
60  oc.addOptionSubTopic("Output");
61  oc.addOptionSubTopic("Processing");
62  oc.addOptionSubTopic("Defaults");
63  oc.addOptionSubTopic("Time");
64  SystemFrame::addReportOptions(oc); // fill this subtopic, too
65 
66 
67  // register the options
68  // register input-options
69  oc.doRegister("net-file", 'n', new Option_FileName());
70  oc.addSynonyme("net-file", "net");
71  oc.addDescription("net-file", "Input", "Loads the SUMO-network FILE");
72 
73  /* never used
74  oc.doRegister("route-files", 'r', new Option_FileName());
75  oc.addDescription("route-files", "Input", "Loads SUMO-routes from FILE");
76  */
77 
78  oc.doRegister("detector-files", 'd', new Option_FileName());
79  oc.addSynonyme("detector-files", "detectors");
80  oc.addDescription("detector-files", "Input", "Loads detector descriptions from FILE");
81 
82  oc.doRegister("measure-files", 'f', new Option_FileName());
83  oc.addSynonyme("measure-files", "detflows");
84  oc.addSynonyme("measure-files", "detector-flow-files", true);
85  oc.addDescription("measure-files", "Input", "Loads detector flows from FILE(s)");
86 
87 
88  // register output options
89  oc.doRegister("routes-output", 'o', new Option_FileName());
90  oc.addDescription("routes-output", "Output", "Saves computed routes to FILE");
91 
92  oc.doRegister("routes-for-all", new Option_Bool(false));
93  oc.addDescription("routes-for-all", "Output", "Forces DFROUTER to compute routes for in-between detectors");
94 
95  oc.doRegister("detector-output", new Option_FileName());
96  oc.addSynonyme("detector-output", "detectors-output", true);
97  oc.addDescription("detector-output", "Output", "Saves typed detectors to FILE");
98 
99  oc.doRegister("detectors-poi-output", new Option_FileName());
100  oc.addDescription("detectors-poi-output", "Output", "Saves detector positions as pois to FILE");
101 
102  oc.doRegister("emitters-output", new Option_FileName());
103  oc.addDescription("emitters-output", "Output", "Saves emitter definitions for source detectors to FILE");
104 
105  oc.doRegister("vtype", new Option_Bool(false));
106  oc.addDescription("vtype", "Output", "Add vehicle types to the emitters file (PKW, LKW)");
107 
108  oc.doRegister("vtype-output", new Option_FileName(""));
109  oc.addDescription("vtype-output", "Output", "Write generated vehicle types into separate FILE instead of including them into the emitters-output");
110 
111  oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
112  oc.addDescription("emitters-poi-output", "Output", "Saves emitter positions as pois to FILE");
113 
114  oc.doRegister("variable-speed-sign-output", new Option_FileName());
115  oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
116  oc.addDescription("variable-speed-sign-output", "Output", "Saves variable seed sign definitions for sink detectors to FILE");
117 
118  oc.doRegister("end-reroute-output", new Option_FileName());
119  oc.addDescription("end-reroute-output", "Output", "Saves rerouter definitions for sink detectors to FILE");
120 
121  oc.doRegister("validation-output", new Option_FileName());
122  oc.addDescription("validation-output", "Output", "");
123 
124  oc.doRegister("validation-output.add-sources", new Option_Bool(false));
125  oc.addDescription("validation-output.add-sources", "Output", "");
126 
127 
128  // register processing options
129  // to guess empty flows
130  oc.doRegister("guess-empty-flows", new Option_Bool(false));
131  oc.addDescription("guess-empty-flows", "Processing", "Derive missing flow values from upstream or downstream (not working!)");
132 
133  // for guessing source/sink detectors
134  oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
135  oc.addDescription("highway-mode", "Processing", "Switches to highway-mode");
136 
137  // for detector reading
138  oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
139  oc.addDescription("ignore-invalid-detectors", "Processing", "Only warn about unparseable detectors");
140 
141  // for detector type computation
142  oc.doRegister("revalidate-detectors", new Option_Bool(false));
143  oc.addDescription("revalidate-detectors", "Processing", "Recomputes detector types even if given");
144 
145  // for route computation
146  oc.doRegister("revalidate-routes", new Option_Bool(false));
147  oc.addDescription("revalidate-routes", "Processing", "Recomputes routes even if given");
148 
149  oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
150  oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
151  oc.addDescription("keep-unfinished-routes", "Processing", "Keeps routes even if they have exhausted max-search-depth");
152 
153  oc.doRegister("keep-longer-routes", new Option_Bool(false));
154  oc.addDescription("keep-longer-routes", "Processing", "Keeps routes even if a shorter one exists");
155 
156  oc.doRegister("max-search-depth", new Option_Integer(30));
157  oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
158  oc.addDescription("max-search-depth", "Processing", "Number of edges to follow a route without passing a detector");
159 
160  oc.doRegister("emissions-only", new Option_Bool(false));
161  oc.addDescription("emissions-only", "Processing", "Writes only emission times");
162 
163  oc.doRegister("disallowed-edges", new Option_String(""));
164  oc.addDescription("disallowed-edges", "Processing", "Do not route on these edges");
165 
166  oc.doRegister("keep-turnarounds", new Option_Bool(false));
167  oc.addDescription("keep-turnarounds", "Processing", "Allow turnarounds as route continuations");
168 
169  oc.doRegister("min-route-length", new Option_Float(-1));
170  oc.addSynonyme("min-route-length", "min-dist", true);
171  oc.addSynonyme("min-route-length", "min-distance", true);
172  oc.addDescription("min-route-length", "Processing", "Minimum distance in meters between start and end node of every route");
173 
174  oc.doRegister("randomize-flows", new Option_Bool(false));
175  oc.addDescription("randomize-flows", "Processing", "generate random departure times for emitted vehicles");
176 
177  // flow reading
178  oc.doRegister("time-factor", new Option_String("60", "TIME"));
179  oc.addDescription("time-factor", "Processing", "Multiply flow times with TIME to get seconds");
180 
181  oc.doRegister("time-offset", new Option_String("0", "TIME"));
182  oc.addDescription("time-offset", "Processing", "Subtracts TIME seconds from (scaled) flow times");
183 
184  oc.doRegister("time-step", new Option_String("60", "TIME"));
185  oc.addDescription("time-step", "Processing", "Expected distance between two successive data sets");
186 
187  // saving further structures
188  oc.doRegister("calibrator-output", new Option_Bool(false)); // !!!undescribed
189  oc.addSynonyme("calibrator-output", "write-calibrators", true);
190  oc.addDescription("calibrator-output", "Processing", "Write calibrators to FILE");
191 
192  oc.doRegister("include-unused-routes", new Option_Bool(false)); // !!!undescribed
193  oc.addDescription("include-unused-routes", "Processing", "");
194 
195  //
196  oc.doRegister("revalidate-flows", new Option_Bool(false));
197  oc.addDescription("revalidate-flows", "Processing", "");
198 
199  oc.doRegister("remove-empty-detectors", new Option_Bool(false));
200  oc.addDescription("remove-empty-detectors", "Processing", "Removes empty detectors from the list");
201 
202  oc.doRegister("strict-sources", new Option_Bool(false)); // !!!undescribed
203  oc.addDescription("strict-sources", "Processing", "");
204 
205  oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
206  oc.addDescription("respect-concurrent-inflows", "Processing", "Try to determine further inflows to an inbetween detector when computing split probabilities");
207 
208  /* disabled, see ticket #521
209  oc.doRegister("join-lanes", new Option_Bool(false));
210  oc.addSynonyme("join-lanes", "mesosim", true);
211  oc.addDescription("join-lanes", "Processing", "Joins detectors lying on same height");
212  */
213 
214  //
215  oc.doRegister("scale", new Option_Float(1.));
216  oc.addDescription("scale", "Processing", "Scale factor for flows");
217 
218  // register defaults options
219  oc.doRegister("departlane", new Option_String());
220  oc.addDescription("departlane", "Defaults", "Assigns a default depart lane");
221 
222  oc.doRegister("departpos", new Option_String());
223  oc.addDescription("departpos", "Defaults", "Assigns a default depart position");
224 
225  oc.doRegister("departspeed", new Option_String());
226  oc.addDescription("departspeed", "Defaults", "Assigns a default depart speed");
227 
228  oc.doRegister("arrivallane", new Option_String());
229  oc.addDescription("arrivallane", "Defaults", "Assigns a default arrival lane");
230 
231  oc.doRegister("arrivalpos", new Option_String());
232  oc.addDescription("arrivalpos", "Defaults", "Assigns a default arrival position");
233 
234  oc.doRegister("arrivalspeed", new Option_String());
235  oc.addDescription("arrivalspeed", "Defaults", "Assigns a default arrival speed");
236 
237  oc.doRegister("speeddev", new Option_Float(0.1));
238  oc.addDescription("speeddev", "Defaults", "The default speed deviation of vehicles");
239 
240  // register the simulation settings
241  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
242  oc.addDescription("begin", "Time", "Defines the begin time; Previous defs will be discarded");
243 
244  oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
245  oc.addDescription("end", "Time", "Defines the end time; Later defs will be discarded; Defaults to one day");
246 
247 
248  // register report options
249  oc.doRegister("report-empty-detectors", new Option_Bool(false));
250  oc.addDescription("report-empty-detectors", "Report", "Lists detectors with no flow (enable -v)");
251 
252  oc.doRegister("print-absolute-flows", new Option_Bool(false));
253  oc.addDescription("print-absolute-flows", "Report", "Prints aggregated detector flows");
254 
255  // register report options
256  oc.doRegister("no-step-log", new Option_Bool(false));
257  oc.addDescription("no-step-log", "Report", "Disable console output of route parsing step");
258 
260 }
261 
262 
263 bool
265  return true;
266 }
267 
268 
269 
270 /****************************************************************************/
271 
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:81
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:47
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:71
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:46
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
An integer-option.
Definition: Option.h:312
A storage for options typed value containers)
Definition: OptionsCont.h:98
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter...
Definition: RODFFrame.cpp:264
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
Definition: RODFFrame.cpp:53