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.sourceforge.net/
11 // Copyright (C) 2001-2012 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 protected:
66 
68  virtual ~ROCostCalculator();
69 
70 private:
72 
73 };
74 
75 
81 public:
83  ROGawronCalculator(const SUMOReal beta, const SUMOReal a);
84 
86  virtual ~ROGawronCalculator();
87 
88  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive=false) const;
89 
91  void calculateProbabilities(const ROVehicle* const veh, std::vector<RORoute*> alternatives);
92 
93 private:
96  SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const;
97 
100  SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const;
101 
102 private:
105 
107  const SUMOReal myA;
108 
109 };
110 
111 
117 public:
119  ROLogitCalculator(const SUMOReal beta, const SUMOReal gamma,
120  const SUMOReal theta);
121 
123  virtual ~ROLogitCalculator();
124 
125  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive=false) const;
126 
128  void calculateProbabilities(const ROVehicle* const veh, std::vector<RORoute*> alternatives);
129 
130 private:
132  SUMOReal getBetaForCLogit(const std::vector<RORoute*> alternatives) const;
133 
135  SUMOReal getThetaForCLogit(const std::vector<RORoute*> alternatives) const;
136 
137 private:
140 
143 
146 
148  std::map<const RORoute*, SUMOReal> myCommonalities;
149 
150 };
151 
152 
153 #endif
154 
155 /****************************************************************************/
156