TraDemGen Logo  1.00.0
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
DemandStream.hpp
Go to the documentation of this file.
1 #ifndef __TRADEMGEN_BOM_DEMANDSTREAM_HPP
2 #define __TRADEMGEN_BOM_DEMANDSTREAM_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // StdAir
8 #include <stdair/bom/BomAbstract.hpp>
9 #include <stdair/bom/BookingRequestTypes.hpp>
10 #include <stdair/basic/RandomGeneration.hpp>
11 #include <stdair/basic/DemandGenerationMethod.hpp>
12 // TraDemGen
18 
20 namespace stdair {
21  class FacBomManager;
22  template <typename BOM> class FacBom;
23 }
24 
25 namespace TRADEMGEN {
26 
30  class DemandStream : public stdair::BomAbstract {
31  template <typename BOM> friend class stdair::FacBom;
32  friend class stdair::FacBomManager;
33 
34  public:
35  // ////////// Type definitions ////////////
40 
41 
42  public:
43  // ///////////// Getters ///////////
45  const Key_T& getKey() const {
46  return _key;
47  }
48 
50  BomAbstract* const getParent() const {
51  return _parent;
52  }
53 
55  const stdair::AirportCode_T& getOrigin() const {
56  return _key.getOrigin();
57  }
58 
60  const stdair::AirportCode_T& getDestination() const {
61  return _key.getDestination();
62  }
63 
65  const stdair::Date_T& getPreferredDepartureDate() const {
67  }
68 
70  const stdair::CabinCode_T& getPreferredCabin() const {
71  return _key.getPreferredCabin();
72  }
73 
75  const stdair::HolderMap_T& getHolderMap() const {
76  return _holderMap;
77  }
78 
82  }
83 
86  return _demandDistribution;
87  }
88 
90  const stdair::NbOfRequests_T& getTotalNumberOfRequestsToBeGenerated() const{
92  }
93 
95  const stdair::NbOfRequests_T& getMeanNumberOfRequests() const {
97  }
98 
100  const stdair::StdDevValue_T& getStdDevNumberOfRequests() const {
102  }
103 
105  const stdair::Count_T& getNumberOfRequestsGeneratedSoFar() const {
107  }
108 
110  const stdair::Disutility_T& getChangeFeeDisutility() const {
112  }
113 
115  const stdair::Disutility_T& getNonRefundableDisutility() const {
117  }
118 
124  return _posProMass;
125  }
126 
127 
128  public:
129  // //////////////// Setters //////////////////
131  void setNumberOfRequestsGeneratedSoFar (const stdair:: Count_T& iCount) {
133  }
134 
136  void setDemandDistribution (const DemandDistribution& iDemandDistribution) {
137  _demandDistribution = iDemandDistribution;
138  }
139 
141  void
143  const POSProbabilityMassFunction_T& iPOSProbMass,
144  const ChannelProbabilityMassFunction_T& iChannelProbMass,
145  const TripTypeProbabilityMassFunction_T& iTripTypeProbMass,
146  const StayDurationProbabilityMassFunction_T& iStayDurationProbMass,
147  const FrequentFlyerProbabilityMassFunction_T& iFrequentFlyerProbMass,
148  const stdair::ChangeFeesRatio_T& iChangeFeeProb,
149  const stdair::Disutility_T& iChangeFeeDisutility,
150  const stdair::NonRefundableRatio_T& iNonRefundableProb,
151  const stdair::Disutility_T& iNonRefundableDisutility,
152  const PreferredDepartureTimeContinuousDistribution_T& iPreferredDepartureTimeContinuousDistribution,
153  const stdair::WTP_T& iMinWTP,
154  const ValueOfTimeContinuousDistribution_T& iValueOfTimeContinuousDistribution) {
156  DemandCharacteristics (iArrivalPattern, iPOSProbMass,
157  iChannelProbMass, iTripTypeProbMass,
158  iStayDurationProbMass, iFrequentFlyerProbMass,
159  iChangeFeeProb, iChangeFeeDisutility,
160  iNonRefundableProb, iNonRefundableDisutility,
161  iPreferredDepartureTimeContinuousDistribution,
162  iMinWTP, iValueOfTimeContinuousDistribution);
163  }
164 
166  void setTotalNumberOfRequestsToBeGenerated (const stdair::NbOfRequests_T& iNbOfRequests) {
167  _totalNumberOfRequestsToBeGenerated = iNbOfRequests;
168  }
169 
171  void setRequestDateTimeRandomGeneratorSeed (const stdair::RandomSeed_T& iSeed) {
172  _requestDateTimeRandomGenerator.init (iSeed);
173  }
174 
176  void setDemandCharacteristicsRandomGeneratorSeed (const stdair::RandomSeed_T& iSeed) {
178  }
179 
184  void setPOSProbabilityMass (const POSProbabilityMass_T& iProbMass) {
185  _posProMass = iProbMass;
186  }
187 
197  const stdair::ChangeFeesRatio_T&,
198  const stdair::Disutility_T&,
199  const stdair::NonRefundableRatio_T&,
200  const stdair::Disutility_T&,
202  const stdair::WTP_T&,
204  const DemandDistribution&,
205  stdair::BaseGenerator_T& ioSharedGenerator,
206  const stdair::RandomSeed_T& iRequestDateTimeSeed,
207  const stdair::RandomSeed_T& iDemandCharacteristicsSeed,
208  const POSProbabilityMass_T&);
209 
214  void setBoolFirstDateTimeRequest (const bool& iFirstDateTimeRequest) {
215  _firstDateTimeRequest = iFirstDateTimeRequest;
216  }
217 
218 
219  public:
220  // /////////////////// Business Methods ///////////////////
224  }
225 
227  const bool stillHavingRequestsToBeGenerated (const stdair::DemandGenerationMethod& iDemandGenerationMethod) const;
228 
230  const stdair::DateTime_T generateTimeOfRequestPoissonProcess();
231 
233  const stdair::DateTime_T generateTimeOfRequestStatisticsOrder();
234 
236  const stdair::AirportCode_T generatePOS();
237 
239  const stdair::ChannelLabel_T generateChannel();
240 
242  const stdair::TripType_T generateTripType();
243 
245  const stdair::DayDuration_T generateStayDuration();
246 
248  const stdair::FrequentFlyer_T generateFrequentFlyer();
249 
251  const stdair::ChangeFees_T generateChangeFees();
252 
254  const stdair::NonRefundable_T generateNonRefundable();
255 
257  const stdair::Duration_T generatePreferredDepartureTime();
258 
260  const stdair::WTP_T generateWTP (stdair::RandomGeneration&,
261  const stdair::Date_T&,
262  const stdair::DateTime_T&,
263  const stdair::DayDuration_T&);
264 
266  const stdair::PriceValue_T generateValueOfTime();
267 
278  stdair::BookingRequestPtr_T
279  generateNextRequest (stdair::RandomGeneration&,
280  const stdair::DemandGenerationMethod&);
281 
283  void reset (stdair::BaseGenerator_T& ioSharedGenerator);
284 
285 
286  public:
287  // ////////////////// Display support methods //////////////
292  void toStream (std::ostream& ioOut) const {
293  ioOut << toString();
294  }
295 
300  void fromStream (std::istream& ioIn) {
301  }
302 
306  std::string toString() const;
307 
311  const std::string describeKey() const {
312  return _key.toString();
313  }
314 
318  std::string display() const;
319  const stdair::Duration_T convertFloatIntoDuration (const stdair::FloatDuration_T);
320 
321  protected:
322  // ////////// Constructors and destructors /////////
326  DemandStream (const Key_T&);
330  virtual ~DemandStream();
331 
332  private:
334  DemandStream();
336  DemandStream (const DemandStream&);
338  void init (stdair::BaseGenerator_T& ioSharedGenerator);
339 
340 
341  protected:
342  // ////////// Attributes //////////
347 
352 
356  stdair::HolderMap_T _holderMap;
357 
362 
367 
371  stdair::NbOfRequests_T _totalNumberOfRequestsToBeGenerated;
372 
377 
381  stdair::RandomGeneration _requestDateTimeRandomGenerator;
382 
386  stdair::RandomGeneration _demandCharacteristicsRandomGenerator;
387 
393 
394  private:
395  bool _stillHavingRequestsToBeGenerated;
396  bool _firstDateTimeRequest;
397  stdair::FloatDuration_T _dateTimeLastRequest;
398  };
399 
400 }
401 #endif // __TRADEMGEN_BOM_DEMANDSTREAM_HPP