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 /****************************************************************************/
9 // Calculators for route costs and probabilities
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2002-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef ROCostCalculator_h
23 #define ROCostCalculator_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <map>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class RORoute;
43 class ROVehicle;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
54 public:
56 
57  static void cleanup();
58 
59  virtual void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const = 0;
60 
62  virtual void calculateProbabilities(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time) = 0;
63 
64  unsigned int getMaxRouteNumber() const {
65  return myMaxRouteNumber;
66  }
67 
68  bool keepRoutes() const {
69  return myKeepRoutes;
70  }
71 
72  bool skipRouteCalculation() const {
74  }
75 
76 protected:
79 
81  virtual ~ROCostCalculator();
82 
83 private:
85 
87  unsigned int myMaxRouteNumber;
88 
91 
94 
95 };
96 
97 
103 public:
105  ROGawronCalculator(const SUMOReal beta, const SUMOReal a);
106 
108  virtual ~ROGawronCalculator();
109 
110  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const;
111 
113  void calculateProbabilities(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time);
114 
115 private:
118  SUMOReal gawronF(const SUMOReal pdr, const SUMOReal pds, const SUMOReal x) const;
119 
122  SUMOReal gawronG(const SUMOReal a, const SUMOReal x) const;
123 
124 private:
127 
129  const SUMOReal myA;
130 
131 private:
134 
135 };
136 
137 
143 public:
145  ROLogitCalculator(const SUMOReal beta, const SUMOReal gamma,
146  const SUMOReal theta);
147 
149  virtual ~ROLogitCalculator();
150 
151  void setCosts(RORoute* route, const SUMOReal costs, const bool isActive = false) const;
152 
154  void calculateProbabilities(std::vector<RORoute*> alternatives, const ROVehicle* const veh, const SUMOTime time);
155 
156 private:
158  SUMOReal getBetaForCLogit(const std::vector<RORoute*> alternatives) const;
159 
161  SUMOReal getThetaForCLogit(const std::vector<RORoute*> alternatives) const;
162 
163 private:
166 
169 
172 
174  std::map<const RORoute*, SUMOReal> myCommonalities;
175 
176 private:
179 
180 };
181 
182 
183 #endif
184 
185 /****************************************************************************/
186 
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 "Dynamic User Equilibria...".
A vehicle as used by router.
Definition: ROVehicle.h:59
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 "Dynamic User Equilibria...".
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'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's route.
Definition: RORoute.h:61
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