SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RODFFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // Sets and checks options for df-routing
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <iostream>
35 #include <fstream>
36 #include <ctime>
38 #include <utils/options/Option.h>
41 #include <utils/common/ToString.h>
43 #include "RODFFrame.h"
45 #include <utils/common/SUMOTime.h>
46 
47 
48 #ifdef CHECK_MEMORY_LEAKS
49 #include <foreign/nvwa/debug_new.h>
50 #endif // CHECK_MEMORY_LEAKS
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
56 void
59  oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
60 
61  // insert options sub-topics
62  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
63  oc.addOptionSubTopic("Input");
64  oc.addOptionSubTopic("Output");
65  oc.addOptionSubTopic("Processing");
66  oc.addOptionSubTopic("Defaults");
67  oc.addOptionSubTopic("Time");
68  SystemFrame::addReportOptions(oc); // fill this subtopic, too
69 
70 
71  // register the options
72  // register input-options
73  oc.doRegister("net-file", 'n', new Option_FileName());
74  oc.addSynonyme("net-file", "net");
75  oc.addDescription("net-file", "Input", "Loads the SUMO-network FILE");
76 
77  /* never used
78  oc.doRegister("route-files", 'r', new Option_FileName());
79  oc.addDescription("route-files", "Input", "Loads SUMO-routes from FILE");
80  */
81 
82  oc.doRegister("detector-files", 'd', new Option_FileName());
83  oc.addSynonyme("detector-files", "detectors");
84  oc.addDescription("detector-files", "Input", "Loads detector descriptions from FILE");
85 
86  oc.doRegister("measure-files", 'f', new Option_FileName());
87  oc.addSynonyme("measure-files", "detflows");
88  oc.addSynonyme("measure-files", "detector-flow-files", true);
89  oc.addDescription("measure-files", "Input", "Loads detector flows from FILE(s)");
90 
91 
92  // register output options
93  oc.doRegister("routes-output", 'o', new Option_FileName());
94  oc.addDescription("routes-output", "Output", "Saves computed routes to FILE");
95 
96  oc.doRegister("routes-for-all", new Option_Bool(false));
97  oc.addDescription("routes-for-all", "Output", "Forces DFROUTER to compute routes for in-between detectors");
98 
99  oc.doRegister("detector-output", new Option_FileName());
100  oc.addSynonyme("detector-output", "detectors-output", true);
101  oc.addDescription("detector-output", "Output", "Saves typed detectors to FILE");
102 
103  oc.doRegister("detectors-poi-output", new Option_FileName());
104  oc.addDescription("detectors-poi-output", "Output", "Saves detector positions as pois to FILE");
105 
106  oc.doRegister("emitters-output", new Option_FileName());
107  oc.addDescription("emitters-output", "Output", "Saves emitter definitions for source detectors to FILE");
108 
109  oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
110  oc.addDescription("emitters-poi-output", "Output", "Saves emitter positions as pois to FILE");
111 
112  oc.doRegister("variable-speed-sign-output", new Option_FileName());
113  oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
114  oc.addDescription("variable-speed-sign-output", "Output", "Saves variable seed sign definitions for sink detectors to FILE");
115 
116  oc.doRegister("end-reroute-output", new Option_FileName());
117  oc.addDescription("end-reroute-output", "Output", "Saves rerouter definitions for sink detectors to FILE");
118 
119  oc.doRegister("validation-output", new Option_FileName());
120  oc.addDescription("validation-output", "Output", "");
121 
122  oc.doRegister("validation-output.add-sources", new Option_Bool(false));
123  oc.addDescription("validation-output.add-sources", "Output", "");
124 
125 
126  // register processing options
127  // to guess empty flows
128  oc.doRegister("guess-empty-flows", new Option_Bool(false)); // !!! describe
129  oc.addDescription("guess-empty-flows", "Processing", "");
130 
131  // for guessing source/sink detectors
132  oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
133  oc.addDescription("highway-mode", "Processing", "Switches to highway-mode");
134 
135  // for detector reading
136  oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
137  oc.addDescription("ignore-invalid-detectors", "Processing", "Only warn about unparseable detectors");
138 
139  // for detector type computation
140  oc.doRegister("revalidate-detectors", new Option_Bool(false));
141  oc.addDescription("revalidate-detectors", "Processing", "Recomputes detector types even if given");
142 
143  // for route computation
144  oc.doRegister("revalidate-routes", new Option_Bool(false));
145  oc.addDescription("revalidate-routes", "Processing", "Recomputes routes even if given");
146 
147  oc.doRegister("all-end-follower", new Option_Bool(false));
148  oc.addDescription("all-end-follower", "Processing", "Continues routes till the first street after a sink");
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  // flow reading
176  oc.doRegister("time-factor", new Option_String("60", "TIME"));
177  oc.addDescription("time-factor", "Processing", "Multiply flow times with TIME to get seconds");
178 
179  oc.doRegister("time-offset", new Option_String("0", "TIME"));
180  oc.addDescription("time-offset", "Processing", "Subtracts TIME seconds from (scaled) flow times");
181 
182  oc.doRegister("time-step", new Option_String("60", "TIME"));
183  oc.addDescription("time-step", "Processing", "Expected distance between two successive data sets");
184 
185  // saving further structures
186  oc.doRegister("calibrator-output", new Option_Bool(false)); // !!!undescribed
187  oc.addSynonyme("calibrator-output", "write-calibrators", true);
188  oc.addDescription("calibrator-output", "Processing", "Write calibrators to FILE");
189 
190  oc.doRegister("include-unused-routes", new Option_Bool(false)); // !!!undescribed
191  oc.addDescription("include-unused-routes", "Processing", "");
192 
193  //
194  oc.doRegister("revalidate-flows", new Option_Bool(false));
195  oc.addDescription("revalidate-flows", "Processing", "");
196 
197  oc.doRegister("remove-empty-detectors", new Option_Bool(false));
198  oc.addDescription("remove-empty-detectors", "Processing", "Removes empty detectors from the list");
199 
200  oc.doRegister("strict-sources", new Option_Bool(false)); // !!!undescribed
201  oc.addDescription("strict-sources", "Processing", "");
202 
203  /* disabled, see ticket #521
204  oc.doRegister("join-lanes", new Option_Bool(false));
205  oc.addSynonyme("join-lanes", "mesosim", true);
206  oc.addDescription("join-lanes", "Processing", "Joins detectors lying on same height");
207  */
208 
209  //
210  oc.doRegister("scale", new Option_Float(1.));
211  oc.addDescription("scale", "Processing", "Scale factor for flows");
212 
213  // register defaults options
214  oc.doRegister("departlane", new Option_String());
215  oc.addDescription("departlane", "Defaults", "Assigns a default depart lane");
216 
217  oc.doRegister("departpos", new Option_String());
218  oc.addDescription("departpos", "Defaults", "Assigns a default depart position");
219 
220  oc.doRegister("departspeed", new Option_String());
221  oc.addDescription("departspeed", "Defaults", "Assigns a default depart speed");
222 
223  oc.doRegister("arrivallane", new Option_String());
224  oc.addDescription("arrivallane", "Defaults", "Assigns a default arrival lane");
225 
226  oc.doRegister("arrivalpos", new Option_String());
227  oc.addDescription("arrivalpos", "Defaults", "Assigns a default arrival position");
228 
229  oc.doRegister("arrivalspeed", new Option_String());
230  oc.addDescription("arrivalspeed", "Defaults", "Assigns a default arrival speed");
231 
232 
233  // register the simulation settings
234  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
235  oc.addDescription("begin", "Time", "Defines the begin time; Previous defs will be discarded");
236 
237  oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
238  oc.addDescription("end", "Time", "Defines the end time; Later defs will be discarded; Defaults to one day");
239 
240 
241  // register report options
242  oc.doRegister("report-empty-detectors", new Option_Bool(false));
243  oc.addDescription("report-empty-detectors", "Report", "Lists detectors with no flow (enable -v)");
244 
245  oc.doRegister("print-absolute-flows", new Option_Bool(false));
246  oc.addDescription("print-absolute-flows", "Report", "Prints aggregated detector flows");
247 
248  // register report options
249  oc.doRegister("no-step-log", new Option_Bool(false));
250  oc.addDescription("no-step-log", "Report", "Disable console output of route parsing step");
251 
253 }
254 
255 
256 bool
258  return true;
259 }
260 
261 
262 
263 /****************************************************************************/
264 
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:308
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:257
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:57