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