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(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time) = 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(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time);
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(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time);
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 
bool skipRouteCalculation() const
const SUMOReal myA
gawron a - value
const SUMOReal myBeta
logit beta - value
ROGawronCalculator & operator=(const ROGawronCalculator &s)
invalidated assignment operator
Abstract base class providing static factory method.
bool myKeepRoutes
Information whether all routes should be saved.
SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const
Performs the gawron - g() function From &quot;Dynamic User Equilibria...&quot;.
A vehicle as used by router.
Definition: ROVehicle.h:58
virtual ~ROCostCalculator()
Destructor.
ROCostCalculator()
Constructor.
virtual void calculateProbabilities(std::vector< RORoute * > alternatives, const ROVehicle *const veh, const SUMOTime time)=0
calculate the probabilities in the logit model
void setCosts(RORoute *route, const SUMOReal costs, const bool isActive=false) const
ROLogitCalculator & operator=(const ROLogitCalculator &s)
invalidated assignment operator
void calculateProbabilities(std::vector< RORoute * > alternatives, const ROVehicle *const veh, const SUMOTime time)
calculate the probabilities
bool mySkipRouteCalculation
Information whether new routes should be calculated.
virtual ~ROGawronCalculator()
Destructor.
SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const
Performs the gawron - f() function From &quot;Dynamic User Equilibria...&quot;.
ROGawronCalculator(const SUMOReal beta, const SUMOReal a)
Constructor.
unsigned int myMaxRouteNumber
The maximum route alternatives number.
const SUMOReal myGamma
logit gamma - value
void calculateProbabilities(std::vector< RORoute * > alternatives, const ROVehicle *const veh, const SUMOTime time)
calculate the probabilities in the logit model
bool keepRoutes() const
ROLogitCalculator(const SUMOReal beta, const SUMOReal gamma, const SUMOReal theta)
Constructor.
unsigned int getMaxRouteNumber() const
Cost calculation with c-logit or logit method.
Cost calculation with Gawron&#39;s method.
const SUMOReal myTheta
logit theta - value
static void cleanup()
SUMOReal getBetaForCLogit(const std::vector< RORoute * > alternatives) const
calculate the scaling factor in the logit model
#define SUMOReal
Definition: config.h:215
static ROCostCalculator & getCalculator()
std::map< const RORoute *, SUMOReal > myCommonalities
The route commonality factors for c-logit.
static ROCostCalculator * myInstance
const SUMOReal myBeta
gawron beta - value
virtual void setCosts(RORoute *route, const SUMOReal costs, const bool isActive=false) const =0
virtual ~ROLogitCalculator()
Destructor.
A complete router&#39;s route.
Definition: RORoute.h:59
SUMOReal getThetaForCLogit(const std::vector< RORoute * > alternatives) const
calculate the scaling factor in the logit model
void setCosts(RORoute *route, const SUMOReal costs, const bool isActive=false) const