11 #include <stdair/service/Logger.hpp>
24 _historicalBookingVector.clear();
29 return _historicalBookingVector.size();
35 const short lSize = _historicalBookingVector.size();
37 for (
short ite = 0; ite < lSize; ++ite) {
38 const stdair::Flag_T lFlag = _historicalBookingVector.at(ite).getFlag ();
50 stdair::NbOfBookings_T lResult = 0;
51 const short lSize = _historicalBookingVector.size();
53 for (
short ite = 0; ite < lSize; ++ite) {
55 _historicalBookingVector.at (ite);
56 const stdair::Flag_T lFlag = lHistorialBooking.
getFlag ();
58 const stdair::NbOfBookings_T& lBooking =
70 const short iNbOfUncensoredData)
const {
73 const short lSize = _historicalBookingVector.size();
75 for (
short ite = 0; ite < lSize; ++ite) {
76 const stdair::Flag_T lFlag = _historicalBookingVector.at(ite).getFlag ();
79 _historicalBookingVector.at (ite);
81 const stdair::NbOfBookings_T& lBooking =
84 lResult += (lBooking - iMeanOfUncensoredBookings)
85 * (lBooking - iMeanOfUncensoredBookings);
88 lResult /= (iNbOfUncensoredData - 1);
89 lResult = std::sqrt (lResult);
97 const short lSize = _historicalBookingVector.size();
99 for (
short ite = 0; ite < lSize; ++ite) {
101 _historicalBookingVector.at(ite);
103 const stdair::NbOfBookings_T& lDemand =
106 lResult +=
static_cast<double>(lDemand);
116 (
const double iDemandMean)
const {
118 const short lSize = _historicalBookingVector.size();
120 for (
short ite = 0; ite < lSize; ++ite) {
122 _historicalBookingVector.at(ite);
124 const stdair::NbOfBookings_T& lDemand =
127 const double lDoubleDemand =
static_cast<double> (lDemand);
128 lResult += (lDoubleDemand - iDemandMean) * (lDoubleDemand - iDemandMean);
131 lResult /= (lSize - 1);
133 lResult = std::sqrt (lResult);
141 std::vector<bool> lResult;
142 const short lSize = _historicalBookingVector.size();
144 for (
short ite = 0; ite < lSize; ++ite) {
146 _historicalBookingVector.at(ite);
147 const stdair::Flag_T lFlag = lHistorialBooking.
getFlag ();
149 lResult.push_back(
true);
152 lResult.push_back(
false);
163 _historicalBookingVector.at(i);
171 _historicalBookingVector.at(i);
179 _historicalBookingVector.at(i);
180 return lHistorialBooking.
getFlag();
185 (
const stdair::NbOfBookings_T& iExpectedDemand,
const short i) {
186 _historicalBookingVector.at(i).setUnconstrainedDemand(iExpectedDemand);
191 (
const double iMean,
const double iSD,
192 const short i,
const stdair::NbOfBookings_T iDemand)
const {
195 _historicalBookingVector.at(i);
196 const double lBooking =
200 e = - (lBooking - iMean) * (lBooking - iMean) * 0.625 / (iSD * iSD);
205 double s = std::sqrt (1 - e);
208 if (lBooking >= iMean) {
219 e = - (lBooking - iMean) * (lBooking - iMean) * 0.5 / (iSD * iSD);
221 d2 = e * iSD / std::sqrt(2 * 3.14159265);
228 const stdair::NbOfBookings_T lDemand =
229 static_cast<stdair::NbOfBookings_T
> (iMean + d2/d1);
237 _historicalBookingVector.push_back(iHistoricalBooking);
242 const short lSize = _historicalBookingVector.size();
244 ioOut <<
"Historical Booking; Unconstrained Demand; Flag" << std::endl;
246 for (
short ite = 0; ite < lSize; ++ite) {
248 _historicalBookingVector.at(ite);
250 const stdair::NbOfBookings_T& lBooking =
253 const stdair::NbOfBookings_T& lDemand =
256 const stdair::Flag_T lFlag = lHistorialBooking.
getFlag();
258 ioOut << lBooking <<
" "
260 << lFlag << std::endl;
266 std::ostringstream ostr;
267 ostr <<
"Holder of HistoricalBooking structs.";