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