RODUAFrame.cpp

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Sets and checks options for dua-routing
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 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 "RODUAFrame.h"
00039 #include <router/ROFrame.h>
00040 #include <utils/common/RandHelper.h>
00041 #include <utils/common/SystemFrame.h>
00042 #include <utils/common/SUMOVehicleParameter.h>
00043 
00044 #ifdef CHECK_MEMORY_LEAKS
00045 #include <foreign/nvwa/debug_new.h>
00046 #endif // CHECK_MEMORY_LEAKS
00047 
00048 
00049 // ===========================================================================
00050 // method definitions
00051 // ===========================================================================
00052 void
00053 RODUAFrame::fillOptions() {
00054     OptionsCont &oc = OptionsCont::getOptions();
00055     oc.addCallExample("-c <CONFIGURATION>");
00056 
00057     // insert options sub-topics
00058     SystemFrame::addConfigurationOptions(oc); // fill this subtopic, too
00059     oc.addOptionSubTopic("Input");
00060     oc.addOptionSubTopic("Output");
00061     oc.addOptionSubTopic("Processing");
00062     oc.addOptionSubTopic("Defaults");
00063     oc.addOptionSubTopic("Time");
00064     SystemFrame::addReportOptions(oc); // fill this subtopic, too
00065 
00066     // insert options
00067     ROFrame::fillOptions(oc);
00068     addImportOptions();
00069     addDUAOptions();
00070     // add rand options
00071     RandHelper::insertRandOptions();
00072 }
00073 
00074 
00075 void
00076 RODUAFrame::addImportOptions() {
00077     OptionsCont &oc = OptionsCont::getOptions();
00078     // register import options
00079     oc.doRegister("trip-defs", 't', new Option_FileName());
00080     oc.addSynonyme("trips", "trip-defs");
00081     oc.addDescription("trip-defs", "Input", "Read trip-definitions from FILE");
00082 
00083     oc.doRegister("flow-definition", 'f', new Option_FileName());
00084     oc.addSynonyme("flow-definition", "flows");
00085     oc.addDescription("flow-definition", "Input", "Read flow-definitions from FILE");
00086 
00087     oc.doRegister("sumo-input", 's', new Option_FileName());
00088     oc.addSynonyme("sumo", "sumo-input");
00089     oc.addDescription("sumo-input", "Input", "Read sumo-routes from FILE");
00090 
00091     // register further processing options
00092     // ! The subtopic "Processing" must be initialised earlier !
00093     oc.doRegister("expand-weights", new Option_Bool(false));
00094     oc.addDescription("expand-weights", "Processing", "Expand weights behind the simulation's end");
00095 }
00096 
00097 
00098 void
00099 RODUAFrame::addDUAOptions() {
00100     OptionsCont &oc = OptionsCont::getOptions();
00101     // register Gawron's DUE-settings
00102     oc.doRegister("gBeta", new Option_Float(SUMOReal(0.3)));
00103     oc.addDescription("gBeta", "Processing", "Use FLOAT as Gawron's beta");
00104 
00105     oc.doRegister("gA", new Option_Float((SUMOReal) 0.05));
00106     oc.addDescription("gA", "Processing", "Use FLOAT as Gawron's alpha");
00107 
00108     oc.doRegister("exit-times", new Option_Bool(false));
00109     oc.addDescription("exit-times", "Output", "Write exit times (weights) for each edge");
00110 }
00111 
00112 
00113 bool
00114 RODUAFrame::checkOptions() {
00115     OptionsCont &oc = OptionsCont::getOptions();
00116     bool ok = ROFrame::checkOptions(oc);
00117     ok &= (!oc.isSet("departlane") || SUMOVehicleParameter::departlaneValidate(oc.getString("departlane")));
00118     ok &= (!oc.isSet("departpos") || SUMOVehicleParameter::departposValidate(oc.getString("departpos")));
00119     ok &= (!oc.isSet("departspeed") || SUMOVehicleParameter::departspeedValidate(oc.getString("departspeed")));
00120     ok &= (!oc.isSet("arrivallane") || SUMOVehicleParameter::arrivallaneValidate(oc.getString("arrivallane")));
00121     ok &= (!oc.isSet("arrivalpos") || SUMOVehicleParameter::arrivalposValidate(oc.getString("arrivalpos")));
00122     ok &= (!oc.isSet("arrivalspeed") || SUMOVehicleParameter::arrivalspeedValidate(oc.getString("arrivalspeed")));
00123     return ok;
00124 }
00125 
00126 
00127 
00128 /****************************************************************************/
00129 

Generated on Wed May 5 00:06:36 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6