SUMO - Simulation of Urban MObility
RODFFrame.cpp
Go to the documentation of this file.
00001 /****************************************************************************/
00010 // Sets and checks options for df-routing
00011 /****************************************************************************/
00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00014 /****************************************************************************/
00015 //
00016 //   This file is part of SUMO.
00017 //   SUMO is free software: you can redistribute it and/or modify
00018 //   it under the terms of the GNU General Public License as published by
00019 //   the Free Software Foundation, either version 3 of the License, or
00020 //   (at your option) any later version.
00021 //
00022 /****************************************************************************/
00023 
00024 
00025 // ===========================================================================
00026 // included modules
00027 // ===========================================================================
00028 #ifdef _MSC_VER
00029 #include <windows_config.h>
00030 #else
00031 #include <config.h>
00032 #endif
00033 
00034 #include <iostream>
00035 #include <fstream>
00036 #include <ctime>
00037 #include <utils/options/OptionsCont.h>
00038 #include <utils/options/Option.h>
00039 #include <utils/common/MsgHandler.h>
00040 #include <utils/common/UtilExceptions.h>
00041 #include <utils/common/ToString.h>
00042 #include <utils/common/SystemFrame.h>
00043 #include "RODFFrame.h"
00044 #include <router/ROFrame.h>
00045 #include <utils/common/RandHelper.h>
00046 #include <utils/common/SUMOTime.h>
00047 
00048 
00049 #ifdef CHECK_MEMORY_LEAKS
00050 #include <foreign/nvwa/debug_new.h>
00051 #endif // CHECK_MEMORY_LEAKS
00052 
00053 
00054 // ===========================================================================
00055 // method definitions
00056 // ===========================================================================
00057 void
00058 RODFFrame::fillOptions() {
00059     OptionsCont& oc = OptionsCont::getOptions();
00060     oc.addCallExample("-c <CONFIGURATION>", "run routing with options from file");
00061 
00062     // insert options sub-topics
00063     SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
00064     oc.addOptionSubTopic("Input");
00065     oc.addOptionSubTopic("Output");
00066     oc.addOptionSubTopic("Processing");
00067     oc.addOptionSubTopic("Time");
00068     SystemFrame::addReportOptions(oc); // fill this subtopic, too
00069 
00070 
00071     // register the options
00072     // register input-options
00073     oc.doRegister("net-file", 'n', new Option_FileName());
00074     oc.addSynonyme("net-file", "net");
00075     oc.addDescription("net-file", "Input", "Loads the SUMO-network FILE");
00076 
00077     /* never used
00078     oc.doRegister("route-files", 'r', new Option_FileName());
00079     oc.addDescription("route-files", "Input", "Loads SUMO-routes from FILE");
00080     */
00081 
00082     oc.doRegister("detector-files", 'd', new Option_FileName());
00083     oc.addSynonyme("detector-files", "detectors");
00084     oc.addDescription("detector-files", "Input", "Loads detector descriptions from FILE");
00085 
00086     oc.doRegister("measure-files", 'f', new Option_FileName());
00087     oc.addSynonyme("measure-files", "detflows");
00088     oc.addSynonyme("measure-files", "detector-flow-files", true);
00089     oc.addDescription("measure-files", "Input", "Loads detector flows from FILE(s)");
00090 
00091 
00092     // register output options
00093     oc.doRegister("routes-output", 'o', new Option_FileName());
00094     oc.addDescription("routes-output", "Output", "Saves computed routes to FILE");
00095 
00096     oc.doRegister("routes-for-all", new Option_Bool(false));
00097     oc.addDescription("routes-for-all", "Output", "Forces DFROUTER to compute routes for in-between detectors");
00098 
00099     oc.doRegister("detector-output", new Option_FileName());
00100     oc.addSynonyme("detector-output", "detectors-output", true);
00101     oc.addDescription("detector-output", "Output", "Saves typed detectors to FILE");
00102 
00103     oc.doRegister("detectors-poi-output", new Option_FileName());
00104     oc.addDescription("detectors-poi-output", "Output", "Saves detector positions as pois to FILE");
00105 
00106     oc.doRegister("emitters-output", new Option_FileName());
00107     oc.addDescription("emitters-output", "Output", "Saves emitter definitions for source detectors to FILE");
00108 
00109     oc.doRegister("emitters-poi-output", new Option_FileName()); // !!! describe
00110     oc.addDescription("emitters-poi-output", "Output", "Saves emitter positions as pois to FILE");
00111 
00112     oc.doRegister("variable-speed-sign-output", new Option_FileName());
00113     oc.addSynonyme("variable-speed-sign-output", "speed-trigger-output", true);
00114     oc.addDescription("variable-speed-sign-output", "Output", "Saves variable seed sign definitions for sink detectors to FILE");
00115 
00116     oc.doRegister("end-reroute-output", new Option_FileName());
00117     oc.addDescription("end-reroute-output", "Output", "Saves rerouter definitions for sink detectors to FILE");
00118 
00119     oc.doRegister("validation-output", new Option_FileName());
00120     oc.addDescription("validation-output", "Output", "");
00121 
00122     oc.doRegister("validation-output.add-sources", new Option_Bool(false));
00123     oc.addDescription("validation-output.add-sources", "Output", "");
00124 
00125 
00126     // register processing options
00127     // to guess empty flows
00128     oc.doRegister("guess-empty-flows", new Option_Bool(false)); // !!! describe
00129     oc.addDescription("guess-empty-flows", "Processing", "");
00130 
00131     // for guessing source/sink detectors
00132     oc.doRegister("highway-mode", 'h', new Option_Bool(false)); // !!! describe
00133     oc.addDescription("highway-mode", "Processing", "Switches to highway-mode");
00134 
00135     // for detector reading
00136     oc.doRegister("ignore-invalid-detectors", new Option_Bool(false));
00137     oc.addDescription("ignore-invalid-detectors", "Processing", "Only warn about unparseable detectors");
00138 
00139     // for detector type computation
00140     oc.doRegister("revalidate-detectors", new Option_Bool(false));
00141     oc.addDescription("revalidate-detectors", "Processing", "Recomputes detector types even if given");
00142 
00143     // for route computation
00144     oc.doRegister("revalidate-routes", new Option_Bool(false));
00145     oc.addDescription("revalidate-routes", "Processing", "Recomputes routes even if given");
00146 
00147     oc.doRegister("all-end-follower", new Option_Bool(false));
00148     oc.addDescription("all-end-follower", "Processing", "Continues routes till the first street after a sink");
00149 
00150     oc.doRegister("keep-unfinished-routes", new Option_Bool(false));
00151     oc.addSynonyme("keep-unfinished-routes", "keep-unfound-ends", true);
00152     oc.addDescription("keep-unfinished-routes", "Processing", "Keeps routes even if they have exhausted max-search-depth");
00153 
00154     oc.doRegister("keep-longer-routes", new Option_Bool(false));
00155     oc.addDescription("keep-longer-routes", "Processing", "Keeps routes even if a shorter one exists");
00156 
00157     oc.doRegister("max-search-depth", new Option_Integer(30));
00158     oc.addSynonyme("max-search-depth", "max-nodet-follower", true);
00159     oc.addDescription("max-search-depth", "Processing", "Number of edges to follow a route without passing a detector");
00160 
00161     oc.doRegister("emissions-only", new Option_Bool(false));
00162     oc.addDescription("emissions-only", "Processing", "Writes only emission times");
00163 
00164     oc.doRegister("disallowed-edges", new Option_String(""));
00165     oc.addDescription("disallowed-edges", "Processing", "Do not route on these edges");
00166 
00167     oc.doRegister("keep-turnarounds", new Option_Bool(false));
00168     oc.addDescription("keep-turnarounds", "Processing", "Allow turnarounds as route continuations");
00169 
00170     oc.doRegister("min-route-length", new Option_Float(-1));
00171     oc.addSynonyme("min-route-length", "min-dist", true);
00172     oc.addSynonyme("min-route-length", "min-distance", true);
00173     oc.addDescription("min-route-length", "Processing", "Minimum distance in meters between start and end node of every route.");
00174 
00175     // flow reading
00176     oc.doRegister("time-factor", new Option_String("60", "TIME"));
00177     oc.addDescription("time-factor", "Processing", "Multiply flow times with TIME to get seconds");
00178 
00179     oc.doRegister("time-offset", new Option_String("0", "TIME"));
00180     oc.addDescription("time-offset", "Processing", "Subtracts TIME seconds from (scaled) flow times");
00181 
00182     oc.doRegister("time-step", new Option_String("60", "TIME"));
00183     oc.addDescription("time-step", "Processing", "Expected distance between two successive data sets");
00184 
00185     // saving further structures
00186     oc.doRegister("calibrator-output", new Option_Bool(false)); // !!!undescribed
00187     oc.addSynonyme("calibrator-output", "write-calibrators", true);
00188     oc.addDescription("calibrator-output", "Processing", "Write calibrators to FILE");
00189 
00190     oc.doRegister("include-unused-routes", new Option_Bool(false)); // !!!undescribed
00191     oc.addDescription("include-unused-routes", "Processing", "");
00192 
00193     //
00194     oc.doRegister("revalidate-flows", new Option_Bool(false));
00195     oc.addDescription("revalidate-flows", "Processing", "");
00196 
00197     oc.doRegister("remove-empty-detectors", new Option_Bool(false));
00198     oc.addDescription("remove-empty-detectors", "Processing", "Removes empty detectors from the list");
00199 
00200     oc.doRegister("strict-sources", new Option_Bool(false)); // !!!undescribed
00201     oc.addDescription("strict-sources", "Processing", "");
00202 
00203     /* disabled, see ticket #521
00204     oc.doRegister("join-lanes", new Option_Bool(false));
00205     oc.addSynonyme("join-lanes", "mesosim", true);
00206     oc.addDescription("join-lanes", "Processing", "Joins detectors lying on same height");
00207     */
00208 
00209     //
00210     oc.doRegister("scale", new Option_Float(1.));
00211     oc.addDescription("scale", "Processing", "Scale factor for flows");
00212 
00213     // register the simulation settings
00214     oc.doRegister("begin", 'b', new Option_String("0", "TIME"));
00215     oc.addDescription("begin", "Time", "Defines the begin time; Previous defs will be discarded");
00216 
00217     oc.doRegister("end", 'e', new Option_String("86400", "TIME"));
00218     oc.addDescription("end", "Time", "Defines the end time; Later defs will be discarded; Defaults to one day");
00219 
00220 
00221     // register report options
00222     oc.doRegister("report-empty-detectors", new Option_Bool(false));
00223     oc.addDescription("report-empty-detectors", "Report", "Lists detectors with no flow (enable -v)");
00224 
00225     oc.doRegister("print-absolute-flows", new Option_Bool(false));
00226     oc.addDescription("print-absolute-flows", "Report", "Prints aggregated detector flows");
00227 
00228     // register report options
00229     oc.doRegister("no-step-log", new Option_Bool(false));
00230     oc.addDescription("no-step-log", "Report", "Disable console output of route parsing step");
00231 
00232     RandHelper::insertRandOptions();
00233 }
00234 
00235 
00236 bool
00237 RODFFrame::checkOptions() {
00238     return true;
00239 }
00240 
00241 
00242 
00243 /****************************************************************************/
00244 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines