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-2015 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("emitters-poi-output", new Option_FileName()); // !!! describe
114  oc.addDescription("emitters-poi-output", "Output", "Saves emitter positions as pois to FILE");
115 
116  oc.doRegister("variable-speed-sign-output", new Option_FileName());
117  oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
118  oc.addDescription("variable-speed-sign-output", "Output", "Saves variable seed sign definitions for sink detectors to FILE");
119 
120  oc.doRegister("end-reroute-output", new Option_FileName());
121  oc.addDescription("end-reroute-output", "Output", "Saves rerouter definitions for sink detectors to FILE");
122 
123  oc.doRegister("validation-output", new Option_FileName());
124  oc.addDescription("validation-output", "Output", "");
125 
126  oc.doRegister("validation-output.add-sources", new Option_Bool(false));
127  oc.addDescription("validation-output.add-sources", "Output", "");
128 
129 
130  // register processing options
131  // to guess empty flows
132  oc.doRegister("guess-empty-flows", new Option_Bool(false));
133  oc.addDescription("guess-empty-flows", "Processing", "Derive missing flow values from upstream or downstream (not working!)");
134 
135  // for guessing source/sink detectors
136  oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
137  oc.addDescription("highway-mode", "Processing", "Switches to highway-mode");
138 
139  // for detector reading
140  oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
141  oc.addDescription("ignore-invalid-detectors", "Processing", "Only warn about unparseable detectors");
142 
143  // for detector type computation
144  oc.doRegister("revalidate-detectors", new Option_Bool(false));
145  oc.addDescription("revalidate-detectors", "Processing", "Recomputes detector types even if given");
146 
147  // for route computation
148  oc.doRegister("revalidate-routes", new Option_Bool(false));
149  oc.addDescription("revalidate-routes", "Processing", "Recomputes routes even if given");
150 
151  oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
152  oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
153  oc.addDescription("keep-unfinished-routes", "Processing", "Keeps routes even if they have exhausted max-search-depth");
154 
155  oc.doRegister("keep-longer-routes", new Option_Bool(false));
156  oc.addDescription("keep-longer-routes", "Processing", "Keeps routes even if a shorter one exists");
157 
158  oc.doRegister("max-search-depth", new Option_Integer(30));
159  oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
160  oc.addDescription("max-search-depth", "Processing", "Number of edges to follow a route without passing a detector");
161 
162  oc.doRegister("emissions-only", new Option_Bool(false));
163  oc.addDescription("emissions-only", "Processing", "Writes only emission times");
164 
165  oc.doRegister("disallowed-edges", new Option_String(""));
166  oc.addDescription("disallowed-edges", "Processing", "Do not route on these edges");
167 
168  oc.doRegister("keep-turnarounds", new Option_Bool(false));
169  oc.addDescription("keep-turnarounds", "Processing", "Allow turnarounds as route continuations");
170 
171  oc.doRegister("min-route-length", new Option_Float(-1));
172  oc.addSynonyme("min-route-length", "min-dist", true);
173  oc.addSynonyme("min-route-length", "min-distance", true);
174  oc.addDescription("min-route-length", "Processing", "Minimum distance in meters between start and end node of every route");
175 
176  // flow reading
177  oc.doRegister("time-factor", new Option_String("60", "TIME"));
178  oc.addDescription("time-factor", "Processing", "Multiply flow times with TIME to get seconds");
179 
180  oc.doRegister("time-offset", new Option_String("0", "TIME"));
181  oc.addDescription("time-offset", "Processing", "Subtracts TIME seconds from (scaled) flow times");
182 
183  oc.doRegister("time-step", new Option_String("60", "TIME"));
184  oc.addDescription("time-step", "Processing", "Expected distance between two successive data sets");
185 
186  // saving further structures
187  oc.doRegister("calibrator-output", new Option_Bool(false)); // !!!undescribed
188  oc.addSynonyme("calibrator-output", "write-calibrators", true);
189  oc.addDescription("calibrator-output", "Processing", "Write calibrators to FILE");
190 
191  oc.doRegister("include-unused-routes", new Option_Bool(false)); // !!!undescribed
192  oc.addDescription("include-unused-routes", "Processing", "");
193 
194  //
195  oc.doRegister("revalidate-flows", new Option_Bool(false));
196  oc.addDescription("revalidate-flows", "Processing", "");
197 
198  oc.doRegister("remove-empty-detectors", new Option_Bool(false));
199  oc.addDescription("remove-empty-detectors", "Processing", "Removes empty detectors from the list");
200 
201  oc.doRegister("strict-sources", new Option_Bool(false)); // !!!undescribed
202  oc.addDescription("strict-sources", "Processing", "");
203 
204  oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
205  oc.addDescription("respect-concurrent-inflows", "Processing", "Try to determine further inflows to an inbetween detector when computing split probabilities");
206 
207  /* disabled, see ticket #521
208  oc.doRegister("join-lanes", new Option_Bool(false));
209  oc.addSynonyme("join-lanes", "mesosim", true);
210  oc.addDescription("join-lanes", "Processing", "Joins detectors lying on same height");
211  */
212 
213  //
214  oc.doRegister("scale", new Option_Float(1.));
215  oc.addDescription("scale", "Processing", "Scale factor for flows");
216 
217  // register defaults options
218  oc.doRegister("departlane", new Option_String());
219  oc.addDescription("departlane", "Defaults", "Assigns a default depart lane");
220 
221  oc.doRegister("departpos", new Option_String());
222  oc.addDescription("departpos", "Defaults", "Assigns a default depart position");
223 
224  oc.doRegister("departspeed", new Option_String());
225  oc.addDescription("departspeed", "Defaults", "Assigns a default depart speed");
226 
227  oc.doRegister("arrivallane", new Option_String());
228  oc.addDescription("arrivallane", "Defaults", "Assigns a default arrival lane");
229 
230  oc.doRegister("arrivalpos", new Option_String());
231  oc.addDescription("arrivalpos", "Defaults", "Assigns a default arrival position");
232 
233  oc.doRegister("arrivalspeed", new Option_String());
234  oc.addDescription("arrivalspeed", "Defaults", "Assigns a default arrival speed");
235 
236 
237  // register the simulation settings
238  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
239  oc.addDescription("begin", "Time", "Defines the begin time; Previous defs will be discarded");
240 
241  oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
242  oc.addDescription("end", "Time", "Defines the end time; Later defs will be discarded; Defaults to one day");
243 
244 
245  // register report options
246  oc.doRegister("report-empty-detectors", new Option_Bool(false));
247  oc.addDescription("report-empty-detectors", "Report", "Lists detectors with no flow (enable -v)");
248 
249  oc.doRegister("print-absolute-flows", new Option_Bool(false));
250  oc.addDescription("print-absolute-flows", "Report", "Prints aggregated detector flows");
251 
252  // register report options
253  oc.doRegister("no-step-log", new Option_Bool(false));
254  oc.addDescription("no-step-log", "Report", "Disable console output of route parsing step");
255 
257 }
258 
259 
260 bool
262  return true;
263 }
264 
265 
266 
267 /****************************************************************************/
268 
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:84
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:74
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:67
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:309
A storage for options typed value containers)
Definition: OptionsCont.h:108
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within dfrouter...
Definition: RODFFrame.cpp:261
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