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
/****************************************************************************/
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
// ===========================================================================
52
class
ROCostCalculator
{
53
public
:
54
static
ROCostCalculator
&
getCalculator
();
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
{
72
return
mySkipRouteCalculation
;
73
}
74
75
protected
:
77
ROCostCalculator
();
78
80
virtual
~ROCostCalculator
();
81
82
private
:
83
static
ROCostCalculator
*
myInstance
;
84
86
unsigned
int
myMaxRouteNumber
;
87
89
bool
myKeepRoutes
;
90
92
bool
mySkipRouteCalculation
;
93
94
};
95
96
101
class
ROGawronCalculator
:
public
ROCostCalculator
{
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
:
125
const
SUMOReal
myBeta
;
126
128
const
SUMOReal
myA
;
129
130
private
:
132
ROGawronCalculator
&
operator=
(
const
ROGawronCalculator
& s);
133
134
};
135
136
141
class
ROLogitCalculator
:
public
ROCostCalculator
{
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
:
164
const
SUMOReal
myBeta
;
165
167
const
SUMOReal
myGamma
;
168
170
const
SUMOReal
myTheta
;
171
173
std::map<const RORoute*, SUMOReal>
myCommonalities
;
174
175
private
:
177
ROLogitCalculator
&
operator=
(
const
ROLogitCalculator
& s);
178
179
};
180
181
182
#endif
183
184
/****************************************************************************/
185
build
buildd
sumo-0.18~dfsg
src
router
ROCostCalculator.h
Generated on Wed Oct 23 2013 01:15:12 for SUMO - Simulation of Urban MObility by
1.8.4