$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 #include <cmath> 00008 // StdAir 00009 #include <stdair/basic/BasConst_General.hpp> 00010 #include <stdair/basic/BasConst_Inventory.hpp> 00011 #include <stdair/bom/BomManager.hpp> 00012 #include <stdair/bom/SegmentCabin.hpp> 00013 #include <stdair/bom/BookingClass.hpp> 00014 #include <stdair/service/Logger.hpp> 00015 // RMOL 00016 #include <rmol/bom/Utilities.hpp> 00017 #include <rmol/command/DemandInputPreparation.hpp> 00018 00019 namespace RMOL { 00020 00021 // //////////////////////////////////////////////////////////////////// 00022 bool DemandInputPreparation:: 00023 prepareDemandInput (const stdair::SegmentCabin& iSegmentCabin) { 00024 bool isSucceeded = true; 00025 00026 // Browse the list of booking classes and sum the price-oriented 00027 // demand foreast and the product-oriented demand forecast. 00028 const stdair::BookingClassList_T& lBCList = 00029 stdair::BomManager::getList<stdair::BookingClass> (iSegmentCabin); 00030 for (stdair::BookingClassList_T::const_iterator itBC = lBCList.begin(); 00031 itBC != lBCList.end(); ++itBC) { 00032 stdair::BookingClass* lBC_ptr = *itBC; 00033 assert (lBC_ptr != NULL); 00034 00035 const stdair::MeanValue_T& lPriceDemMean = lBC_ptr->getPriceDemMean(); 00036 const stdair::StdDevValue_T& lPriceStdDev = lBC_ptr->getPriceDemStdDev(); 00037 const stdair::MeanValue_T& lProductDemMean = lBC_ptr->getProductDemMean(); 00038 const stdair::StdDevValue_T& lProductStdDev = 00039 lBC_ptr->getProductDemStdDev(); 00040 00041 const stdair::MeanValue_T lNewMeanValue = lPriceDemMean + lProductDemMean; 00042 const stdair::StdDevValue_T lNewStdDev = 00043 std::sqrt(lPriceStdDev*lPriceStdDev + lProductStdDev*lProductStdDev); 00044 00045 lBC_ptr->setMean (lNewMeanValue); 00046 lBC_ptr->setStdDev (lNewStdDev); 00047 } 00048 00049 return isSucceeded; 00050 } 00051 00052 }