Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ROMAFrame.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Sets and checks options for ma-routing
22/****************************************************************************/
23#include <config.h>
24
25#include <iostream>
26#include <fstream>
27#include <ctime>
33#include "ROMAFrame.h"
34#include <router/ROFrame.h>
38
39
40// ===========================================================================
41// method definitions
42// ===========================================================================
43void
46 oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
47
48 // insert options sub-topics
49 SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
50 oc.addOptionSubTopic("Input");
51 oc.addOptionSubTopic("Output");
52 oc.addOptionSubTopic("Processing");
53 oc.addOptionSubTopic("Defaults");
54 oc.addOptionSubTopic("Time");
55
56 // insert options
57 ROFrame::fillOptions(oc, false, true);
60 // add rand options
62}
63
64
65void
68 // register import options
69 oc.doRegister("ignore-vehicle-type", new Option_Bool(false));
70 oc.addSynonyme("ignore-vehicle-type", "no-vtype", true);
71 oc.addDescription("ignore-vehicle-type", "Output", TL("Does not save vtype information"));
72
73 oc.doRegister("netload-output", new Option_FileName());
74 oc.addDescription("netload-output", "Output", TL("Writes edge loads and final costs into FILE"));
75
76 oc.doRegister("all-pairs-output", new Option_FileName());
77 oc.addDescription("all-pairs-output", "Output", TL("Writes complete distance matrix into FILE"));
78
79 oc.doRegister("od-matrix-files", 'm', new Option_FileName());
80 oc.addSynonyme("od-matrix-files", "od-files");
81 oc.addDescription("od-matrix-files", "Input", TL("Loads O/D-files from FILE(s)"));
82
83 oc.doRegister("od-amitran-files", new Option_FileName());
84 oc.addSynonyme("od-amitran-files", "amitran-files");
85 oc.addSynonyme("od-amitran-files", "amitran");
86 oc.addDescription("od-amitran-files", "Input", TL("Loads O/D-matrix in Amitran format from FILE(s)"));
87
88 oc.doRegister("tazrelation-files", 'z', new Option_FileName());
89 oc.addDescription("tazrelation-files", "Input", TL("Loads O/D-matrix in tazRelation format from FILE(s)"));
90
91 oc.doRegister("tazrelation-attribute", new Option_String("count"));
92 oc.addSynonyme("tazrelation-attribute", "attribute");
93 oc.addDescription("tazrelation-attribute", "Input", TL("Define data attribute for loading counts (default 'count')"));
94
95 oc.doRegister("weight-adaption", new Option_Float(0.));
96 oc.addDescription("weight-adaption", "Input", TL("The travel time influence of prior intervals"));
97
98 oc.doRegister("taz-param", new Option_StringVector());
99 oc.addDescription("taz-param", "Input", TL("Parameter key(s) defining source (and sink) taz"));
100
101 oc.doRegister("ignore-taz", new Option_Bool(false));
102 oc.addDescription("ignore-taz", "Input", TL("Ignore attributes 'fromTaz' and 'toTaz'"));
103
104 // register the processing options
105 oc.doRegister("aggregation-interval", new Option_String("3600", "TIME"));
106 oc.addDescription("aggregation-interval", "Processing", TL("Defines the time interval when aggregating single vehicle input; Defaults to one hour"));
107
108 oc.doRegister("capacities.default", new Option_Bool(false));
109 oc.addDescription("capacities.default", "Processing", TL("Ignore edge priorities when calculating capacities and restraints"));
110
111 oc.doRegister("weights.priority-factor", new Option_Float(0));
112 oc.addDescription("weights.priority-factor", "Processing", TL("Consider edge priorities in addition to travel times, weighted by factor"));
113
114 oc.doRegister("bulk-routing.vtypes", new Option_Bool(false));
115 oc.addDescription("bulk-routing.vtypes", "Processing", TL("Aggregate routing queries with the same origin for different vehicle types"));
116
117 oc.doRegister("weight-period", new Option_String("3600", "TIME"));
118 oc.addDescription("weight-period", "Processing", TL("Aggregation period for the given weight files; triggers rebuilding of Contraction Hierarchy"));
119
120 // register defaults options
121 oc.doRegister("flow-output.departlane", new Option_String("free"));
122 oc.addSynonyme("flow-output.departlane", "departlane");
123 oc.addDescription("flow-output.departlane", "Defaults", TL("Assigns a default depart lane"));
124
125 oc.doRegister("flow-output.departpos", new Option_String());
126 oc.addSynonyme("flow-output.departpos", "departpos");
127 oc.addDescription("flow-output.departpos", "Defaults", TL("Assigns a default depart position"));
128
129 oc.doRegister("flow-output.departspeed", new Option_String("max"));
130 oc.addSynonyme("flow-output.departspeed", "departspeed");
131 oc.addDescription("flow-output.departspeed", "Defaults", TL("Assigns a default depart speed"));
132
133 oc.doRegister("flow-output.arrivallane", new Option_String());
134 oc.addSynonyme("flow-output.arrivallane", "arrivallane");
135 oc.addDescription("flow-output.arrivallane", "Defaults", TL("Assigns a default arrival lane"));
136
137 oc.doRegister("flow-output.arrivalpos", new Option_String());
138 oc.addSynonyme("flow-output.arrivalpos", "arrivalpos");
139 oc.addDescription("flow-output.arrivalpos", "Defaults", TL("Assigns a default arrival position"));
140
141 oc.doRegister("flow-output.arrivalspeed", new Option_String());
142 oc.addSynonyme("flow-output.arrivalspeed", "arrivalspeed");
143 oc.addDescription("flow-output.arrivalspeed", "Defaults", TL("Assigns a default arrival speed"));
144
145}
146
147
148void
151 // register the data processing options
152 oc.doRegister("scale", 's', new Option_Float(1));
153 oc.addDescription("scale", "Processing", TL("Scales the loaded flows by FLOAT"));
154
155 oc.doRegister("vtype", new Option_String(""));
156 oc.addDescription("vtype", "Processing", TL("Defines the name of the vehicle type to use"));
157
158 oc.doRegister("prefix", new Option_String(""));
159 oc.addDescription("prefix", "Processing", TL("Defines the prefix for vehicle flow names"));
160
161 oc.doRegister("timeline", new Option_StringVector());
162 oc.addDescription("timeline", "Processing", TL("Uses STR[] as a timeline definition"));
163
164 oc.doRegister("timeline.day-in-hours", new Option_Bool(false));
165 oc.addDescription("timeline.day-in-hours", "Processing", TL("Uses STR as a 24h-timeline definition"));
166
167 oc.doRegister("additive-traffic", new Option_Bool(false));
168 oc.addDescription("additive-traffic", "Processing", TL("Keep traffic flows of all time slots in the net"));
169
170 // register macroscopic SUE-settings
171 oc.doRegister("assignment-method", new Option_String("incremental"));
172 oc.addDescription("assignment-method", "Processing", TL("Choose a assignment method: incremental, UE or SUE"));
173
174 oc.doRegister("tolerance", new Option_Float(double(0.001)));
175 oc.addDescription("tolerance", "Processing", TL("Use FLOAT as tolerance when checking for SUE stability"));
176
177 oc.doRegister("left-turn-penalty", new Option_Float(0.));
178 oc.addDescription("left-turn-penalty", "Processing", TL("Use left-turn penalty FLOAT to calculate link travel time when searching routes"));
179
180 oc.doRegister("paths", new Option_Integer(1));
181 oc.addDescription("paths", "Processing", TL("Use INTEGER as the number of paths needed to be searched for each OD pair at each iteration"));
182
183 oc.doRegister("paths.penalty", new Option_Float(double(1)));
184 oc.addDescription("paths.penalty", "Processing", TL("Penalize existing routes with FLOAT to find secondary routes"));
185
186 oc.doRegister("upperbound", new Option_Float(double(0.5)));
187 oc.addSynonyme("upperbound", "upper", true);
188 oc.addDescription("upperbound", "Processing", TL("Use FLOAT as the upper bound to determine auxiliary link cost"));
189
190 oc.doRegister("lowerbound", new Option_Float(double(0.15)));
191 oc.addSynonyme("lowerbound", "lower", true);
192 oc.addDescription("lowerbound", "Processing", TL("Use FLOAT as the lower bound to determine auxiliary link cost"));
193
194 oc.doRegister("max-iterations", 'i', new Option_Integer(20));
195 oc.addDescription("max-iterations", "Processing", TL("maximal number of iterations for new route searching in incremental and stochastic user assignment"));
196
197 oc.doRegister("max-inner-iterations", new Option_Integer(1000));
198 oc.addDescription("max-inner-iterations", "Processing", TL("maximal number of inner iterations for user equilibrium calculation in the stochastic user assignment"));
199
200 // register route choice settings
201 oc.doRegister("route-choice-method", new Option_String("logit"));
202 oc.addDescription("route-choice-method", "Processing", TL("Choose a route choice method: gawron, logit, or lohse"));
203
204 oc.doRegister("gawron.beta", new Option_Float(double(0.3)));
205 oc.addSynonyme("gawron.beta", "gBeta", true);
206 oc.addDescription("gawron.beta", "Processing", TL("Use FLOAT as Gawron's beta"));
207
208 oc.doRegister("gawron.a", new Option_Float(double(0.05)));
209 oc.addSynonyme("gawron.a", "gA", true);
210 oc.addDescription("gawron.a", "Processing", TL("Use FLOAT as Gawron's a"));
211
212 oc.doRegister("exit-times", new Option_Bool(false));
213 oc.addDescription("exit-times", "Output", TL("Write exit times (weights) for each edge"));
214
215 oc.doRegister("keep-all-routes", new Option_Bool(false));
216 oc.addDescription("keep-all-routes", "Processing", TL("Save routes with near zero probability"));
217
218 oc.doRegister("skip-new-routes", new Option_Bool(false));
219 oc.addDescription("skip-new-routes", "Processing", TL("Only reuse routes from input, do not calculate new ones"));
220
221 oc.doRegister("logit.beta", new Option_Float(double(0.15))); // check: remove the default?
222 oc.addSynonyme("logit.beta", "lBeta", true);
223 oc.addDescription("logit.beta", "Processing", TL("Use FLOAT as (c-)logit's beta for the commonality factor"));
224
225 oc.doRegister("logit.gamma", new Option_Float(double(1)));
226 oc.addSynonyme("logit.gamma", "lGamma", true);
227 oc.addDescription("logit.gamma", "Processing", TL("Use FLOAT as (c-)logit's gamma for the commonality factor"));
228
229 oc.doRegister("logit.theta", new Option_Float(double(0.01)));
230 oc.addSynonyme("logit.theta", "lTheta", true);
231 oc.addDescription("logit.theta", "Processing", TL("Use FLOAT as (c-)logit's theta"));
232}
233
234
235bool
238 if (oc.isSet("assignment-method") && oc.getString("assignment-method") != "incremental" && oc.getString("assignment-method") != "UE" && oc.getString("assignment-method") != "SUE") {
239 WRITE_ERRORF(TL("Invalid assignment method '%'."), oc.getString("assignment-method"));
240 return false;
241 }
242 if (oc.getString("route-choice-method") != "gawron" && oc.getString("route-choice-method") != "logit" && oc.getString("route-choice-method") != "lohse") {
243 WRITE_ERRORF(TL("Invalid route choice method '%'."), oc.getString("route-choice-method"));
244 return false;
245 }
246 if (oc.getInt("paths") > 1 && (oc.getString("routing-algorithm") == "CH" || oc.getString("routing-algorithm") == "CHWrapper")) {
247 WRITE_WARNING(TL("Contraction hierarchies do not work with k shortest path search (please use a different routing algorithm)!"));
248 }
249 return true;
250}
251
252
253/****************************************************************************/
#define WRITE_ERRORF(...)
Definition MsgHandler.h:305
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:315
A storage for options typed value containers)
Definition OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static OptionsCont & getOptions()
Retrieves the options.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static void fillOptions(OptionsCont &oc, const bool isDUA=false, const bool isMA=false)
Inserts options used by routing applications into the OptionsCont-singleton.
Definition ROFrame.cpp:42
static void fillOptions()
Inserts options used by duarouter into the OptionsCont-singleton.
Definition ROMAFrame.cpp:44
static void addImportOptions()
Inserts import options used by duarouter into the OptionsCont-singleton.
Definition ROMAFrame.cpp:66
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid for usage within duarouter.
static void addAssignmentOptions()
Inserts dua options used by duarouter into the OptionsCont-singleton.
static void insertRandOptions(OptionsCont &oc)
Initialises the given options container with random number options.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.