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 730 : RODFFrame::fillOptions() {
46 730 : OptionsCont& oc = OptionsCont::getOptions();
47 1460 : oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
48 :
49 : // insert options sub-topics
50 730 : SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
51 730 : oc.addOptionSubTopic("Input");
52 730 : oc.addOptionSubTopic("Output");
53 730 : oc.addOptionSubTopic("Processing");
54 730 : oc.addOptionSubTopic("Defaults");
55 730 : oc.addOptionSubTopic("Time");
56 :
57 : // register the options
58 : // register input-options
59 1460 : oc.doRegister("net-file", 'n', new Option_FileName());
60 1460 : oc.addSynonyme("net-file", "net");
61 1460 : 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 1460 : oc.doRegister("detector-files", 'd', new Option_FileName());
69 1460 : oc.addSynonyme("detector-files", "detectors");
70 1460 : oc.addDescription("detector-files", "Input", TL("Loads detector descriptions from FILE"));
71 :
72 1460 : oc.doRegister("measure-files", 'f', new Option_FileName());
73 1460 : oc.addSynonyme("measure-files", "detflows");
74 1460 : oc.addSynonyme("measure-files", "detector-flow-files", true);
75 1460 : 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 730 : SystemFrame::addReportOptions(oc);
79 :
80 : // register output options
81 1460 : oc.doRegister("routes-output", 'o', new Option_FileName());
82 1460 : oc.addDescription("routes-output", "Output", TL("Saves computed routes to FILE"));
83 :
84 730 : oc.doRegister("routes-for-all", new Option_Bool(false));
85 1460 : oc.addDescription("routes-for-all", "Output", TL("Forces dfrouter to compute routes for in-between detectors"));
86 :
87 1460 : oc.doRegister("detector-output", new Option_FileName());
88 1460 : oc.addSynonyme("detector-output", "detectors-output", true);
89 1460 : oc.addDescription("detector-output", "Output", TL("Saves typed detectors to FILE"));
90 :
91 1460 : oc.doRegister("detectors-poi-output", new Option_FileName());
92 1460 : oc.addDescription("detectors-poi-output", "Output", TL("Saves detector positions as pois to FILE"));
93 :
94 1460 : oc.doRegister("emitters-output", new Option_FileName());
95 1460 : oc.addDescription("emitters-output", "Output", TL("Saves emitter definitions for source detectors to FILE"));
96 :
97 730 : oc.doRegister("vtype", new Option_Bool(false));
98 1460 : oc.addDescription("vtype", "Output", TL("Add vehicle types to the emitters file (PKW, LKW)"));
99 :
100 2190 : oc.doRegister("vtype-output", new Option_FileName(StringVector({ "" })));
101 1460 : oc.addDescription("vtype-output", "Output", TL("Write generated vehicle types into separate FILE instead of including them into the emitters-output"));
102 :
103 1460 : oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
104 1460 : oc.addDescription("emitters-poi-output", "Output", TL("Saves emitter positions as pois to FILE"));
105 :
106 1460 : oc.doRegister("variable-speed-sign-output", new Option_FileName());
107 1460 : oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
108 1460 : oc.addDescription("variable-speed-sign-output", "Output", TL("Saves variable seed sign definitions for sink detectors to FILE"));
109 :
110 1460 : oc.doRegister("end-reroute-output", new Option_FileName());
111 1460 : oc.addDescription("end-reroute-output", "Output", TL("Saves rerouter definitions for sink detectors to FILE"));
112 :
113 1460 : oc.doRegister("validation-output", new Option_FileName());
114 1460 : oc.addDescription("validation-output", "Output", TL("Write induction loop definitions for the given detector positions to FILE"));
115 :
116 730 : oc.doRegister("validation-output.add-sources", new Option_Bool(false));
117 1460 : 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 730 : oc.doRegister("guess-empty-flows", new Option_Bool(false));
123 1460 : 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 730 : oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
127 1460 : oc.addDescription("highway-mode", "Processing", TL("Switches to highway-mode"));
128 :
129 : // for detector reading
130 730 : oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
131 1460 : oc.addDescription("ignore-invalid-detectors", "Processing", TL("Only warn about unparseable detectors"));
132 :
133 : // for detector type computation
134 730 : oc.doRegister("revalidate-detectors", new Option_Bool(false));
135 1460 : oc.addDescription("revalidate-detectors", "Processing", TL("Recomputes detector types even if given"));
136 :
137 : // for route computation
138 730 : oc.doRegister("revalidate-routes", new Option_Bool(false));
139 1460 : oc.addDescription("revalidate-routes", "Processing", TL("Recomputes routes even if given"));
140 :
141 730 : oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
142 1460 : oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
143 1460 : oc.addDescription("keep-unfinished-routes", "Processing", TL("Keeps routes even if they have exhausted max-search-depth"));
144 :
145 730 : oc.doRegister("keep-longer-routes", new Option_Bool(false));
146 1460 : oc.addDescription("keep-longer-routes", "Processing", TL("Keeps routes even if a shorter one exists"));
147 :
148 730 : oc.doRegister("max-search-depth", new Option_Integer(30));
149 1460 : oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
150 1460 : oc.addDescription("max-search-depth", "Processing", TL("Number of edges to follow a route without passing a detector"));
151 :
152 730 : oc.doRegister("emissions-only", new Option_Bool(false));
153 1460 : oc.addDescription("emissions-only", "Processing", TL("Writes only emission times"));
154 :
155 2190 : oc.doRegister("disallowed-edges", new Option_StringVector(StringVector({ "" })));
156 1460 : oc.addDescription("disallowed-edges", "Processing", TL("Do not route on these edges"));
157 :
158 1460 : oc.doRegister("vclass", new Option_String("ignoring"));
159 1460 : oc.addDescription("vclass", "Processing", TL("Only route on edges allowing the given vclass"));
160 :
161 730 : oc.doRegister("keep-turnarounds", new Option_Bool(false));
162 1460 : oc.addDescription("keep-turnarounds", "Processing", TL("Allow turnarounds as route continuations"));
163 :
164 730 : oc.doRegister("min-route-length", new Option_Float(-1));
165 1460 : oc.addSynonyme("min-route-length", "min-dist", true);
166 1460 : oc.addSynonyme("min-route-length", "min-distance", true);
167 1460 : oc.addDescription("min-route-length", "Processing", TL("Minimum distance in meters between start and end node of every route"));
168 :
169 730 : oc.doRegister("randomize-flows", new Option_Bool(false));
170 1460 : oc.addDescription("randomize-flows", "Processing", TL("generate random departure times for emitted vehicles"));
171 :
172 : // flow reading
173 1460 : oc.doRegister("time-factor", new Option_String("60", "TIME"));
174 1460 : oc.addDescription("time-factor", "Processing", TL("Multiply flow times with TIME to get seconds"));
175 :
176 1460 : oc.doRegister("time-offset", new Option_String("0", "TIME"));
177 1460 : oc.addDescription("time-offset", "Processing", TL("Subtracts TIME seconds from (scaled) flow times"));
178 :
179 1460 : oc.doRegister("time-step", new Option_String("60", "TIME"));
180 1460 : oc.addDescription("time-step", "Processing", TL("Expected distance between two successive data sets"));
181 :
182 : // saving further structures
183 730 : oc.doRegister("calibrator-output", new Option_Bool(false));
184 1460 : oc.addSynonyme("calibrator-output", "write-calibrators", true);
185 1460 : oc.addDescription("calibrator-output", "Processing", TL("Write calibrators to FILE"));
186 :
187 730 : oc.doRegister("include-unused-routes", new Option_Bool(false));
188 1460 : oc.addDescription("include-unused-routes", "Processing", TL("Include routes in the output which have no vehicles"));
189 :
190 : //
191 730 : oc.doRegister("revalidate-flows", new Option_Bool(false));
192 1460 : oc.addDescription("revalidate-flows", "Processing", TL("Checks whether detectors with calculated flow 0 can attract additional traffic"));
193 :
194 730 : oc.doRegister("remove-empty-detectors", new Option_Bool(false));
195 1460 : oc.addDescription("remove-empty-detectors", "Processing", TL("Removes empty detectors from the list"));
196 :
197 730 : oc.doRegister("strict-sources", new Option_Bool(false));
198 1460 : oc.addDescription("strict-sources", "Processing", TL("Whether edges with unknown status can prevent an edge from becoming a source"));
199 :
200 730 : oc.doRegister("respect-concurrent-inflows", new Option_Bool(false));
201 1460 : oc.addDescription("respect-concurrent-inflows", "Processing", TL("Try to determine further inflows to an inbetween detector when computing split probabilities"));
202 :
203 : //
204 730 : oc.doRegister("scale", new Option_Float(1.));
205 1460 : oc.addDescription("scale", "Processing", TL("Scale factor for flows"));
206 :
207 : // register defaults options
208 1460 : oc.doRegister("departlane", new Option_String());
209 1460 : oc.addDescription("departlane", "Defaults", TL("Assigns a default depart lane"));
210 :
211 1460 : oc.doRegister("departpos", new Option_String());
212 1460 : oc.addDescription("departpos", "Defaults", TL("Assigns a default depart position"));
213 :
214 1460 : oc.doRegister("departspeed", new Option_String());
215 1460 : oc.addDescription("departspeed", "Defaults", TL("Assigns a default depart speed"));
216 :
217 1460 : oc.doRegister("arrivallane", new Option_String());
218 1460 : oc.addDescription("arrivallane", "Defaults", TL("Assigns a default arrival lane"));
219 :
220 1460 : oc.doRegister("arrivalpos", new Option_String());
221 1460 : oc.addDescription("arrivalpos", "Defaults", TL("Assigns a default arrival position"));
222 :
223 1460 : oc.doRegister("arrivalspeed", new Option_String());
224 1460 : oc.addDescription("arrivalspeed", "Defaults", TL("Assigns a default arrival speed"));
225 :
226 730 : oc.doRegister("speeddev", new Option_Float(0.1));
227 1460 : oc.addDescription("speeddev", "Defaults", TL("The default speed deviation of vehicles"));
228 :
229 : // register the simulation settings
230 1460 : oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
231 1460 : oc.addDescription("begin", "Time", TL("Defines the begin time; Previous defs will be discarded"));
232 :
233 1460 : oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
234 1460 : 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 730 : oc.doRegister("report-empty-detectors", new Option_Bool(false));
239 1460 : oc.addDescription("report-empty-detectors", "Report", TL("Lists detectors with no flow (enable -v)"));
240 :
241 730 : oc.doRegister("print-absolute-flows", new Option_Bool(false));
242 1460 : oc.addDescription("print-absolute-flows", "Report", TL("Prints aggregated detector flows"));
243 :
244 : // register report options
245 730 : oc.doRegister("no-step-log", new Option_Bool(false));
246 1460 : oc.addDescription("no-step-log", "Report", TL("Disable console output of route parsing step"));
247 :
248 730 : RandHelper::insertRandOptions(oc);
249 730 : }
250 :
251 :
252 : bool
253 714 : RODFFrame::checkOptions() {
254 714 : return true;
255 : }
256 :
257 :
258 : /****************************************************************************/
|