7 #include <boost/make_shared.hpp>
9 #include <stdair/basic/ProgressStatusSet.hpp>
10 #include <stdair/basic/BasConst_Request.hpp>
11 #include <stdair/bom/BomManager.hpp>
12 #include <stdair/bom/EventStruct.hpp>
13 #include <stdair/bom/BookingRequestStruct.hpp>
14 #include <stdair/bom/TravelSolutionStruct.hpp>
15 #include <stdair/bom/CancellationStruct.hpp>
16 #include <stdair/factory/FacBom.hpp>
17 #include <stdair/factory/FacBomManager.hpp>
18 #include <stdair/service/Logger.hpp>
20 #include <sevmgr/SEVMGR_Service.hpp>
32 buildSampleBomStd (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
33 stdair::RandomGeneration& ioSharedGenerator,
36 assert (ioSEVMGR_ServicePtr != NULL);
39 const stdair::AirportCode_T lOrigin (
"SIN");
40 const stdair::AirportCode_T lDestination (
"BKK");
41 const stdair::Date_T lDepDate (2011, 2, 14);
42 const stdair::CabinCode_T lCabin (
"Y");
45 const DemandStreamKey lDemandStreamKey (lOrigin, lDestination, lDepDate,
52 const stdair::MeanValue_T lDemandMean (10.0);
53 const stdair::StdDevValue_T lDemandStdDev (1.0);
54 const DemandDistribution lDemandDistribution (lDemandMean, lDemandStdDev);
57 const stdair::RandomSeed_T& lRequestDateTimeSeed =
58 generateSeed (ioSharedGenerator);
59 const stdair::RandomSeed_T& lDemandCharacteristicsSeed =
60 generateSeed (ioSharedGenerator);
64 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-330,
66 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-40,
68 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-20,
70 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-1,
74 lPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"BKK", 0.3));
75 lPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"SIN", 0.7));
78 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"DF",
80 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"DN",
82 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"IF",
84 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"IN",
88 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"RO",
90 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"RI",
92 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"OW",
96 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(0,
98 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(1,
100 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(2,
102 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(3,
104 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(4,
106 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(5,
110 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"P",
112 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"G",
114 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"S",
116 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"M",
118 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"N",
122 lPrefDepTimeProbDist.
123 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (6 * stdair::HOUR_CONVERTED_IN_SECONDS, 0));
124 lPrefDepTimeProbDist.
125 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (7 * stdair::HOUR_CONVERTED_IN_SECONDS,
127 lPrefDepTimeProbDist.
128 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (9 * stdair::HOUR_CONVERTED_IN_SECONDS,
130 lPrefDepTimeProbDist.
131 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (17 * stdair::HOUR_CONVERTED_IN_SECONDS,
133 lPrefDepTimeProbDist.
134 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (19 * stdair::HOUR_CONVERTED_IN_SECONDS,
136 lPrefDepTimeProbDist.
137 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (20 * stdair::HOUR_CONVERTED_IN_SECONDS,
139 lPrefDepTimeProbDist.
140 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (22 * stdair::HOUR_CONVERTED_IN_SECONDS,
144 lTimeValueProbDist.insert(ValueOfTimeContinuousDistribution_T::value_type(15,
146 lTimeValueProbDist.insert(ValueOfTimeContinuousDistribution_T::value_type(60,
150 const stdair::WTP_T lWTP (1000.0);
151 const stdair::ChangeFeesRatio_T lChangeFees (0.5);
152 const stdair::Disutility_T lChangeFeeDisutility (50);
153 const stdair::NonRefundableRatio_T lNonRefundable (0.5);
154 const stdair::Disutility_T lNonRefundableDisutility (50);
158 DemandStream& lDemandStream =
159 createDemandStream (ioSEVMGR_ServicePtr, lDemandStreamKey, lDTDProbDist,
160 lPOSProbDist, lChannelProbDist, lTripProbDist,
161 lStayProbDist, lFFProbDist,
162 lChangeFees, lChangeFeeDisutility,
163 lNonRefundable, lNonRefundableDisutility,
164 lPrefDepTimeProbDist,
165 lWTP, lTimeValueProbDist, lDemandDistribution,
166 ioSharedGenerator.getBaseGenerator(),
167 lRequestDateTimeSeed,
168 lDemandCharacteristicsSeed, iPOSProbMass);
172 const stdair::NbOfRequests_T& lExpectedTotalNbOfEvents =
178 ioSEVMGR_ServicePtr->addStatus (stdair::EventType::BKG_REQ,
179 lExpectedTotalNbOfEvents);
183 DemandStream& DemandManager::createDemandStream
184 (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
185 const DemandStreamKey& iKey,
192 const stdair::ChangeFeesRatio_T& iChangeFeeProb,
193 const stdair::Disutility_T& iChangeFeeDisutility,
194 const stdair::NonRefundableRatio_T& iNonRefundableProb,
195 const stdair::Disutility_T& iNonRefundableDisutility,
197 const stdair::WTP_T& iMinWTP,
199 const DemandDistribution& iDemandDistribution,
200 stdair::BaseGenerator_T& ioSharedGenerator,
201 const stdair::RandomSeed_T& iRequestDateTimeSeed,
202 const stdair::RandomSeed_T& iDemandCharacteristicsSeed,
206 assert (ioSEVMGR_ServicePtr != NULL);
209 DemandStream& oDemandStream =
210 stdair::FacBom<DemandStream>::instance().create (iKey);
212 oDemandStream.setAll (iArrivalPattern, iPOSProbMass,
213 iChannelProbMass, iTripTypeProbMass,
214 iStayDurationProbMass, iFrequentFlyerProbMass,
215 iChangeFeeProb, iChangeFeeDisutility,
216 iNonRefundableProb, iNonRefundableDisutility,
217 iPreferredDepartureTimeContinuousDistribution,
218 iMinWTP, iValueOfTimeContinuousDistribution,
219 iDemandDistribution, ioSharedGenerator,
220 iRequestDateTimeSeed, iDemandCharacteristicsSeed,
221 iDefaultPOSProbablityMass);
223 ioSEVMGR_ServicePtr->addEventGenerator (oDemandStream);
225 return oDemandStream;
230 createDemandCharacteristics (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
231 stdair::RandomGeneration& ioSharedGenerator,
233 const DemandStruct& iDemand) {
235 assert (ioSEVMGR_ServicePtr != NULL);
238 stdair::BaseGenerator_T& lSharedGenerator =
239 ioSharedGenerator.getBaseGenerator();
242 const stdair::DatePeriod_T lDateRange = iDemand._dateRange;
243 for (boost::gregorian::day_iterator itDate = lDateRange.begin();
244 itDate != lDateRange.end(); ++itDate) {
245 const stdair::Date_T& currentDate = *itDate;
248 const unsigned short currentDoW = currentDate.day_of_week().as_number();
253 const stdair::DoWStruct& lDoWList = iDemand._dow;
254 const bool isDoWActive = lDoWList.getStandardDayOfWeek (currentDoW);
256 if (isDoWActive ==
true) {
257 const DemandStreamKey lDemandStreamKey (iDemand._origin,
258 iDemand._destination,
265 const DemandDistribution lDemandDistribution (iDemand._demandMean,
266 iDemand._demandStdDev);
269 const stdair::RandomSeed_T& lRequestDateTimeSeed =
270 generateSeed (ioSharedGenerator);
271 const stdair::RandomSeed_T& lDemandCharacteristicsSeed =
272 generateSeed (ioSharedGenerator);
275 DemandStream& lDemandStream =
276 createDemandStream (ioSEVMGR_ServicePtr, lDemandStreamKey,
277 iDemand._dtdProbDist, iDemand._posProbDist,
278 iDemand._channelProbDist,
279 iDemand._tripProbDist,
280 iDemand._stayProbDist, iDemand._ffProbDist,
281 iDemand._changeFeeProb,
282 iDemand._changeFeeDisutility,
283 iDemand._nonRefundableProb,
284 iDemand._nonRefundableDisutility,
285 iDemand._prefDepTimeProbDist,
287 iDemand._timeValueProbDist,
288 lDemandDistribution, lSharedGenerator,
289 lRequestDateTimeSeed,
290 lDemandCharacteristicsSeed,
295 const stdair::NbOfRequests_T& lExpectedTotalNbOfEvents =
296 lDemandStream.getMeanNumberOfRequests();
302 ioSEVMGR_ServicePtr->addStatus (stdair::EventType::BKG_REQ,
303 lExpectedTotalNbOfEvents);
309 stdair::RandomSeed_T DemandManager::
310 generateSeed (stdair::RandomGeneration& ioSharedGenerator) {
311 stdair::RealNumber_T lVariateUnif = ioSharedGenerator() * 1e9;
312 stdair::RandomSeed_T oSeed =
static_cast<stdair::RandomSeed_T
>(lVariateUnif);
317 const bool DemandManager::
318 stillHavingRequestsToBeGenerated (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
319 const stdair::DemandStreamKeyStr_T& iKey,
320 stdair::ProgressStatusSet& ioPSS,
321 const stdair::DemandGenerationMethod& iDemandGenerationMethod) {
323 assert (ioSEVMGR_ServicePtr != NULL);
326 const DemandStream& lDemandStream =
327 ioSEVMGR_ServicePtr->getEventGenerator<DemandStream,stdair::DemandStreamKeyStr_T>(iKey);
330 stdair::ProgressStatus
331 lProgressStatus (lDemandStream.getNumberOfRequestsGeneratedSoFar(),
332 lDemandStream.getMeanNumberOfRequests(),
333 lDemandStream.getTotalNumberOfRequestsToBeGenerated());
334 ioPSS.setSpecificGeneratorStatus (lProgressStatus, iKey);
336 return lDemandStream.stillHavingRequestsToBeGenerated (iDemandGenerationMethod);
340 stdair::BookingRequestPtr_T DemandManager::
341 generateNextRequest (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
342 stdair::RandomGeneration& ioGenerator,
343 const stdair::DemandStreamKeyStr_T& iKey,
344 const stdair::DemandGenerationMethod& iDemandGenerationMethod) {
346 assert (ioSEVMGR_ServicePtr != NULL);
349 DemandStream& lDemandStream =
350 ioSEVMGR_ServicePtr->getEventGenerator<DemandStream,stdair::DemandStreamKeyStr_T>(iKey);
353 stdair::BookingRequestPtr_T lBookingRequest =
354 lDemandStream.generateNextRequest (ioGenerator,
355 iDemandGenerationMethod);
357 const stdair::DateTime_T& lBookingRequestDateTime =
358 lBookingRequest->getRequestDateTime();
359 const stdair::Date_T& lBookingRequestDate =
360 lBookingRequestDateTime.date();
361 const stdair::Duration_T& lBookingRequestTime =
362 lBookingRequestDateTime.time_of_day();
363 const stdair::Date_T& lPreferedDepartureDate =
364 lBookingRequest->getPreferedDepartureDate();
365 const stdair::Duration_T& lPreferedDepartureTime =
366 lBookingRequest->getPreferredDepartureTime();
368 if ((lPreferedDepartureDate > lBookingRequestDate) ||
369 (lPreferedDepartureDate == lBookingRequestDate &&
370 lPreferedDepartureTime > lBookingRequestTime)) {
373 stdair::EventStruct lEventStruct (stdair::EventType::BKG_REQ,
383 ioSEVMGR_ServicePtr->addEvent (lEventStruct);
389 stdair::Count_T lCurrentBRNumber =
390 ioSEVMGR_ServicePtr->getActualTotalNumberOfEventsToBeGenerated (stdair::EventType::BKG_REQ);
392 ioSEVMGR_ServicePtr->updateStatus (stdair::EventType::BKG_REQ, lCurrentBRNumber);
396 return lBookingRequest;
400 stdair::Count_T DemandManager::
401 generateFirstRequests (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
402 stdair::RandomGeneration& ioGenerator,
403 const stdair::DemandGenerationMethod& iDemandGenerationMethod) {
405 assert (ioSEVMGR_ServicePtr != NULL);
408 stdair::NbOfRequests_T lActualTotalNbOfEvents = 0.0;
412 ioSEVMGR_ServicePtr->getEventGeneratorList<DemandStream>();
414 for (DemandStreamList_T::const_iterator itDemandStream =
415 lDemandStreamList.begin();
416 itDemandStream != lDemandStreamList.end(); ++itDemandStream) {
417 DemandStream* lDemandStream_ptr = *itDemandStream;
418 assert (lDemandStream_ptr != NULL);
420 lDemandStream_ptr->setBoolFirstDateTimeRequest(
true);
424 const stdair::NbOfRequests_T& lActualNbOfEvents =
425 lDemandStream_ptr->getTotalNumberOfRequestsToBeGenerated();
426 lActualTotalNbOfEvents += lActualNbOfEvents;
429 const DemandStreamKey& lKey = lDemandStream_ptr->getKey();
432 const bool stillHavingRequestsToBeGenerated =
433 lDemandStream_ptr->stillHavingRequestsToBeGenerated (iDemandGenerationMethod);
435 if (stillHavingRequestsToBeGenerated) {
438 generateNextRequest (ioSEVMGR_ServicePtr, ioGenerator,
440 iDemandGenerationMethod);
446 ioSEVMGR_ServicePtr->updateStatus (stdair::EventType::BKG_REQ,
447 lActualTotalNbOfEvents);
450 const stdair::Count_T oTotalNbOfEvents = std::floor (lActualTotalNbOfEvents);
453 return oTotalNbOfEvents;
457 void DemandManager::reset (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
458 stdair::BaseGenerator_T& ioShareGenerator) {
460 assert (ioSEVMGR_ServicePtr != NULL);
468 ioSEVMGR_ServicePtr->getEventGeneratorList<DemandStream>();
469 for (DemandStreamList_T::const_iterator itDS = lDemandStreamList.begin();
470 itDS != lDemandStreamList.end(); ++itDS) {
471 DemandStream* lCurrentDS_ptr = *itDS;
472 assert (lCurrentDS_ptr != NULL);
474 lCurrentDS_ptr->reset (ioShareGenerator);
484 ioSEVMGR_ServicePtr->reset();
489 generateCancellation (stdair::RandomGeneration& ioGenerator,
490 const stdair::TravelSolutionStruct& iTravelSolution,
491 const stdair::PartySize_T& iPartySize,
492 const stdair::DateTime_T& iRequestTime,
493 const stdair::Date_T& iDepartureDate,
494 stdair::EventStruct& ioEventStruct) {
499 double lRandomNumber = ioGenerator();
501 if (lRandomNumber >= 0.05) {
504 lRandomNumber /= 0.05;
507 const stdair::Time_T lMidNight =
508 boost::posix_time::hours (0);
509 const stdair::DateTime_T lDepartureDateTime =
510 boost::posix_time::ptime (iDepartureDate, lMidNight);
513 const stdair::Duration_T lTimeToDeparture = lDepartureDateTime-iRequestTime;
516 const long lTimeToDepartureInSeconds = lTimeToDeparture.total_seconds();
517 const long lCancellationTimeToDepartureInSeconds =
518 static_cast<long> (lTimeToDepartureInSeconds * lRandomNumber);
519 const stdair::Duration_T lCancellationTimeToDeparture (0, 0, lCancellationTimeToDepartureInSeconds);
522 const stdair::DateTime_T lCancellationTime =
523 lDepartureDateTime - lCancellationTimeToDeparture;
524 const stdair::Duration_T lTimeBetweenCancellationAndTheRequest =
525 lCancellationTime - iRequestTime;
527 if (lTimeBetweenCancellationAndTheRequest.is_negative() ==
true) {
532 stdair::BookingClassIDList_T lClassIDList;
534 const stdair::ClassObjectIDMapHolder_T& lClassObjectIDMapHolder =
535 iTravelSolution.getClassObjectIDMapHolder();
536 const stdair::FareOptionStruct& lChosenFareOption =
537 iTravelSolution.getChosenFareOption ();
538 const stdair::ClassList_StringList_T& lClassPath =
539 lChosenFareOption.getClassPath();
540 const stdair::SegmentPath_T& lSegmentPath =
541 iTravelSolution.getSegmentPath();
542 stdair::ClassList_StringList_T::const_iterator itClassKeyList =
544 for (stdair::ClassObjectIDMapHolder_T::const_iterator itClassObjectIDMap =
545 lClassObjectIDMapHolder.begin();
546 itClassObjectIDMap != lClassObjectIDMapHolder.end();
547 ++itClassObjectIDMap, ++itClassKeyList) {
548 const stdair::ClassObjectIDMap_T& lClassObjectIDMap = *itClassObjectIDMap;
551 std::ostringstream ostr;
552 const stdair::ClassList_String_T& lClassList = *itClassKeyList;
553 assert (lClassList.empty() ==
false);
555 ostr << lClassList.at(0);
556 const stdair::ClassCode_T lClassCode (ostr.str());
558 stdair::ClassObjectIDMap_T::const_iterator itClassID =
559 lClassObjectIDMap.find (lClassCode);
560 assert (itClassID != lClassObjectIDMap.end());
561 const stdair::BookingClassID_T& lClassID = itClassID->second;
563 lClassIDList.push_back (lClassID);
569 stdair::CancellationStruct lCancellationStruct (lSegmentPath,
574 stdair::CancellationPtr_T lCancellation_ptr =
575 boost::make_shared<stdair::CancellationStruct> (lCancellationStruct);
578 stdair::EventStruct lEventStruct (stdair::EventType::CX, lCancellation_ptr);
579 ioEventStruct = lEventStruct;
586 buildSampleBom (SEVMGR::SEVMGR_ServicePtr_T ioSEVMGR_ServicePtr,
587 stdair::RandomGeneration& ioSharedGenerator,
590 assert (ioSEVMGR_ServicePtr != NULL);
594 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-330,
596 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-150,
598 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-92,
600 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-55,
602 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-34,
604 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-21,
606 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-12,
608 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-6,
610 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-3,
612 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(-1,
614 lDTDProbDist.insert(ArrivalPatternCumulativeDistribution_T::value_type(0,
619 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"DF",
621 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"DN",
623 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"IF",
625 lChannelProbDist.insert (ChannelProbabilityMassFunction_T::value_type (
"IN",
630 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"RO",
632 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"RI",
634 lTripProbDist.insert (TripTypeProbabilityMassFunction_T::value_type (
"OW",
639 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(0,
641 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(1,
643 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(2,
645 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(3,
647 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(4,
649 lStayProbDist.insert(StayDurationProbabilityMassFunction_T::value_type(5,
654 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"P",
656 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"G",
658 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"S",
660 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"M",
662 lFFProbDist.insert(FrequentFlyerProbabilityMassFunction_T::value_type(
"N",
667 lTimeValueProbDist.insert(ValueOfTimeContinuousDistribution_T::value_type(15,
669 lTimeValueProbDist.insert(ValueOfTimeContinuousDistribution_T::value_type(60,
675 const stdair::AirportCode_T lSINOrigin (
"SIN");
676 const stdair::AirportCode_T lBKKDestination (
"BKK");
677 const stdair::Date_T lDepDate (2010, 2, 8);
678 const stdair::CabinCode_T lCabin (
"Y");
681 const DemandStreamKey lSINBKKDemandStreamKey (lSINOrigin, lBKKDestination, lDepDate,
688 const stdair::MeanValue_T lSINBKKDemandMean (60.0);
689 const stdair::StdDevValue_T lSINBKKDemandStdDev (4.0);
690 const DemandDistribution lSINBKKDemandDistribution (lSINBKKDemandMean, lSINBKKDemandStdDev);
693 const stdair::RandomSeed_T& lSINBKKRequestDateTimeSeed =
694 generateSeed (ioSharedGenerator);
695 const stdair::RandomSeed_T& lSINBKKDemandCharacteristicsSeed =
696 generateSeed (ioSharedGenerator);
701 lSINBKKPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"SIN", 1.0));
702 lSINBKKPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"BKK", 0.0));
706 lSINPrefDepTimeProbDist.
707 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (6 * stdair::HOUR_CONVERTED_IN_SECONDS, 0));
708 lSINPrefDepTimeProbDist.
709 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (8 * stdair::HOUR_CONVERTED_IN_SECONDS,
711 lSINPrefDepTimeProbDist.
712 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (10 * stdair::HOUR_CONVERTED_IN_SECONDS,
714 lSINPrefDepTimeProbDist.
715 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (12 * stdair::HOUR_CONVERTED_IN_SECONDS,
717 lSINPrefDepTimeProbDist.
718 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (14 * stdair::HOUR_CONVERTED_IN_SECONDS,
722 const stdair::WTP_T lSINBKKWTP (400.0);
723 const stdair::ChangeFeesRatio_T lChangeFees (0.5);
724 const stdair::Disutility_T lChangeFeeDisutility (50);
725 const stdair::NonRefundableRatio_T lNonRefundable (0.5);
726 const stdair::Disutility_T lNonRefundableDisutility (50);
730 DemandStream& lSINBKKDemandStream =
731 createDemandStream (ioSEVMGR_ServicePtr, lSINBKKDemandStreamKey, lDTDProbDist,
732 lSINBKKPOSProbDist, lChannelProbDist, lTripProbDist,
733 lStayProbDist, lFFProbDist,
734 lChangeFees, lChangeFeeDisutility,
735 lNonRefundable, lNonRefundableDisutility,
736 lSINPrefDepTimeProbDist,
737 lSINBKKWTP, lTimeValueProbDist,
738 lSINBKKDemandDistribution,
739 ioSharedGenerator.getBaseGenerator(),
740 lSINBKKRequestDateTimeSeed,
741 lSINBKKDemandCharacteristicsSeed, iPOSProbMass);
745 const stdair::NbOfRequests_T& lSINBKKExpectedNbOfEvents =
751 const stdair::AirportCode_T lBKKOrigin (
"BKK");
752 const stdair::AirportCode_T lHKGDestination (
"HKG");
755 const DemandStreamKey lBKKHKGDemandStreamKey (lBKKOrigin, lHKGDestination, lDepDate,
762 const stdair::MeanValue_T lBKKHKGDemandMean (60.0);
763 const stdair::StdDevValue_T lBKKHKGDemandStdDev (4.0);
764 const DemandDistribution lBKKHKGDemandDistribution (lBKKHKGDemandMean, lBKKHKGDemandStdDev);
767 const stdair::RandomSeed_T& lBKKHKGRequestDateTimeSeed =
768 generateSeed (ioSharedGenerator);
769 const stdair::RandomSeed_T& lBKKHKGDemandCharacteristicsSeed =
770 generateSeed (ioSharedGenerator);
775 lBKKHKGPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"BKK", 1.0));
776 lBKKHKGPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"HKG", 0.0));
780 lBKKPrefDepTimeProbDist.
781 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (8 * stdair::HOUR_CONVERTED_IN_SECONDS, 0));
782 lBKKPrefDepTimeProbDist.
783 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (10 * stdair::HOUR_CONVERTED_IN_SECONDS,
785 lBKKPrefDepTimeProbDist.
786 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (1 * stdair::HOUR_CONVERTED_IN_SECONDS,
788 lBKKPrefDepTimeProbDist.
789 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (14 * stdair::HOUR_CONVERTED_IN_SECONDS,
791 lBKKPrefDepTimeProbDist.
792 insert (PreferredDepartureTimeContinuousDistribution_T::value_type (16 * stdair::HOUR_CONVERTED_IN_SECONDS,
796 const stdair::WTP_T lBKKHKGWTP (400.0);
800 DemandStream& lBKKHKGDemandStream =
801 createDemandStream (ioSEVMGR_ServicePtr, lBKKHKGDemandStreamKey, lDTDProbDist,
802 lBKKHKGPOSProbDist, lChannelProbDist, lTripProbDist,
803 lStayProbDist, lFFProbDist,
804 lChangeFees, lChangeFeeDisutility,
805 lNonRefundable, lNonRefundableDisutility,
806 lBKKPrefDepTimeProbDist,
807 lBKKHKGWTP, lTimeValueProbDist,
808 lBKKHKGDemandDistribution,
809 ioSharedGenerator.getBaseGenerator(),
810 lBKKHKGRequestDateTimeSeed,
811 lBKKHKGDemandCharacteristicsSeed, iPOSProbMass);
815 const stdair::NbOfRequests_T& lBKKHKGExpectedNbOfEvents =
823 const DemandStreamKey lSINHKGDemandStreamKey (lSINOrigin, lHKGDestination, lDepDate,
830 const stdair::MeanValue_T lSINHKGDemandMean (60.0);
831 const stdair::StdDevValue_T lSINHKGDemandStdDev (4.0);
832 const DemandDistribution lSINHKGDemandDistribution (lSINHKGDemandMean, lSINHKGDemandStdDev);
835 const stdair::RandomSeed_T& lSINHKGRequestDateTimeSeed =
836 generateSeed (ioSharedGenerator);
837 const stdair::RandomSeed_T& lSINHKGDemandCharacteristicsSeed =
838 generateSeed (ioSharedGenerator);
843 lSINHKGPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"SIN", 1.0));
844 lSINHKGPOSProbDist.insert (POSProbabilityMassFunction_T::value_type (
"HKG", 0.0));
847 const stdair::WTP_T lSINHKGWTP (750.0);
851 DemandStream& lSINHKGDemandStream =
852 createDemandStream (ioSEVMGR_ServicePtr, lSINHKGDemandStreamKey, lDTDProbDist,
853 lSINHKGPOSProbDist, lChannelProbDist, lTripProbDist,
854 lStayProbDist, lFFProbDist,
855 lChangeFees, lChangeFeeDisutility,
856 lNonRefundable, lNonRefundableDisutility,
857 lSINPrefDepTimeProbDist,
858 lSINHKGWTP, lTimeValueProbDist, lSINHKGDemandDistribution,
859 ioSharedGenerator.getBaseGenerator(),
860 lSINHKGRequestDateTimeSeed,
861 lSINHKGDemandCharacteristicsSeed, iPOSProbMass);
865 const stdair::NbOfRequests_T& lSINHKGExpectedNbOfEvents =
873 const stdair::NbOfRequests_T lExpectedTotalNbOfEvents =
874 lSINBKKExpectedNbOfEvents + lBKKHKGExpectedNbOfEvents + lSINHKGExpectedNbOfEvents;
875 ioSEVMGR_ServicePtr->addStatus (stdair::EventType::BKG_REQ,
876 lExpectedTotalNbOfEvents);