SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROCostCalculator.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Calculators for route costs and probabilities
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef ROCostCalculator_h
22 #define ROCostCalculator_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <map>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class RORoute;
42 class ROVehicle;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
53 public:
55 
56  static void cleanup();
57 
58  virtual void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const = 0;
59 
61  virtual void calculateProbabilities(const ROVehicle* const veh, std::vector<RORoute*> alternatives) = 0;
62 
63  unsigned int getMaxRouteNumber() const {
64  return myMaxRouteNumber;
65  }
66 
67  bool keepRoutes() const {
68  return myKeepRoutes;
69  }
70 
71  bool skipRouteCalculation() const {
73  }
74 
75 protected:
78 
80  virtual ~ROCostCalculator();
81 
82 private:
84 
86  unsigned int myMaxRouteNumber;
87 
90 
93 
94 };
95 
96 
102 public:
104  ROGawronCalculator(const SUMOReal beta, const SUMOReal a);
105 
107  virtual ~ROGawronCalculator();
108 
109  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const;
110 
112  void calculateProbabilities(const ROVehicle* const veh, std::vector<RORoute*> alternatives);
113 
114 private:
117  SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const;
118 
121  SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const;
122 
123 private:
126 
128  const SUMOReal myA;
129 
130 private:
133 
134 };
135 
136 
142 public:
144  ROLogitCalculator(const SUMOReal beta, const SUMOReal gamma,
145  const SUMOReal theta);
146 
148  virtual ~ROLogitCalculator();
149 
150  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const;
151 
153  void calculateProbabilities(const ROVehicle* const veh, std::vector<RORoute*> alternatives);
154 
155 private:
157  SUMOReal getBetaForCLogit(const std::vector<RORoute*> alternatives) const;
158 
160  SUMOReal getThetaForCLogit(const std::vector<RORoute*> alternatives) const;
161 
162 private:
165 
168 
171 
173  std::map<const RORoute*, SUMOReal> myCommonalities;
174 
175 private:
178 
179 };
180 
181 
182 #endif
183 
184 /****************************************************************************/
185