Eclipse SUMO - Simulation of Urban MObility
ROMAFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
17 // Sets and checks options for ma-routing
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <iostream>
27 #include <fstream>
28 #include <ctime>
30 #include <utils/options/Option.h>
33 #include <utils/common/ToString.h>
34 #include "ROMAFrame.h"
35 #include <router/ROFrame.h>
39 
40 
41 // ===========================================================================
42 // method definitions
43 // ===========================================================================
44 void
47  oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
48 
49  // insert options sub-topics
50  SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
51  oc.addOptionSubTopic("Input");
52  oc.addOptionSubTopic("Output");
53  oc.addOptionSubTopic("Processing");
54  oc.addOptionSubTopic("Defaults");
55  oc.addOptionSubTopic("Time");
56  SystemFrame::addReportOptions(oc); // fill this subtopic, too
57 
58  // insert options
61  // add rand options
63 }
64 
65 
66 void
69  // register import options
70  oc.doRegister("output-file", 'o', new Option_FileName());
71  oc.addSynonyme("output-file", "output");
72  oc.addDescription("output-file", "Output", "Write flow definitions with route distributions to FILE");
73 
74  oc.doRegister("vtype-output", new Option_FileName());
75  oc.addDescription("vtype-output", "Output", "Write used vehicle types into separate FILE");
76 
77  oc.doRegister("ignore-vehicle-type", new Option_Bool(false));
78  oc.addSynonyme("ignore-vehicle-type", "no-vtype", true);
79  oc.addDescription("ignore-vehicle-type", "Output", "Does not save vtype information");
80 
81  oc.doRegister("netload-output", new Option_FileName());
82  oc.addDescription("netload-output", "Output", "Writes edge loads and final costs into FILE");
83 
84  oc.doRegister("all-pairs-output", new Option_FileName());
85  oc.addDescription("all-pairs-output", "Output", "Writes complete distance matrix into FILE");
86 
87  oc.doRegister("net-file", 'n', new Option_FileName());
88  oc.addSynonyme("net-file", "net");
89  oc.addDescription("net-file", "Input", "Use FILE as SUMO-network to route on");
90 
91  oc.doRegister("additional-files", 'd', new Option_FileName());
92  oc.addSynonyme("additional-files", "additional");
93  oc.addSynonyme("additional-files", "taz-files");
94  oc.addSynonyme("additional-files", "districts", true);
95  oc.addDescription("additional-files", "Input", "Read additional network data (districts, bus stops) from FILE");
96 
97  oc.doRegister("od-matrix-files", 'm', new Option_FileName());
98  oc.addSynonyme("od-matrix-files", "od-files");
99  oc.addDescription("od-matrix-files", "Input", "Loads O/D-files from FILE(s)");
100 
101  oc.doRegister("od-amitran-files", new Option_FileName());
102  oc.addSynonyme("od-amitran-files", "amitran-files");
103  oc.addSynonyme("od-amitran-files", "amitran");
104  oc.addDescription("od-amitran-files", "Input", "Loads O/D-matrix in Amitran format from FILE(s)");
105 
106  oc.doRegister("route-files", 'r', new Option_FileName());
107  oc.addSynonyme("route-files", "routes");
108  oc.addSynonyme("route-files", "trips");
109  oc.addSynonyme("route-files", "trip-files");
110  oc.addDescription("route-files", "Input", "Read sumo-routes or trips from FILE(s)");
111 
112  oc.doRegister("weight-files", 'w', new Option_FileName());
113  oc.addSynonyme("weight-files", "weights");
114  oc.addDescription("weight-files", "Input", "Read network weights from FILE(s)");
115 
116  oc.doRegister("lane-weight-files", new Option_FileName());
117  oc.addDescription("lane-weight-files", "Input", "Read lane-based network weights from FILE(s)");
118 
119  oc.doRegister("weight-attribute", 'x', new Option_String("traveltime"));
120  oc.addSynonyme("weight-attribute", "measure", true);
121  oc.addDescription("weight-attribute", "Input", "Name of the xml attribute which gives the edge weight");
122 
123  oc.doRegister("weight-adaption", new Option_Float(0.));
124  oc.addDescription("weight-adaption", "Input", "The travel time influence of prior intervals");
125 
126  oc.doRegister("taz-param", new Option_StringVector());
127  oc.addDescription("taz-param", "Input", "Parameter key(s) defining source (and sink) taz");
128 
129  // register the time settings
130  oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
131  oc.addDescription("begin", "Time", "Defines the begin time; Previous trips will be discarded");
132 
133  oc.doRegister("end", 'e', new Option_String(SUMOTIME_MAXSTRING, "TIME"));
134  oc.addDescription("end", "Time", "Defines the end time; Later trips will be discarded; Defaults to the maximum time that SUMO can represent");
135 
136  // register the processing options
137  oc.doRegister("aggregation-interval", new Option_String("3600", "TIME"));
138  oc.addDescription("aggregation-interval", "Processing", "Defines the time interval when aggregating single vehicle input; Defaults to one hour");
139 
140  oc.doRegister("ignore-errors", new Option_Bool(false));
141  oc.addSynonyme("ignore-errors", "continue-on-unbuild", true);
142  oc.addSynonyme("ignore-errors", "dismiss-loading-errors", true);
143  oc.addDescription("ignore-errors", "Report", "Continue if a route could not be build");
144 
145  oc.doRegister("max-alternatives", new Option_Integer(5));
146  oc.addDescription("max-alternatives", "Processing", "Prune the number of alternatives to INT");
147 
148  oc.doRegister("weights.interpolate", new Option_Bool(false));
149  oc.addSynonyme("weights.interpolate", "interpolate", true);
150  oc.addDescription("weights.interpolate", "Processing", "Interpolate edge weights at interval boundaries");
151 
152  oc.doRegister("weights.expand", new Option_Bool(false));
153  oc.addSynonyme("weights.expand", "expand-weights", true);
154  oc.addDescription("weights.expand", "Processing", "Expand weights behind the simulation's end");
155 
156  oc.doRegister("routing-algorithm", new Option_String("dijkstra"));
157  oc.addDescription("routing-algorithm", "Processing", "Select among routing algorithms ['dijkstra', 'astar', 'CH', 'CHWrapper']");
158 
159  oc.doRegister("bulk-routing.vtypes", new Option_Bool(false));
160  oc.addDescription("bulk-routing.vtypes", "Processing", "Aggregate routing queries with the same origin for different vehicle types");
161 
162  oc.doRegister("routing-threads", new Option_Integer(0));
163  oc.addDescription("routing-threads", "Processing", "The number of parallel execution threads used for routing");
164 
165  oc.doRegister("weight-period", new Option_String("3600", "TIME"));
166  oc.addDescription("weight-period", "Processing", "Aggregation period for the given weight files; triggers rebuilding of Contraction Hierarchy");
167 
168  // register defaults options
169  oc.doRegister("flow-output.departlane", new Option_String("free"));
170  oc.addSynonyme("flow-output.departlane", "departlane");
171  oc.addDescription("flow-output.departlane", "Defaults", "Assigns a default depart lane");
172 
173  oc.doRegister("flow-output.departpos", new Option_String());
174  oc.addSynonyme("flow-output.departpos", "departpos");
175  oc.addDescription("flow-output.departpos", "Defaults", "Assigns a default depart position");
176 
177  oc.doRegister("flow-output.departspeed", new Option_String("max"));
178  oc.addSynonyme("flow-output.departspeed", "departspeed");
179  oc.addDescription("flow-output.departspeed", "Defaults", "Assigns a default depart speed");
180 
181  oc.doRegister("flow-output.arrivallane", new Option_String());
182  oc.addSynonyme("flow-output.arrivallane", "arrivallane");
183  oc.addDescription("flow-output.arrivallane", "Defaults", "Assigns a default arrival lane");
184 
185  oc.doRegister("flow-output.arrivalpos", new Option_String());
186  oc.addSynonyme("flow-output.arrivalpos", "arrivalpos");
187  oc.addDescription("flow-output.arrivalpos", "Defaults", "Assigns a default arrival position");
188 
189  oc.doRegister("flow-output.arrivalspeed", new Option_String());
190  oc.addSynonyme("flow-output.arrivalspeed", "arrivalspeed");
191  oc.addDescription("flow-output.arrivalspeed", "Defaults", "Assigns a default arrival speed");
192 
193 }
194 
195 
196 void
199  // register the data processing options
200  oc.doRegister("scale", 's', new Option_Float(1));
201  oc.addDescription("scale", "Processing", "Scales the loaded flows by FLOAT");
202 
203  oc.doRegister("vtype", new Option_String(""));
204  oc.addDescription("vtype", "Processing", "Defines the name of the vehicle type to use");
205 
206  oc.doRegister("prefix", new Option_String(""));
207  oc.addDescription("prefix", "Processing", "Defines the prefix for vehicle flow names");
208 
209  oc.doRegister("timeline", new Option_StringVector());
210  oc.addDescription("timeline", "Processing", "Uses STR[] as a timeline definition");
211 
212  oc.doRegister("timeline.day-in-hours", new Option_Bool(false));
213  oc.addDescription("timeline.day-in-hours", "Processing", "Uses STR as a 24h-timeline definition");
214 
215  oc.doRegister("additive-traffic", new Option_Bool(false));
216  oc.addDescription("additive-traffic", "Processing", "Keep traffic flows of all time slots in the net");
217 
218  // register macroscopic SUE-settings
219  oc.doRegister("assignment-method", new Option_String("incremental"));
220  oc.addDescription("assignment-method", "Processing", "Choose a assignment method: incremental, UE or SUE");
221 
222  oc.doRegister("tolerance", new Option_Float(double(0.001)));
223  oc.addDescription("tolerance", "Processing", "Use FLOAT as tolerance when checking for SUE stability");
224 
225  oc.doRegister("left-turn-penalty", new Option_Float(0.));
226  oc.addDescription("left-turn-penalty", "Processing", "Use left-turn penalty FLOAT to calculate link travel time when searching routes");
227 
228  oc.doRegister("paths", new Option_Integer(1));
229  oc.addDescription("paths", "Processing", "Use INTEGER as the number of paths needed to be searched for each OD pair at each iteration");
230 
231  oc.doRegister("paths.penalty", new Option_Float(double(1)));
232  oc.addDescription("paths.penalty", "Processing", "Penalize existing routes with FLOAT to find secondary routes");
233 
234  oc.doRegister("upperbound", new Option_Float(double(0.5)));
235  oc.addSynonyme("upperbound", "upper", true);
236  oc.addDescription("upperbound", "Processing", "Use FLOAT as the upper bound to determine auxiliary link cost");
237 
238  oc.doRegister("lowerbound", new Option_Float(double(0.15)));
239  oc.addSynonyme("lowerbound", "lower", true);
240  oc.addDescription("lowerbound", "Processing", "Use FLOAT as the lower bound to determine auxiliary link cost");
241 
242  oc.doRegister("max-iterations", 'i', new Option_Integer(20));
243  oc.addDescription("max-iterations", "Processing", "maximal number of iterations for new route searching in incremental and stochastic user assignment");
244 
245  oc.doRegister("max-inner-iterations", new Option_Integer(1000));
246  oc.addDescription("max-inner-iterations", "Processing", "maximal number of inner iterations for user equilibrium calcuation in the stochastic user assignment");
247 
248  // register route choice settings
249  oc.doRegister("route-choice-method", new Option_String("logit"));
250  oc.addDescription("route-choice-method", "Processing", "Choose a route choice method: gawron, logit, or lohse");
251 
252  oc.doRegister("gawron.beta", new Option_Float(double(0.3)));
253  oc.addSynonyme("gawron.beta", "gBeta", true);
254  oc.addDescription("gawron.beta", "Processing", "Use FLOAT as Gawron's beta");
255 
256  oc.doRegister("gawron.a", new Option_Float(double(0.05)));
257  oc.addSynonyme("gawron.a", "gA", true);
258  oc.addDescription("gawron.a", "Processing", "Use FLOAT as Gawron's a");
259 
260  oc.doRegister("exit-times", new Option_Bool(false));
261  oc.addDescription("exit-times", "Output", "Write exit times (weights) for each edge");
262 
263  oc.doRegister("keep-all-routes", new Option_Bool(false));
264  oc.addDescription("keep-all-routes", "Processing", "Save routes with near zero probability");
265 
266  oc.doRegister("skip-new-routes", new Option_Bool(false));
267  oc.addDescription("skip-new-routes", "Processing", "Only reuse routes from input, do not calculate new ones");
268 
269  oc.doRegister("logit.beta", new Option_Float(double(0.15))); // check: remove the default?
270  oc.addSynonyme("logit.beta", "lBeta", true);
271  oc.addDescription("logit.beta", "Processing", "Use FLOAT as (c-)logit's beta for the commonality factor");
272 
273  oc.doRegister("logit.gamma", new Option_Float(double(1)));
274  oc.addSynonyme("logit.gamma", "lGamma", true);
275  oc.addDescription("logit.gamma", "Processing", "Use FLOAT as (c-)logit's gamma for the commonality factor");
276 
277  oc.doRegister("logit.theta", new Option_Float(double(0.01)));
278  oc.addSynonyme("logit.theta", "lTheta", true);
279  oc.addDescription("logit.theta", "Processing", "Use FLOAT as (c-)logit's theta");
280 }
281 
282 
283 bool
286  if (oc.isSet("assignment-method") && oc.getString("assignment-method") != "incremental" && oc.getString("assignment-method") != "UE" && oc.getString("assignment-method") != "SUE") {
287  WRITE_ERROR("invalid assignment method");
288  return false;
289  }
290  if (oc.getString("route-choice-method") != "gawron" && oc.getString("route-choice-method") != "logit" && oc.getString("route-choice-method") != "lohse") {
291  WRITE_ERROR("invalid route choice method");
292  return false;
293  }
294  return true;
295 }
296 
297 
298 
299 /****************************************************************************/
300 
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
ToString.h
SystemFrame::addConfigurationOptions
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:39
Option_Bool
Definition: Option.h:538
OptionsCont.h
MsgHandler.h
ROMAFrame::checkOptions
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
Definition: ROMAFrame.cpp:284
ROMAFrame.h
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
ROFrame.h
SUMOVehicleParameter.h
SystemFrame::addReportOptions
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:64
OptionsCont::addDescription
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
Definition: OptionsCont.cpp:469
SystemFrame.h
OptionsCont::addSynonyme
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:95
ROMAFrame::addImportOptions
static void addImportOptions()
Inserts import options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:67
OptionsCont::doRegister
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:74
Option_String
Definition: Option.h:399
UtilExceptions.h
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
OptionsCont::addOptionSubTopic
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
Definition: OptionsCont.cpp:519
ROMAFrame::fillOptions
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:45
Option_StringVector
Definition: Option.h:720
Option.h
Option_Float
Definition: Option.h:470
OptionsCont::addCallExample
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
Definition: OptionsCont.cpp:495
SUMOTIME_MAXSTRING
#define SUMOTIME_MAXSTRING
Definition: SUMOTime.h:37
config.h
Option_FileName
Definition: Option.h:783
RandHelper::insertRandOptions
static void insertRandOptions()
Initialises the given options container with random number options.
Definition: RandHelper.cpp:45
RandHelper.h
Option_Integer
An integer-option.
Definition: Option.h:331
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
ROMAFrame::addAssignmentOptions
static void addAssignmentOptions()
Inserts dua options used by duarouter into the OptionsCont-singleton.
Definition: ROMAFrame.cpp:197