1.00.16
C++ Simulated Travel Demand Generation Library
Toggle main menu visibility
Loading...
Searching...
No Matches
DemandStruct.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// StdAir
8
#include <stdair/basic/BasConst_Inventory.hpp>
9
#include <stdair/basic/BasConst_Period_BOM.hpp>
10
#include <stdair/service/Logger.hpp>
11
// TRADEMGEN
12
#include <
trademgen/TRADEMGEN_Types.hpp
>
13
#include <
trademgen/bom/DemandStruct.hpp
>
14
15
namespace
TRADEMGEN
{
16
17
// ////////////////////////////////////////////////////////////////////
18
DemandStruct::DemandStruct
()
19
:
_dateRange
(
stdair
::BOOST_DEFAULT_DATE_PERIOD),
20
_dow
(
stdair
::DEFAULT_DOW_STRING),
21
_prefCabin
(
stdair
::DEFAULT_CABIN_CODE),
22
_itHours
(0),
_itMinutes
(0),
_itSeconds
(0),
_itFFCode
(
""
) {
23
}
24
25
// ////////////////////////////////////////////////////////////////////
26
DemandStruct::~DemandStruct
() {
27
}
28
29
// ////////////////////////////////////////////////////////////////////
30
stdair::Date_T
DemandStruct::getDate
()
const
{
31
return
stdair::Date_T (
_itYear
,
_itMonth
,
_itDay
);
32
}
33
34
// ////////////////////////////////////////////////////////////////////
35
stdair::Duration_T
DemandStruct::getTime
()
const
{
36
return
boost::posix_time::hours (
_itHours
)
37
+ boost::posix_time::minutes (
_itMinutes
)
38
+ boost::posix_time::seconds (
_itSeconds
);
39
}
40
41
// ////////////////////////////////////////////////////////////////////
42
const
std::string
DemandStruct::describe
()
const
{
43
std::ostringstream ostr;
44
ostr <<
_dateRange
<<
" - "
<<
_dow
45
<<
" "
<<
_origin
<<
"-"
<<
_destination
46
<<
" "
<<
_prefCabin
47
<<
", N("
<<
_demandMean
<<
", "
<<
_demandStdDev
<<
"); "
;
48
49
unsigned
short
idx = 0;
50
for
(POSProbabilityMassFunction_T::const_iterator it =
_posProbDist
.begin();
51
it !=
_posProbDist
.end(); ++it, ++idx) {
52
const
stdair::AirportCode_T& lPosCode = it->first;
53
const
stdair::Probability_T& lPosProbMass = it->second;
54
if
(idx != 0) {
55
ostr <<
", "
;
56
}
57
ostr << lPosCode <<
":"
<< lPosProbMass;
58
}
59
ostr <<
"; "
;
60
61
idx = 0;
62
for
(ChannelProbabilityMassFunction_T::const_iterator it =
63
_channelProbDist
.begin();
64
it !=
_channelProbDist
.end(); ++it, ++idx) {
65
const
stdair::ChannelLabel_T lChannelCode = it->first;
66
const
stdair::Probability_T& lChannelProbMass = it->second;
67
if
(idx != 0) {
68
ostr <<
", "
;
69
}
70
ostr << lChannelCode <<
":"
<< lChannelProbMass;
71
}
72
ostr <<
"; "
;
73
74
idx = 0;
75
for
(TripTypeProbabilityMassFunction_T::const_iterator it =
76
_tripProbDist
.begin();
77
it !=
_tripProbDist
.end(); ++it, ++idx) {
78
const
stdair::TripType_T lTripCode = it->first;
79
const
stdair::Probability_T& lTripProbMass = it->second;
80
if
(idx != 0) {
81
ostr <<
", "
;
82
}
83
ostr << lTripCode <<
":"
<< lTripProbMass;
84
}
85
ostr <<
"; "
;
86
87
idx = 0;
88
for
(StayDurationProbabilityMassFunction_T::const_iterator it =
89
_stayProbDist
.begin();
90
it !=
_stayProbDist
.end(); ++it, ++idx) {
91
const
stdair::DayDuration_T& lStayDuration = it->first;
92
const
stdair::Probability_T& lStayProbMass = it->second;
93
if
(idx != 0) {
94
ostr <<
", "
;
95
}
96
ostr << lStayDuration <<
":"
<< lStayProbMass;
97
}
98
ostr <<
"; "
;
99
100
idx = 0;
101
for
(FrequentFlyerProbabilityMassFunction_T::const_iterator it =
102
_ffProbDist
.begin();
103
it !=
_ffProbDist
.end(); ++it, ++idx) {
104
const
stdair::FrequentFlyer_T lFFCode = it->first;
105
const
stdair::Probability_T& lFFProbMass = it->second;
106
if
(idx != 0) {
107
ostr <<
", "
;
108
}
109
ostr << lFFCode <<
":"
<< lFFProbMass;
110
}
111
ostr <<
"; "
;
112
113
ostr <<
_changeFeeProb
<<
"; "
;
114
115
ostr <<
"; "
;
116
117
ostr <<
_nonRefundableProb
<<
"; "
;
118
119
idx = 0;
120
for
(PreferredDepartureTimeContinuousDistribution_T::const_iterator it =
121
_prefDepTimeProbDist
.begin();
122
it !=
_prefDepTimeProbDist
.end(); ++it, ++idx) {
123
const
stdair::IntDuration_T& lPrefDepTime = it->first;
124
const
stdair::Probability_T& lPrefDepTimeProbMass = it->second;
125
if
(idx != 0) {
126
ostr <<
", "
;
127
}
128
ostr << lPrefDepTime <<
":"
<< lPrefDepTimeProbMass;
129
}
130
ostr <<
"; "
;
131
132
ostr <<
_minWTP
<<
"; "
;
133
134
idx = 0;
135
for
(ValueOfTimeContinuousDistribution_T::const_iterator it =
136
_timeValueProbDist
.begin();
137
it !=
_timeValueProbDist
.end(); ++it, ++idx) {
138
const
stdair::PriceValue_T& lTimeValue = it->first;
139
const
stdair::Probability_T& lTimeValueProbMass = it->second;
140
if
(idx != 0) {
141
ostr <<
", "
;
142
}
143
ostr << lTimeValue <<
":"
<< lTimeValueProbMass;
144
}
145
ostr <<
"; "
;
146
147
idx = 0;
148
for
(ArrivalPatternCumulativeDistribution_T::const_iterator it =
149
_dtdProbDist
.begin(); it !=
_dtdProbDist
.end(); ++it, ++idx) {
150
const
stdair::FloatDuration_T& lDTD = it->first;
151
const
stdair::Probability_T& lDTDProbMass = it->second;
152
if
(idx != 0) {
153
ostr <<
", "
;
154
}
155
ostr << lDTD <<
":"
<< lDTDProbMass;
156
}
157
ostr <<
"; "
;
158
159
return
ostr.str();
160
}
161
162
}
TRADEMGEN_Types.hpp
DemandStruct.hpp
TRADEMGEN
Definition
BasConst.cpp:10
stdair
Forward declarations.
Definition
CategoricalAttribute.hpp:14
TRADEMGEN::DemandStruct::_dtdProbDist
ArrivalPatternCumulativeDistribution_T _dtdProbDist
Definition
DemandStruct.hpp:70
TRADEMGEN::DemandStruct::_demandMean
stdair::MeanValue_T _demandMean
Definition
DemandStruct.hpp:56
TRADEMGEN::DemandStruct::_nonRefundableProb
stdair::NonRefundableRatio_T _nonRefundableProb
Definition
DemandStruct.hpp:60
TRADEMGEN::DemandStruct::_demandStdDev
stdair::StdDevValue_T _demandStdDev
Definition
DemandStruct.hpp:57
TRADEMGEN::DemandStruct::_timeValueProbDist
ValueOfTimeContinuousDistribution_T _timeValueProbDist
Definition
DemandStruct.hpp:69
TRADEMGEN::DemandStruct::_channelProbDist
ChannelProbabilityMassFunction_T _channelProbDist
Definition
DemandStruct.hpp:63
TRADEMGEN::DemandStruct::_itDay
unsigned int _itDay
Definition
DemandStruct.hpp:79
TRADEMGEN::DemandStruct::describe
const std::string describe() const
Definition
DemandStruct.cpp:42
TRADEMGEN::DemandStruct::~DemandStruct
~DemandStruct()
Definition
DemandStruct.cpp:26
TRADEMGEN::DemandStruct::_itMinutes
long _itMinutes
Definition
DemandStruct.hpp:83
TRADEMGEN::DemandStruct::getDate
stdair::Date_T getDate() const
Definition
DemandStruct.cpp:30
TRADEMGEN::DemandStruct::_itMonth
unsigned int _itMonth
Definition
DemandStruct.hpp:78
TRADEMGEN::DemandStruct::_posProbDist
POSProbabilityMassFunction_T _posProbDist
Definition
DemandStruct.hpp:62
TRADEMGEN::DemandStruct::_ffProbDist
FrequentFlyerProbabilityMassFunction_T _ffProbDist
Definition
DemandStruct.hpp:66
TRADEMGEN::DemandStruct::_dateRange
stdair::DatePeriod_T _dateRange
Definition
DemandStruct.hpp:51
TRADEMGEN::DemandStruct::_stayProbDist
StayDurationProbabilityMassFunction_T _stayProbDist
Definition
DemandStruct.hpp:65
TRADEMGEN::DemandStruct::_changeFeeProb
stdair::ChangeFeesRatio_T _changeFeeProb
Definition
DemandStruct.hpp:58
TRADEMGEN::DemandStruct::DemandStruct
DemandStruct()
Definition
DemandStruct.cpp:18
TRADEMGEN::DemandStruct::_minWTP
stdair::WTP_T _minWTP
Definition
DemandStruct.hpp:68
TRADEMGEN::DemandStruct::_itFFCode
stdair::FrequentFlyer_T _itFFCode
Definition
DemandStruct.hpp:99
TRADEMGEN::DemandStruct::_tripProbDist
TripTypeProbabilityMassFunction_T _tripProbDist
Definition
DemandStruct.hpp:64
TRADEMGEN::DemandStruct::_prefDepTimeProbDist
PreferredDepartureTimeContinuousDistribution_T _prefDepTimeProbDist
Definition
DemandStruct.hpp:67
TRADEMGEN::DemandStruct::_prefCabin
stdair::CabinCode_T _prefCabin
Definition
DemandStruct.hpp:55
TRADEMGEN::DemandStruct::getTime
stdair::Duration_T getTime() const
Definition
DemandStruct.cpp:35
TRADEMGEN::DemandStruct::_itHours
long _itHours
Definition
DemandStruct.hpp:82
TRADEMGEN::DemandStruct::_origin
stdair::AirportCode_T _origin
Definition
DemandStruct.hpp:53
TRADEMGEN::DemandStruct::_itYear
unsigned int _itYear
Definition
DemandStruct.hpp:77
TRADEMGEN::DemandStruct::_itSeconds
long _itSeconds
Definition
DemandStruct.hpp:84
TRADEMGEN::DemandStruct::_dow
stdair::DoWStruct _dow
Definition
DemandStruct.hpp:52
TRADEMGEN::DemandStruct::_destination
stdair::AirportCode_T _destination
Definition
DemandStruct.hpp:54
Generated on
for TraDemGen by
1.17.0