SUMO - Simulation of Urban MObility

RORouteDef_Alternatives.h

Go to the documentation of this file.
00001 /****************************************************************************/
00008 // A route with alternative routes
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 #ifndef RORouteDef_Alternatives_h
00022 #define RORouteDef_Alternatives_h
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 <string>
00035 #include <vector>
00036 #include "RORouteDef.h"
00037 #include <utils/common/RGBColor.h>
00038 
00039 
00040 // ===========================================================================
00041 // class declarations
00042 // ===========================================================================
00043 class ROEdge;
00044 
00045 
00046 // ===========================================================================
00047 // class definitions
00048 // ===========================================================================
00053 class RORouteDef_Alternatives : public RORouteDef {
00054 public:
00056     RORouteDef_Alternatives(const std::string& id, unsigned int lastUsed, const SUMOReal beta,
00057                             const SUMOReal gawronA, const SUMOReal logitGamma, const int maxRoutes,
00058                             const bool keepRoutes, const bool skipRouteCalculation) ;
00059 
00061     virtual ~RORouteDef_Alternatives() ;
00062 
00065     virtual void addLoadedAlternative(RORoute* alternative);
00066 
00068     RORoute* buildCurrentRoute(SUMOAbstractRouter<ROEdge, ROVehicle> &router, SUMOTime begin,
00069                                const ROVehicle& veh) const;
00070 
00072     void addAlternative(SUMOAbstractRouter<ROEdge, ROVehicle> &router,
00073                         const ROVehicle* const, RORoute* current, SUMOTime begin);
00074 
00076     RORouteDef* copy(const std::string& id) const;
00077 
00078     void invalidateLast();
00079 
00080     void removeLast();
00081 
00082     virtual OutputDevice& writeXMLDefinition(SUMOAbstractRouter<ROEdge, ROVehicle> &router,
00083             OutputDevice& dev, const ROVehicle* const veh,
00084             bool asAlternatives, bool withExitTimes) const;
00085 
00086 private:
00088     int findRoute(RORoute* opt) const;
00089 
00091     SUMOReal getThetaForCLogit() const;
00092 
00094     void calculateLogitProbabilities();
00095 
00098     SUMOReal gawronF(SUMOReal pdr, SUMOReal pds, SUMOReal x);
00099 
00102     SUMOReal gawronG(SUMOReal a, SUMOReal x);
00103 
00104 private:
00106     mutable bool myNewRoute;
00107 
00109     mutable int myLastUsed;
00110 
00112     typedef std::vector<RORoute*> AlternativesVector;
00113 
00115     AlternativesVector myAlternatives;
00116 
00118     const SUMOReal myBeta;
00119 
00121     const SUMOReal myGawronA;
00122 
00124     const SUMOReal myLogitGamma;
00125 
00127     std::map<const RORoute*, SUMOReal> myCommonalities;
00128 
00130     const int myMaxRouteNumber;
00131 
00133     const bool myKeepRoutes;
00134 
00136     const bool mySkipRouteCalculation;
00137 
00138 
00139 private:
00141     RORouteDef_Alternatives(const RORouteDef_Alternatives& src);
00142 
00144     RORouteDef_Alternatives& operator=(const RORouteDef_Alternatives& src);
00145 
00146 };
00147 
00148 
00149 #endif
00150 
00151 /****************************************************************************/
00152 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines