SUMO - Simulation of Urban MObility

RODFFrame.cpp

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