8 #include <boost/math/distributions/normal.hpp>
10 #include <stdair/stdair_maths_types.hpp>
11 #include <stdair/bom/VirtualClassStruct.hpp>
19 (stdair::VirtualClassStruct& ioAggregatedVirtualClass,
20 stdair::VirtualClassStruct& ioCurrentVirtualClass) {
23 const stdair::MeanValue_T lAggregatedMean =
24 ioAggregatedVirtualClass.getMean();
25 const stdair::MeanValue_T lCurrentMean = ioCurrentVirtualClass.getMean();
26 const stdair::StdDevValue_T lAggregatedSD =
27 ioAggregatedVirtualClass.getStdDev();
28 const stdair::StdDevValue_T lCurrentSD = ioCurrentVirtualClass.getStdDev();
29 const stdair::Yield_T lAggregatedYield =
30 ioAggregatedVirtualClass.getYield();
31 const stdair::Yield_T lCurrentYield = ioCurrentVirtualClass.getYield();
35 const stdair::MeanValue_T lNewMean = lAggregatedMean + lCurrentMean;
36 const stdair::StdDevValue_T lNewSD =
37 std::sqrt (lAggregatedSD*lAggregatedSD + lCurrentSD*lCurrentSD);
38 stdair::Yield_T lNewYield = lCurrentYield;
40 lNewYield = (lAggregatedYield*lAggregatedMean +
41 lCurrentYield*lCurrentMean) / lNewMean;
44 ioAggregatedVirtualClass.setYield(lNewYield);
47 ioAggregatedVirtualClass.setMean (lNewMean);
48 ioAggregatedVirtualClass.setStdDev (lNewSD);
54 stdair::VirtualClassStruct& ioNextVirtualClass) {
58 const stdair::MeanValue_T lMean = ioAggregatedVirtualClass.getMean();
59 const stdair::StdDevValue_T lSD = ioAggregatedVirtualClass.getStdDev();
60 const stdair::Yield_T lAggreatedYield = ioAggregatedVirtualClass.getYield();
61 const stdair::Yield_T lNextYield = ioNextVirtualClass.getYield();
62 assert (lAggreatedYield != 0);
65 const double lYieldRatio = lNextYield / lAggreatedYield;
70 boost::math::normal lNormalDistribution (lMean, lSD);
71 const stdair::ProtectionLevel_T lProtection =
72 boost::math::quantile (boost::math::complement (lNormalDistribution,
81 stdair::VirtualClassStruct& ioVirtualClass){
84 const stdair::MeanValue_T lMean = ioVirtualClass.getMean();
85 const stdair::StdDevValue_T lSD = ioVirtualClass.getStdDev();
86 const stdair::Yield_T lYield = ioVirtualClass.getYield();
89 boost::math::normal lNormalDistribution (lMean, lSD);
90 const double emsrValue =
91 lYield * boost::math::cdf (boost::math::complement (lNormalDistribution,