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