9 #include <stdair/basic/BasConst_General.hpp>
10 #include <stdair/basic/BasConst_Inventory.hpp>
11 #include <stdair/bom/BomManager.hpp>
12 #include <stdair/bom/FlightDate.hpp>
13 #include <stdair/bom/SegmentDate.hpp>
14 #include <stdair/bom/SegmentCabin.hpp>
15 #include <stdair/bom/SegmentSnapshotTable.hpp>
16 #include <stdair/bom/FareFamily.hpp>
17 #include <stdair/bom/BookingClass.hpp>
18 #include <stdair/service/Logger.hpp>
36 const stdair::DateTime_T& iEventTime,
37 const stdair::UnconstrainingMethod& iUnconstrainingMethod,
38 const stdair::ForecastingMethod& iForecastingMethod) {
40 const stdair::Date_T& lEventDate = iEventTime.date();
43 bool isSucceeded =
true;
44 const stdair::SegmentDateList_T& lSDList =
45 stdair::BomManager::getList<stdair::SegmentDate> (ioFlightDate);
46 for (stdair::SegmentDateList_T::const_iterator itSD = lSDList.begin();
47 itSD != lSDList.end(); ++itSD) {
48 stdair::SegmentDate* lSD_ptr = *itSD;
49 assert (lSD_ptr != NULL);
59 const stdair::SegmentCabinList_T& lSCList =
60 stdair::BomManager::getList<stdair::SegmentCabin> (*lSD_ptr);
61 for (stdair::SegmentCabinList_T::const_iterator itSC = lSCList.begin();
62 itSC != lSCList.end(); ++itSC) {
63 stdair::SegmentCabin* lSC_ptr = *itSC;
64 assert (lSC_ptr != NULL);
69 bool isForecasted =
forecast (*lSC_ptr, lEventDate,
70 iUnconstrainingMethod,
72 if (isForecasted ==
false) {
83 forecast (stdair::SegmentCabin& ioSegmentCabin,
84 const stdair::Date_T& iEventDate,
85 const stdair::UnconstrainingMethod& iUnconstrainingMethod,
86 const stdair::ForecastingMethod& iForecastingMethod) {
88 stdair::NbOfSegments_T lNbOfDepartedSegments =
97 if (lNbOfDepartedSegments < 2) {
100 setDemandForecastsToZero (ioSegmentCabin);
101 const stdair::SegmentDate& lSegmentDate =
102 stdair::BomManager::getParent<stdair::SegmentDate> (ioSegmentCabin);
103 const stdair::Date_T& lBoardingDate = lSegmentDate.getBoardingDate();
104 const stdair::DateOffset_T lDateOffset = lBoardingDate - iEventDate;
105 const stdair::DTD_T& lDaysBeforeDeparture = lDateOffset.days();
110 const stdair::ForecastingMethod::EN_ForecastingMethod lForecastingMethod =
111 iForecastingMethod.getMethod();
112 switch (lForecastingMethod) {
113 case stdair::ForecastingMethod::Q_FORECASTING: {
115 lDaysBeforeDeparture,
116 iUnconstrainingMethod,
117 lNbOfDepartedSegments);
119 case stdair::ForecastingMethod::HYBRID_FORECASTING: {
121 lDaysBeforeDeparture,
122 iUnconstrainingMethod,
123 lNbOfDepartedSegments);
125 case stdair::ForecastingMethod::NEW_QFF: {
126 if (ioSegmentCabin.getFareFamilyStatus()==
false) {
129 lDaysBeforeDeparture,
130 iUnconstrainingMethod,
131 lNbOfDepartedSegments);
134 lDaysBeforeDeparture, iUnconstrainingMethod,
135 lNbOfDepartedSegments);
138 case stdair::ForecastingMethod::OLD_QFF: {
139 if (ioSegmentCabin.getFareFamilyStatus()==
false) {
142 lDaysBeforeDeparture,
143 iUnconstrainingMethod,
144 lNbOfDepartedSegments);
147 lDaysBeforeDeparture, iUnconstrainingMethod,
148 lNbOfDepartedSegments);
151 case stdair::ForecastingMethod::BASED_FORECASTING: {
153 lDaysBeforeDeparture,
154 iUnconstrainingMethod,
155 lNbOfDepartedSegments);
168 setDemandForecastsToZero(
const stdair::SegmentCabin& iSegmentCabin) {
170 const stdair::FareFamilyList_T& lFFList =
171 stdair::BomManager::getList<stdair::FareFamily> (iSegmentCabin);
172 for (stdair::FareFamilyList_T::const_iterator itFF = lFFList.begin();
173 itFF != lFFList.end(); ++itFF) {
174 stdair::FareFamily* lFF_ptr = *itFF;
175 assert (lFF_ptr != NULL);
176 lFF_ptr->setMean (0.0);
177 lFF_ptr->setStdDev (0.0);
179 const stdair::BookingClassList_T& lBCList =
180 stdair::BomManager::getList<stdair::BookingClass> (*lFF_ptr);
181 for (stdair::BookingClassList_T::const_iterator itBC = lBCList.begin();
182 itBC != lBCList.end(); ++itBC) {
183 stdair::BookingClass* lBC_ptr = *itBC;
184 assert (lBC_ptr != NULL);
185 lBC_ptr->setMean (0.0);
186 lBC_ptr->setStdDev (0.0);
187 lBC_ptr->setPriceDemMean (0.0);
188 lBC_ptr->setPriceDemStdDev (0.0);
189 lBC_ptr->setProductDemMean (0.0);
190 lBC_ptr->setProductDemStdDev (0.0);
191 lBC_ptr->setCumuPriceDemMean (0.0);
192 lBC_ptr->setCumuPriceDemStdDev (0.0);