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
RODUAFrame.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Sets and checks options for dua-routing
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2001-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
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include <iostream>
34
#include <fstream>
35
#include <ctime>
36
#include <
utils/options/OptionsCont.h
>
37
#include <
utils/options/Option.h
>
38
#include <
utils/common/MsgHandler.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
#include <
utils/common/ToString.h
>
41
#include "
RODUAFrame.h
"
42
#include <
router/ROFrame.h
>
43
#include <
utils/common/RandHelper.h
>
44
#include <
utils/common/SystemFrame.h
>
45
#include <
utils/common/SUMOVehicleParameter.h
>
46
47
#ifdef CHECK_MEMORY_LEAKS
48
#include <
foreign/nvwa/debug_new.h
>
49
#endif // CHECK_MEMORY_LEAKS
50
51
52
// ===========================================================================
53
// method definitions
54
// ===========================================================================
55
void
56
RODUAFrame::fillOptions
() {
57
OptionsCont
& oc =
OptionsCont::getOptions
();
58
oc.
addCallExample
(
"-c <CONFIGURATION>"
,
"run routing with options from file"
);
59
60
// insert options sub-topics
61
SystemFrame::addConfigurationOptions
(oc);
// fill this subtopic, too
62
oc.
addOptionSubTopic
(
"Input"
);
63
oc.
addOptionSubTopic
(
"Output"
);
64
oc.
addOptionSubTopic
(
"Processing"
);
65
oc.
addOptionSubTopic
(
"Defaults"
);
66
oc.
addOptionSubTopic
(
"Time"
);
67
SystemFrame::addReportOptions
(oc);
// fill this subtopic, too
68
69
// insert options
70
ROFrame::fillOptions
(oc,
true
);
71
addImportOptions
();
72
addDUAOptions
();
73
// add rand options
74
RandHelper::insertRandOptions
();
75
}
76
77
78
void
79
RODUAFrame::addImportOptions
() {
80
OptionsCont
& oc =
OptionsCont::getOptions
();
81
// register import options
82
oc.
doRegister
(
"trip-files"
,
't'
,
new
Option_FileName
());
83
oc.
addSynonyme
(
"trips"
,
"trip-files"
);
84
oc.
addSynonyme
(
"trip-defs"
,
"trip-files"
,
true
);
85
oc.
addDescription
(
"trip-files"
,
"Input"
,
"Read trip-definitions from FILE(s)"
);
86
87
oc.
doRegister
(
"route-files"
,
'r'
,
new
Option_FileName
());
88
oc.
addSynonyme
(
"route-files"
,
"sumo-input"
,
true
);
89
oc.
addSynonyme
(
"route-files"
,
"sumo"
,
true
);
90
oc.
addDescription
(
"route-files"
,
"Input"
,
"Read sumo-routes from FILE(s)"
);
91
92
// register further processing options
93
// ! The subtopic "Processing" must be initialised earlier !
94
oc.
doRegister
(
"weights.expand"
,
new
Option_Bool
(
false
));
95
oc.
addSynonyme
(
"weights.expand"
,
"expand-weights"
,
true
);
96
oc.
addDescription
(
"weights.expand"
,
"Processing"
,
"Expand weights behind the simulation's end"
);
97
}
98
99
100
void
101
RODUAFrame::addDUAOptions
() {
102
OptionsCont
& oc =
OptionsCont::getOptions
();
103
// register Gawron's DUE-settings
104
oc.
doRegister
(
"gawron.beta"
,
new
Option_Float
(
SUMOReal
(0.3)));
105
oc.
addSynonyme
(
"gawron.beta"
,
"gBeta"
,
true
);
106
oc.
addDescription
(
"gawron.beta"
,
"Processing"
,
"Use FLOAT as Gawron's beta"
);
107
108
oc.
doRegister
(
"gawron.a"
,
new
Option_Float
(
SUMOReal
(0.05)));
109
oc.
addSynonyme
(
"gawron.a"
,
"gA"
,
true
);
110
oc.
addDescription
(
"gawron.a"
,
"Processing"
,
"Use FLOAT as Gawron's a"
);
111
112
oc.
doRegister
(
"exit-times"
,
new
Option_Bool
(
false
));
113
oc.
addDescription
(
"exit-times"
,
"Output"
,
"Write exit times (weights) for each edge"
);
114
115
oc.
doRegister
(
"keep-all-routes"
,
new
Option_Bool
(
false
));
116
oc.
addDescription
(
"keep-all-routes"
,
"Processing"
,
"Save routes with near zero probability"
);
117
118
oc.
doRegister
(
"skip-new-routes"
,
new
Option_Bool
(
false
));
119
oc.
addDescription
(
"skip-new-routes"
,
"Processing"
,
"Only reuse routes from input, do not calculate new ones"
);
120
121
oc.
doRegister
(
"logit"
,
new
Option_Bool
(
false
));
// deprecated
122
oc.
addDescription
(
"logit"
,
"Processing"
,
"Use c-logit model (deprecated in favor of --route-choice-method logit)"
);
123
124
oc.
doRegister
(
"route-choice-method"
,
new
Option_String
(
"gawron"
));
125
oc.
addDescription
(
"route-choice-method"
,
"Processing"
,
"Choose a route choice method: gawron, logit, or lohse"
);
126
127
oc.
doRegister
(
"logit.beta"
,
new
Option_Float
(
SUMOReal
(-1)));
128
oc.
addSynonyme
(
"logit.beta"
,
"lBeta"
,
true
);
129
oc.
addDescription
(
"logit.beta"
,
"Processing"
,
"Use FLOAT as logit's beta"
);
130
131
oc.
doRegister
(
"logit.gamma"
,
new
Option_Float
(
SUMOReal
(1)));
132
oc.
addSynonyme
(
"logit.gamma"
,
"lGamma"
,
true
);
133
oc.
addDescription
(
"logit.gamma"
,
"Processing"
,
"Use FLOAT as logit's gamma"
);
134
135
oc.
doRegister
(
"logit.theta"
,
new
Option_Float
(
SUMOReal
(-1)));
136
oc.
addSynonyme
(
"logit.theta"
,
"lTheta"
,
true
);
137
oc.
addDescription
(
"logit.theta"
,
"Processing"
,
"Use FLOAT as logit's theta (negative values mean auto-estimation)"
);
138
139
}
140
141
142
bool
143
RODUAFrame::checkOptions
() {
144
OptionsCont
& oc =
OptionsCont::getOptions
();
145
bool
ok =
ROFrame::checkOptions
(oc);
146
147
SUMOVehicleParameter
p;
148
std::string error;
149
if
(oc.
isSet
(
"departlane"
) && !
SUMOVehicleParameter::parseDepartLane
(oc.
getString
(
"departlane"
),
"option"
,
"departlane"
, p.
departLane
, p.
departLaneProcedure
, error)) {
150
WRITE_ERROR
(error);
151
ok =
false
;
152
}
153
if
(oc.
isSet
(
"departpos"
) && !
SUMOVehicleParameter::parseDepartPos
(oc.
getString
(
"departpos"
),
"option"
,
"departpos"
, p.
departPos
, p.
departPosProcedure
, error)) {
154
WRITE_ERROR
(error);
155
ok =
false
;
156
}
157
if
(oc.
isSet
(
"departspeed"
) && !
SUMOVehicleParameter::parseDepartSpeed
(oc.
getString
(
"departspeed"
),
"option"
,
"departspeed"
, p.
departSpeed
, p.
departSpeedProcedure
, error)) {
158
WRITE_ERROR
(error);
159
ok =
false
;
160
}
161
if
(oc.
isSet
(
"arrivallane"
) && !
SUMOVehicleParameter::parseArrivalLane
(oc.
getString
(
"arrivallane"
),
"option"
,
"arrivallane"
, p.
arrivalLane
, p.
arrivalLaneProcedure
, error)) {
162
WRITE_ERROR
(error);
163
ok =
false
;
164
}
165
if
(oc.
isSet
(
"arrivalpos"
) && !
SUMOVehicleParameter::parseArrivalPos
(oc.
getString
(
"arrivalpos"
),
"option"
,
"arrivalpos"
, p.
arrivalPos
, p.
arrivalPosProcedure
, error)) {
166
WRITE_ERROR
(error);
167
ok =
false
;
168
}
169
if
(oc.
isSet
(
"arrivalspeed"
) && !
SUMOVehicleParameter::parseArrivalSpeed
(oc.
getString
(
"arrivalspeed"
),
"option"
,
"arrivalspeed"
, p.
arrivalSpeed
, p.
arrivalSpeedProcedure
, error)) {
170
WRITE_ERROR
(error);
171
ok =
false
;
172
}
173
174
if
(oc.
getString
(
"routing-algorithm"
) !=
"dijkstra"
&& oc.
getString
(
"weight-attribute"
) !=
"traveltime"
) {
175
WRITE_ERROR
(
"Routing algorithm '"
+ oc.
getString
(
"routing-algorithm"
) +
"' does not support weight-attribute '"
+ oc.
getString
(
"weight-attribute"
) +
"'."
);
176
return
false
;
177
}
178
179
if
(oc.
getString
(
"route-choice-method"
) !=
"gawron"
&& oc.
getString
(
"route-choice-method"
) !=
"logit"
) {
180
WRITE_ERROR
(
"Invalid route choice method '"
+ oc.
getString
(
"route-choice-method"
) +
"'."
);
181
return
false
;
182
}
183
184
if
(oc.
getBool
(
"logit"
)) {
185
WRITE_WARNING
(
"The --logit option is deprecated, please use --route-choice-method logit."
);
186
oc.
set
(
"route-choice-method"
,
"logit"
);
187
}
188
return
ok;
189
}
190
191
192
193
/****************************************************************************/
194
tmp
buildd
sumo-0.21.0+dfsg
src
duarouter
RODUAFrame.cpp
Generated on Thu Nov 20 2014 19:49:58 for SUMO - Simulation of Urban MObility by
1.8.1.2