Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2006-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 : /****************************************************************************/
14 : /// @file RODFFrame.cpp
15 : /// @author Daniel Krajzewicz
16 : /// @author Eric Nicolay
17 : /// @author Jakob Erdmann
18 : /// @author Michael Behrisch
19 : /// @author Melanie Knocke
20 : /// @date Thu, 16.03.2006
21 : ///
22 : // Sets and checks options for df-routing
23 : /****************************************************************************/
24 : #include <config.h>
25 :
26 : #include <iostream>
27 : #include <fstream>
28 : #include <ctime>
29 : #include <utils/options/OptionsCont.h>
30 : #include <utils/options/Option.h>
31 : #include <utils/common/MsgHandler.h>
32 : #include <utils/common/UtilExceptions.h>
33 : #include <utils/common/ToString.h>
34 : #include <utils/common/SystemFrame.h>
35 : #include "RODFFrame.h"
36 : #include <utils/common/RandHelper.h>
37 : #include <utils/common/SUMOTime.h>
38 :
39 :
40 :
41 : // ===========================================================================
42 : // method definitions
43 : // ===========================================================================
44 : void
45 452 : RODFFrame::fillOptions() {
46 452 : OptionsCont& oc = OptionsCont::getOptions();
47 904 : oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
48 :
49 : // insert options sub-topics
50 452 : SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
51 452 : oc.addOptionSubTopic("Input");
52 452 : oc.addOptionSubTopic("Output");
53 452 : oc.addOptionSubTopic("Processing");
54 452 : oc.addOptionSubTopic("Defaults");
55 452 : oc.addOptionSubTopic("Time");
56 :
57 : // register the options
58 : // register input-options
59 452 : oc.doRegister("net-file", 'n', new Option_FileName());
60 904 : oc.addSynonyme("net-file", "net");
61 904 : oc.addDescription("net-file", "Input", TL("Loads the SUMO-network FILE"));
62 :
63 : /* never used
64 : oc.doRegister("route-files", 'r', new Option_FileName());
65 : oc.addDescription("route-files", "Input", TL("Loads SUMO-routes from FILE"));
66 : */
67 :
68 452 : oc.doRegister("detector-files", 'd', new Option_FileName());
69 904 : oc.addSynonyme("detector-files", "detectors");
70 904 : oc.addDescription("detector-files", "Input", TL("Loads detector descriptions from FILE"));
71 :
72 452 : oc.doRegister("measure-files", 'f', new Option_FileName());
73 904 : oc.addSynonyme("measure-files", "detflows");
74 904 : oc.addSynonyme("measure-files", "detector-flow-files", true);
75 904 : oc.addDescription("measure-files", "Input", TL("Loads detector flows from FILE(s)"));
76 :
77 : // need to do this here to be able to check for network and route input options
78 452 : SystemFrame::addReportOptions(oc);
79 :
80 : // register output options
81 452 : oc.doRegister("routes-output", 'o', new Option_FileName());
82 904 : oc.addDescription("routes-output", "Output", TL("Saves computed routes to FILE"));
83 :
84 452 : oc.doRegister("routes-for-all", new Option_Bool(false));
85 904 : oc.addDescription("routes-for-all", "Output", TL("Forces dfrouter to compute routes for in-between detectors"));
86 :
87 452 : oc.doRegister("detector-output", new Option_FileName());
88 904 : oc.addSynonyme("detector-output", "detectors-output", true);
89 904 : oc.addDescription("detector-output", "Output", TL("Saves typed detectors to FILE"));
90 :
91 452 : oc.doRegister("detectors-poi-output", new Option_FileName());
92 904 : oc.addDescription("detectors-poi-output", "Output", TL("Saves detector positions as pois to FILE"));
93 :
94 452 : oc.doRegister("emitters-output", new Option_FileName());
95 904 : oc.addDescription("emitters-output", "Output", TL("Saves emitter definitions for source detectors to FILE"));
96 :
97 452 : oc.doRegister("vtype", new Option_Bool(false));
98 904 : oc.addDescription("vtype", "Output", TL("Add vehicle types to the emitters file (PKW, LKW)"));
99 :
100 1808 : oc.doRegister("vtype-output", new Option_FileName(StringVector({ "" })));
101 904 : oc.addDescription("vtype-output", "Output", TL("Write generated vehicle types into separate FILE instead of including them into the emitters-output"));
102 :
103 452 : oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
104 904 : oc.addDescription("emitters-poi-output", "Output", TL("Saves emitter positions as pois to FILE"));
105 :
106 452 : oc.doRegister("variable-speed-sign-output", new Option_FileName());
107 904 : oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
108 904 : oc.addDescription("variable-speed-sign-output", "Output", TL("Saves variable seed sign definitions for sink detectors to FILE"));
109 :
110 452 : oc.doRegister("end-reroute-output", new Option_FileName());
111 904 : oc.addDescription("end-reroute-output", "Output", TL("Saves rerouter definitions for sink detectors to FILE"));
112 :
113 452 : oc.doRegister("validation-output", new Option_FileName());
114 904 : oc.addDescription("validation-output", "Output", TL("Write induction loop definitions for the given detector positions to FILE"));
115 :
116 452 : oc.doRegister("validation-output.add-sources", new Option_Bool(false));
117 904 : oc.addDescription("validation-output.add-sources", "Output", TL("Add source detectors to the validation output"));
118 :
119 :
120 : // register processing options
121 : // to guess empty flows
122 452 : oc.doRegister("guess-empty-flows", new Option_Bool(false));
123 904 : oc.addDescription("guess-empty-flows", "Processing", TL("Derive missing flow values from upstream or downstream (not working!)"));
124 :
125 : // for guessing source/sink detectors
126 452 : oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
127 904 : oc.addDescription("highway-mode", "Processing", TL("Switches to highway-mode"));
128 :
129 : // for detector reading
130 452 : oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
131 904 : oc.addDescription("ignore-invalid-detectors", "Processing", TL("Only warn about unparseable detectors"));
132 :
133 : // for detector type computation
134 452 : oc.doRegister("revalidate-detectors", new Option_Bool(false));
135 904 : oc.addDescription("revalidate-detectors", "Processing", TL("Recomputes detector types even if given"));
136 :
137 : // for route computation
138 452 : oc.doRegister("revalidate-routes", new Option_Bool(false));
139 904 : oc.addDescription("revalidate-routes", "Processing", TL("Recomputes routes even if given"));
140 :
141 452 : oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
142 904 : oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
143 904 : oc.addDescription("keep-unfinished-routes", "Processing", TL("Keeps routes even if they have exhausted max-search-depth"));
144 :
145 452 : oc.doRegister("keep-longer-routes", new Option_Bool(false));
146 904 : oc.addDescription("keep-longer-routes", "Processing", TL("Keeps routes even if a shorter one exists"));
147 :
148 452 : oc.doRegister("max-search-depth", new Option_Integer(30));
149 904 : oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
150 904 : oc.addDescription("max-search-depth", "Processing", TL("Number of edges to follow a route without passing a detector"));
151 :
152 452 : oc.doRegister("emissions-only", new Option_Bool(false));
153 904 : oc.addDescription("emissions-only", "Processing", TL("Writes only emission times"));
154 :
155 1808 : oc.doRegister("disallowed-edges", new Option_StringVector(StringVector({ "" })));
156 904 : oc.addDescription("disallowed-edges", "Processing", TL("Do not route on these edges"));
157 :
158 904 : oc.doRegister("vclass", new Option_String("ignoring"));
159 904 : oc.addDescription("vclass", "Processing", TL("Only route on edges allowing the given vclass"));
160 :
161 452 : oc.doRegister("keep-turnarounds", new Option_Bool(false));
162 904 : oc.addDescription("keep-turnarounds", "Processing", TL("Allow turnarounds as route continuations"));
163 :
164 452 : oc.doRegister("min-route-length", new Option_Float(-1));
165 904 : oc.addSynonyme("min-route-length", "min-dist", true);
166 904 : oc.addSynonyme("min-route-length", "min-distance", true);
167 904 : oc.addDescription("min-route-length", "Processing", TL("Minimum distance in meters between start and end node of every route"));
168 :
169 452 : oc.doRegister("randomize-flows", new Option_Bool(false));
170 904 : oc.addDescription("randomize-flows", "Processing", TL("generate random departure times for emitted vehicles"));
171 :
172 : // flow reading
173 904 : oc.doRegister("time-factor", new Option_String("60", "TIME"));
174 904 : oc.addDescription("time-factor", "Processing", TL("Multiply flow times with TIME to get seconds"));
175 :
176 904 : oc.doRegister("time-offset", new Option_String("0", "TIME"));
177 904 : oc.addDescription("time-offset", "Processing", TL("Subtracts TIME seconds from (scaled) flow times"));
178 :
179 904 : oc.doRegister("time-step", new Option_String("60", "TIME"));
180 904 : oc.addDescription("time-step", "Processing", TL("Expected distance between two successive data sets"));
181 :
182 : // saving further structures
183 452 : oc.doRegister("calibrator-output", new Option_Bool(false));
184 904 : oc.addSynonyme("calibrator-output", "write-calibrators", true);
185 904 : oc.addDescription("calibrator-output", "Processing", TL("Write calibrators to FILE"));
186 :
187 452 : oc.doRegister("include-unused-routes", new Option_Bool(false));
188 904 : oc.addDescription("include-unused-routes", "Processing", TL("Include routes in the output which have no vehicles"));
189 :
190 : //
191 452 : oc.doRegister("revalidate-flows", new Option_Bool(false));
192 904 : oc.addDescription("revalidate-flows", "Processing", TL("Checks whether detectors with calculated flow 0 can attract additional traffic"));
193 :
194 452 : oc.doRegister("remove-empty-detectors", new Option_Bool(false));
195 904 : oc.addDescription("remove-empty-detectors", "Processing", TL("Removes empty detectors from the list"));
196 :
197 452 : oc.doRegister("strict-sources", new Option_Bool(false));
198 904 : oc.addDescription("strict-sources", "Processing", TL("Whether edges with unknown status can prevent an edge from becoming a source"));
199 :
200 452 : oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
201 904 : oc.addDescription("respect-concurrent-inflows", "Processing", TL("Try to determine further inflows to an inbetween detector when computing split probabilities"));
202 :
203 : //
204 452 : oc.doRegister("scale", new Option_Float(1.));
205 904 : oc.addDescription("scale", "Processing", TL("Scale factor for flows"));
206 :
207 : // register defaults options
208 452 : oc.doRegister("departlane", new Option_String());
209 904 : oc.addDescription("departlane", "Defaults", TL("Assigns a default depart lane"));
210 :
211 452 : oc.doRegister("departpos", new Option_String());
212 904 : oc.addDescription("departpos", "Defaults", TL("Assigns a default depart position"));
213 :
214 452 : oc.doRegister("departspeed", new Option_String());
215 904 : oc.addDescription("departspeed", "Defaults", TL("Assigns a default depart speed"));
216 :
217 452 : oc.doRegister("arrivallane", new Option_String());
218 904 : oc.addDescription("arrivallane", "Defaults", TL("Assigns a default arrival lane"));
219 :
220 452 : oc.doRegister("arrivalpos", new Option_String());
221 904 : oc.addDescription("arrivalpos", "Defaults", TL("Assigns a default arrival position"));
222 :
223 452 : oc.doRegister("arrivalspeed", new Option_String());
224 904 : oc.addDescription("arrivalspeed", "Defaults", TL("Assigns a default arrival speed"));
225 :
226 452 : oc.doRegister("speeddev", new Option_Float(0.1));
227 904 : oc.addDescription("speeddev", "Defaults", TL("The default speed deviation of vehicles"));
228 :
229 : // register the simulation settings
230 904 : oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
231 904 : oc.addDescription("begin", "Time", TL("Defines the begin time; Previous defs will be discarded"));
232 :
233 904 : oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
234 904 : oc.addDescription("end", "Time", TL("Defines the end time; Later defs will be discarded; Defaults to one day"));
235 :
236 :
237 : // register report options
238 452 : oc.doRegister("report-empty-detectors", new Option_Bool(false));
239 904 : oc.addDescription("report-empty-detectors", "Report", TL("Lists detectors with no flow (enable -v)"));
240 :
241 452 : oc.doRegister("print-absolute-flows", new Option_Bool(false));
242 904 : oc.addDescription("print-absolute-flows", "Report", TL("Prints aggregated detector flows"));
243 :
244 : // register report options
245 452 : oc.doRegister("no-step-log", new Option_Bool(false));
246 904 : oc.addDescription("no-step-log", "Report", TL("Disable console output of route parsing step"));
247 :
248 452 : RandHelper::insertRandOptions(oc);
249 2260 : }
250 :
251 :
252 : bool
253 436 : RODFFrame::checkOptions() {
254 436 : return true;
255 : }
256 :
257 :
258 : /****************************************************************************/
|