SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
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
// ===========================================================================
53
class
ROCostCalculator
{
54
public
:
55
static
ROCostCalculator
&
getCalculator
();
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
{
73
return
mySkipRouteCalculation
;
74
}
75
76
protected
:
78
ROCostCalculator
();
79
81
virtual
~ROCostCalculator
();
82
83
private
:
84
static
ROCostCalculator
*
myInstance
;
85
87
unsigned
int
myMaxRouteNumber
;
88
90
bool
myKeepRoutes
;
91
93
bool
mySkipRouteCalculation
;
94
95
};
96
97
102
class
ROGawronCalculator
:
public
ROCostCalculator
{
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
:
126
const
SUMOReal
myBeta
;
127
129
const
SUMOReal
myA
;
130
131
private
:
133
ROGawronCalculator
&
operator=
(
const
ROGawronCalculator
& s);
134
135
};
136
137
142
class
ROLogitCalculator
:
public
ROCostCalculator
{
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
:
165
const
SUMOReal
myBeta
;
166
168
const
SUMOReal
myGamma
;
169
171
const
SUMOReal
myTheta
;
172
174
std::map<const RORoute*, SUMOReal>
myCommonalities
;
175
176
private
:
178
ROLogitCalculator
&
operator=
(
const
ROLogitCalculator
& s);
179
180
};
181
182
183
#endif
184
185
/****************************************************************************/
186
tmp
buildd
sumo-0.21.0+dfsg
src
router
ROCostCalculator.h
Generated on Thu Nov 20 2014 19:49:58 for SUMO - Simulation of Urban MObility by
1.8.1.2