TraDemGen Logo  1.00.0
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
DemandCharacteristics.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/stdair_basic_types.hpp>
9 // TraDemGen
12 
13 namespace TRADEMGEN {
14 
15  // /////////////////////////////////////////////////////
17  : _arrivalPattern (ArrivalPatternCumulativeDistribution_T()),
18  _posProbabilityMass (POSProbabilityMassFunction_T()),
19  _channelProbabilityMass (ChannelProbabilityMassFunction_T()),
20  _tripTypeProbabilityMass (TripTypeProbabilityMassFunction_T()),
21  _stayDurationProbabilityMass (StayDurationProbabilityMassFunction_T()),
22  _frequentFlyerProbabilityMass (FrequentFlyerProbabilityMassFunction_T()),
23  _changeFeeProb (0.5), _changeFeeDisutility (0.0),
24  _nonRefundableProb (0.5), _nonRefundableDisutility (0.0),
25  _preferredDepartureTimeCumulativeDistribution (PreferredDepartureTimeContinuousDistribution_T()),
26  _minWTP (stdair::WTP_T()), _frat5Pattern (DEFAULT_FRAT5_PATTERN),
27  _valueOfTimeCumulativeDistribution (ValueOfTimeContinuousDistribution_T()) {
28  }
29 
30  // /////////////////////////////////////////////////////
33  : _arrivalPattern (iDC._arrivalPattern),
34  _posProbabilityMass (iDC._posProbabilityMass),
35  _channelProbabilityMass (iDC._channelProbabilityMass),
36  _tripTypeProbabilityMass (iDC._tripTypeProbabilityMass),
37  _stayDurationProbabilityMass (iDC._stayDurationProbabilityMass),
38  _frequentFlyerProbabilityMass (iDC._frequentFlyerProbabilityMass),
39  _changeFeeProb (iDC._changeFeeProb),
40  _changeFeeDisutility (iDC._changeFeeDisutility),
41  _nonRefundableProb (iDC._nonRefundableProb),
42  _nonRefundableDisutility (iDC._nonRefundableDisutility),
43  _preferredDepartureTimeCumulativeDistribution (iDC._preferredDepartureTimeCumulativeDistribution),
44  _minWTP (iDC._minWTP), _frat5Pattern (iDC._frat5Pattern),
45  _valueOfTimeCumulativeDistribution (iDC._valueOfTimeCumulativeDistribution) {
46  }
47 
48  // /////////////////////////////////////////////////////
51  const POSProbabilityMassFunction_T& iPOSProbMass,
52  const ChannelProbabilityMassFunction_T& iChannelProbMass,
53  const TripTypeProbabilityMassFunction_T& iTripTypeProbMass,
54  const StayDurationProbabilityMassFunction_T& iStayDurationProbMass,
55  const FrequentFlyerProbabilityMassFunction_T& iFrequentFlyerProbMass,
56  const stdair::ChangeFeesRatio_T& iChangeFeeProb,
57  const stdair::Disutility_T& iChangeFeeDisutility,
58  const stdair::NonRefundableRatio_T& iNonRefundableProb,
59  const stdair::Disutility_T& iNonRefundableDisutility,
60  const PreferredDepartureTimeContinuousDistribution_T& iPreferredDepartureTimeContinuousDistribution,
61  const stdair::WTP_T& iMinWTP,
62  const ValueOfTimeContinuousDistribution_T& iValueOfTimeContinuousDistribution)
63  : _arrivalPattern (iArrivalPattern),
64  _posProbabilityMass (iPOSProbMass),
65  _channelProbabilityMass (iChannelProbMass),
66  _tripTypeProbabilityMass (iTripTypeProbMass),
67  _stayDurationProbabilityMass (iStayDurationProbMass),
68  _frequentFlyerProbabilityMass (iFrequentFlyerProbMass),
69  _changeFeeProb (iChangeFeeProb),
70  _changeFeeDisutility (iChangeFeeDisutility),
71  _nonRefundableProb (iNonRefundableProb),
72  _nonRefundableDisutility (iNonRefundableDisutility),
73  _preferredDepartureTimeCumulativeDistribution (iPreferredDepartureTimeContinuousDistribution),
74  _minWTP (iMinWTP), _frat5Pattern (DEFAULT_FRAT5_PATTERN),
75  _valueOfTimeCumulativeDistribution (iValueOfTimeContinuousDistribution) {
76  }
77 
78  // /////////////////////////////////////////////////////
80  }
81 
82  // /////////////////////////////////////////////////////
83  const stdair::AirportCode_T& DemandCharacteristics::
84  getPOSValue (const stdair::Probability_T& iCumulativeProbability) const {
85  return _posProbabilityMass.getValue (iCumulativeProbability);
86  }
87 
88  // /////////////////////////////////////////////////////
90  checkPOSValue (const stdair::AirportCode_T& iPOS) const {
91  return _posProbabilityMass.checkValue (iPOS);
92  }
93 
94  // /////////////////////////////////////////////////////
95  const std::string DemandCharacteristics::describe() const {
96  std::ostringstream oStr;
97 
98  //
99  oStr << "****************** Demand characteristics ******************"
100  << std::endl;
101  oStr << "Arrival pattern (days from departure, proportion): ";
102  oStr << _arrivalPattern.displayCumulativeDistribution() << std::endl;
103  oStr << "POS probability mass (POS, propotion): ";
105  << std::endl;
106  oStr << "Channel probability mass (channel, propotion): ";
108  << std::endl;
109  oStr << "Trip type probability mass (trip type, propotion): ";
111  << std::endl;
112  oStr << "Stay duration probability mass (number of days, propotion): ";
114  << std::endl;
115  oStr << "Frequent flyer probability mass (frequent flyer, propotion): ";
117  << std::endl;
118  oStr << "Change fee acceptation probability: "
119  << _changeFeeProb
120  << std::endl;
121  oStr << "Change fee disutility: "
123  << std::endl;
124  oStr << "Non refundable acceptation probability: "
126  << std::endl;
127  oStr << "Non refundable disutility: "
129  << std::endl;
130  oStr << "Preferred departure time cumulative distribution (time, proportion: ";
132  oStr << "min WTP: " << _minWTP << std::endl;
133  oStr << "Value of time cumulative distribution (value of time, proportion: ";
135  << std::endl;
136 
137 
138  return oStr.str();
139  }
140 
141 }
142