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