Eclipse 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-2020 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 /****************************************************************************/
22 // Sets and checks options for df-routing
23 /****************************************************************************/
24 #include <config.h>
25 
26 #include <iostream>
27 #include <fstream>
28 #include <ctime>
30 #include <utils/options/Option.h>
33 #include <utils/common/ToString.h>
35 #include "RODFFrame.h"
37 #include <utils/common/SUMOTime.h>
38 
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 void
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", "Loads the SUMO-network FILE");
62 
63  /* never used
64  oc.doRegister("route-files", 'r', new Option_FileName());
65  oc.addDescription("route-files", "Input", "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", "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", "Loads detector flows from FILE(s)");
76 
77  // need to do this here to be able to check for network and route input options
79 
80  // register output options
81  oc.doRegister("routes-output", 'o', new Option_FileName());
82  oc.addDescription("routes-output", "Output", "Saves computed routes to FILE");
83 
84  oc.doRegister("routes-for-all", new Option_Bool(false));
85  oc.addDescription("routes-for-all", "Output", "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", "Saves typed detectors to FILE");
90 
91  oc.doRegister("detectors-poi-output", new Option_FileName());
92  oc.addDescription("detectors-poi-output", "Output", "Saves detector positions as pois to FILE");
93 
94  oc.doRegister("emitters-output", new Option_FileName());
95  oc.addDescription("emitters-output", "Output", "Saves emitter definitions for source detectors to FILE");
96 
97  oc.doRegister("vtype", new Option_Bool(false));
98  oc.addDescription("vtype", "Output", "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", "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", "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", "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", "Saves rerouter definitions for sink detectors to FILE");
112 
113  oc.doRegister("validation-output", new Option_FileName());
114  oc.addDescription("validation-output", "Output", "");
115 
116  oc.doRegister("validation-output.add-sources", new Option_Bool(false));
117  oc.addDescription("validation-output.add-sources", "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", "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", "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", "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", "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", "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", "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", "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", "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", "Writes only emission times");
154 
155  oc.doRegister("disallowed-edges", new Option_StringVector(StringVector({ "" })));
156  oc.addDescription("disallowed-edges", "Processing", "Do not route on these edges");
157 
158  oc.doRegister("keep-turnarounds", new Option_Bool(false));
159  oc.addDescription("keep-turnarounds", "Processing", "Allow turnarounds as route continuations");
160 
161  oc.doRegister("min-route-length", new Option_Float(-1));
162  oc.addSynonyme("min-route-length", "min-dist", true);
163  oc.addSynonyme("min-route-length", "min-distance", true);
164  oc.addDescription("min-route-length", "Processing", "Minimum distance in meters between start and end node of every route");
165 
166  oc.doRegister("randomize-flows", new Option_Bool(false));
167  oc.addDescription("randomize-flows", "Processing", "generate random departure times for emitted vehicles");
168 
169  // flow reading
170  oc.doRegister("time-factor", new Option_String("60", "TIME"));
171  oc.addDescription("time-factor", "Processing", "Multiply flow times with TIME to get seconds");
172 
173  oc.doRegister("time-offset", new Option_String("0", "TIME"));
174  oc.addDescription("time-offset", "Processing", "Subtracts TIME seconds from (scaled) flow times");
175 
176  oc.doRegister("time-step", new Option_String("60", "TIME"));
177  oc.addDescription("time-step", "Processing", "Expected distance between two successive data sets");
178 
179  // saving further structures
180  oc.doRegister("calibrator-output", new Option_Bool(false)); // !!!undescribed
181  oc.addSynonyme("calibrator-output", "write-calibrators", true);
182  oc.addDescription("calibrator-output", "Processing", "Write calibrators to FILE");
183 
184  oc.doRegister("include-unused-routes", new Option_Bool(false)); // !!!undescribed
185  oc.addDescription("include-unused-routes", "Processing", "");
186 
187  //
188  oc.doRegister("revalidate-flows", new Option_Bool(false));
189  oc.addDescription("revalidate-flows", "Processing", "");
190 
191  oc.doRegister("remove-empty-detectors", new Option_Bool(false));
192  oc.addDescription("remove-empty-detectors", "Processing", "Removes empty detectors from the list");
193 
194  oc.doRegister("strict-sources", new Option_Bool(false)); // !!!undescribed
195  oc.addDescription("strict-sources", "Processing", "");
196 
197  oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
198  oc.addDescription("respect-concurrent-inflows", "Processing", "Try to determine further inflows to an inbetween detector when computing split probabilities");
199 
200  //
201  oc.doRegister("scale", new Option_Float(1.));
202  oc.addDescription("scale", "Processing", "Scale factor for flows");
203 
204  // register defaults options
205  oc.doRegister("departlane", new Option_String());
206  oc.addDescription("departlane", "Defaults", "Assigns a default depart lane");
207 
208  oc.doRegister("departpos", new Option_String());
209  oc.addDescription("departpos", "Defaults", "Assigns a default depart position");
210 
211  oc.doRegister("departspeed", new Option_String());
212  oc.addDescription("departspeed", "Defaults", "Assigns a default depart speed");
213 
214  oc.doRegister("arrivallane", new Option_String());
215  oc.addDescription("arrivallane", "Defaults", "Assigns a default arrival lane");
216 
217  oc.doRegister("arrivalpos", new Option_String());
218  oc.addDescription("arrivalpos", "Defaults", "Assigns a default arrival position");
219 
220  oc.doRegister("arrivalspeed", new Option_String());
221  oc.addDescription("arrivalspeed", "Defaults", "Assigns a default arrival speed");
222 
223  oc.doRegister("speeddev", new Option_Float(0.1));
224  oc.addDescription("speeddev", "Defaults", "The default speed deviation of vehicles");
225 
226  // register the simulation settings
227  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
228  oc.addDescription("begin", "Time", "Defines the begin time; Previous defs will be discarded");
229 
230  oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
231  oc.addDescription("end", "Time", "Defines the end time; Later defs will be discarded; Defaults to one day");
232 
233 
234  // register report options
235  oc.doRegister("report-empty-detectors", new Option_Bool(false));
236  oc.addDescription("report-empty-detectors", "Report", "Lists detectors with no flow (enable -v)");
237 
238  oc.doRegister("print-absolute-flows", new Option_Bool(false));
239  oc.addDescription("print-absolute-flows", "Report", "Prints aggregated detector flows");
240 
241  // register report options
242  oc.doRegister("no-step-log", new Option_Bool(false));
243  oc.addDescription("no-step-log", "Report", "Disable console output of route parsing step");
244 
246 }
247 
248 
249 bool
251  return true;
252 }
253 
254 
255 /****************************************************************************/
std::vector< std::string > StringVector
Definition of a vector of strings.
Definition: Option.h:43
An integer-option.
Definition: Option.h:329
A storage for options typed value containers)
Definition: OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:75
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
Definition: OptionsCont.cpp:96
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter.
Definition: RODFFrame.cpp:250
static void fillOptions()
Inserts options used by dfrouter into the OptionsCont-singleton.
Definition: RODFFrame.cpp:45
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:44
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:38
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:63