TraDemGen Logo  0.2.2
C++ Simulated Travel Demand Generation Library
TRADEMGEN::TRADEMGEN_Service Class Reference

class holding the services related to Travel Demand Generation. More...

#include <trademgen/TRADEMGEN_Service.hpp>

List of all members.

Public Member Functions

 TRADEMGEN_Service (const stdair::BasLogParams &, const stdair::BasDBParams &, const stdair::RandomSeed_T &)
 Constructor.
 TRADEMGEN_Service (const stdair::BasLogParams &, const stdair::RandomSeed_T &)
 TRADEMGEN_Service (stdair::STDAIR_ServicePtr_T, const stdair::RandomSeed_T &)
void parseAndLoad (const stdair::Filename_T &iDemandInputFilename)
 ~TRADEMGEN_Service ()
void buildSampleBom ()
stdair::BookingRequestStruct buildSampleBookingRequest (const bool isForCRS=false)
void displayAirlineListFromDB () const
const stdair::Count_T & getExpectedTotalNumberOfRequestsToBeGenerated () const
const stdair::Count_T & getActualTotalNumberOfRequestsToBeGenerated () const
const bool stillHavingRequestsToBeGenerated (const stdair::DemandStreamKeyStr_T &, stdair::ProgressStatusSet &, const stdair::DemandGenerationMethod &) const
stdair::Count_T generateFirstRequests (const stdair::DemandGenerationMethod &) const
stdair::BookingRequestPtr_T generateNextRequest (const stdair::DemandStreamKeyStr_T &, const stdair::DemandGenerationMethod &) const
stdair::ProgressStatusSet popEvent (stdair::EventStruct &) const
bool isQueueDone () const
bool generateCancellation (const stdair::TravelSolutionStruct &, const stdair::PartySize_T &, const stdair::DateTime_T &, const stdair::Date_T &) const
void reset () const
std::string csvDisplay () const

Detailed Description

class holding the services related to Travel Demand Generation.


Constructor & Destructor Documentation

TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service ( const stdair::BasLogParams &  iLogParams,
const stdair::BasDBParams &  iDBParams,
const stdair::RandomSeed_T &  iRandomSeed 
)

Constructor.

The initTrademgenService() method is called; see the corresponding documentation for more details.

A reference on an output stream is given, so that log outputs can be directed onto that stream.

Moreover, database connection parameters are given, so that a session can be created on the corresponding database.

Parameters:
conststdair::BasLogParams& Parameters for the output log stream.
conststdair::BasDBParams& Parameters for the database access.
conststdair::RandomSeed_T& Seed for the random generation.

Definition at line 71 of file TRADEMGEN_Service.cpp.

TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service ( const stdair::BasLogParams &  iLogParams,
const stdair::RandomSeed_T &  iRandomSeed 
)

Constructor.

The initTrademgenService() method is called; see the corresponding documentation for more details.

A reference on an output stream is given, so that log outputs can be directed onto that stream.

Parameters:
conststdair::BasLogParams& Parameters for the output log stream.
conststdair::RandomSeed_T& Seed for the random generation.

Definition at line 50 of file TRADEMGEN_Service.cpp.

TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service ( stdair::STDAIR_ServicePtr_T  ioSTDAIR_Service_ptr,
const stdair::RandomSeed_T &  iRandomSeed 
)

Constructor.

The initTrademgenService() method is called; see the corresponding documentation for more details.

Moreover, as no reference on any output stream is given, neither any database access parameter is given, it is assumed that the StdAir log service has already been initialised with the proper log output stream by some other methods in the calling chain (for instance, when the TRADEMGEN_Service is itself being initialised by another library service such as DSIM_Service).

Parameters:
stdair::STDAIR_ServicePtr_THandler on the STDAIR_Service.
conststdair::RandomSeed_T& Seed for the random generation.

Definition at line 94 of file TRADEMGEN_Service.cpp.

TRADEMGEN::TRADEMGEN_Service::~TRADEMGEN_Service ( )

Destructor.

Definition at line 111 of file TRADEMGEN_Service.cpp.


Member Function Documentation

void TRADEMGEN::TRADEMGEN_Service::parseAndLoad ( const stdair::Filename_T &  iDemandInputFilename)

Parse the demand input file.

The CSV file, describing the parameters of the demand to be generated for the simulator, is parsed and instantiated in memory accordingly.

Parameters:
conststdair::Filename_T& Filename of the input demand file.

Definition at line 187 of file TRADEMGEN_Service.cpp.

References generateDemand().

Referenced by main(), and TRADEMGEN::Trademgener::init().

void TRADEMGEN::TRADEMGEN_Service::buildSampleBom ( )

Build a sample BOM tree, made of a single DemandStream object.

As of now (March 2011), it corresponds to:

  • Origin: SIN
  • Destination: BKK
  • Preferred departure date: 2011-02-14
  • Preferred cabin: Y (Economy)
  • POS distribution:
    • BKK: 30%
    • SIN: 70%
  • Channel distribution:
    • Direct Offline: 10%
    • Direct Online: 30%
    • Indirect Offline: 40%
    • Indirect Online: 20%
  • Trip type distribution:
    • Outbound: 60%
    • Inbound: 20%
    • One-way: 20%
  • Arrival pattern distribution:
    • 330 DTD: 0%
    • 40 DTD: 20%
    • 20 DTD: 60%
    • 1 DTD: 100%
    15:0, 60:1
  • Stay duration distribution:
    • 0 day: 10%
    • 1 day: 10%
    • 2 days: 15%
    • 3 days: 15%
    • 4 days: 15%
    • 5 days: 35%
  • Frequent flyer distribution:
    • Platinum: 1%
    • Gold: 5%
    • Silver: 15%
    • Member: 30%
    • No card: 49%
  • Preferred departure time (cumulative distribution):
    • 6am: 0%
    • 7am: 10%
    • 9am: 30%
    • 5pm: 40%
    • 7pm: 80%
    • 8pm: 95%
    • 10pm: 100%
  • Value of time distribution:
    • 15 min: 0%
    • 60 min: 100%
  • WTP: 200
  • Number of requests: Normal (mu = 10.0, std_dev = 1.0)
  • Change fee: 20; Non refundable; Saturday night stay

Definition at line 220 of file TRADEMGEN_Service.cpp.

Referenced by main().

stdair::BookingRequestStruct TRADEMGEN::TRADEMGEN_Service::buildSampleBookingRequest ( const bool  isForCRS = false)

Build a sample booking request structure.

As of now (March 2011), the sample booking request is made of the following parameters:

  • Return trip (inbound): LHR-SYD (POS: LHR, Channel: DN),
  • Departing 10-JUN-2011 around 8:00, staying 7 days
  • Requested on 15-MAY-2011 at 10:00
  • Economy cabin, 3 persons, FF member
  • WTP: 1000.0 EUR
  • Dis-utility: 100.0 EUR/hour

As of now (March 2011), the CRS-related booking request is made of the following parameters:

  • Return trip (inbound): SIN-BKK (POS: SIN, Channel: IN),
  • Departing 30-JAN-2010 around 10:00, staying 7 days
  • Requested on 22-JAN-2010 at 10:00
  • Economy cabin, 3 persons, FF member
  • WTP: 1000.0 EUR
  • Dis-utility: 100.0 EUR/hour
See also:
stdair::CmdBomManager for more details.
Parameters:
constbool isForCRS Whether the sample booking request is for CRS.
Returns:
BookingRequestStruct& Sample booking request structure.

Definition at line 279 of file TRADEMGEN_Service.cpp.

void TRADEMGEN::TRADEMGEN_Service::displayAirlineListFromDB ( ) const

Display the list of airlines, as held within the sample database.

Definition at line 324 of file TRADEMGEN_Service.cpp.

Referenced by main(), and TRADEMGEN::Trademgener::trademgen().

const stdair::Count_T & TRADEMGEN::TRADEMGEN_Service::getExpectedTotalNumberOfRequestsToBeGenerated ( ) const

Get the expected number of events/requests to be generated for all the demand streams.

The getExpectedTotalNbOfEvents() method is called on the underlying EventQueue object, which keeps track of that number.

Note:
That number usually corresponds to an expectation (i.e., the mean value of a random distribution). The actual number will be drawn when calling the generateFirstRequests() method.
Returns:
const stdair::Count_T& Expected number of events to be generated.

Definition at line 385 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

const stdair::Count_T & TRADEMGEN::TRADEMGEN_Service::getActualTotalNumberOfRequestsToBeGenerated ( ) const

Get the actual number of events/requests to be generated for all the demand streams.

The getActualTotalNbOfEvents() method is called on the underlying EventQueue object, which keeps track of that number.

Note:
That number has been drawn when calling the generateFirstRequests() method.
Returns:
const stdair::Count_T& Expected number of events to be generated.

Definition at line 409 of file TRADEMGEN_Service.cpp.

const bool TRADEMGEN::TRADEMGEN_Service::stillHavingRequestsToBeGenerated ( const stdair::DemandStreamKeyStr_T &  iKey,
stdair::ProgressStatusSet &  ioPSS,
const stdair::DemandGenerationMethod &  iDemandGenerationMethod 
) const

Check whether enough requests have already been generated for the demand stream which corresponds to the given key.

Parameters:
constDemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y").
conststdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm.
Returns:
bool Whether or not there are still events to be generated for that demand stream.

Definition at line 433 of file TRADEMGEN_Service.cpp.

stdair::Count_T TRADEMGEN::TRADEMGEN_Service::generateFirstRequests ( const stdair::DemandGenerationMethod &  iDemandGenerationMethod) const

Browse the list of demand streams and generate the first request of each stream.

Parameters:
conststdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm.
Returns:
stdair::Count_T The expected total number of events to be generated

Definition at line 460 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

stdair::BookingRequestPtr_T TRADEMGEN::TRADEMGEN_Service::generateNextRequest ( const stdair::DemandStreamKeyStr_T &  iKey,
const stdair::DemandGenerationMethod &  iDemandGenerationMethod 
) const

Generate a request with the demand stream which corresponds to the given key.

Parameters:
constDemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y").
conststdair::DemandGenerationMethod& States whether the demand generation must be performed following the method based on statistic orders. The alternative method, while more "intuitive", is also a sequential algorithm.
Returns:
stdair::BookingRequestPtr_T (Boost) shared pointer on the booking request structure, which has just been created.

Definition at line 489 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

stdair::ProgressStatusSet TRADEMGEN::TRADEMGEN_Service::popEvent ( stdair::EventStruct &  ioEventStruct) const

Pop the next coming (in time) event, and remove it from the event queue.

  • The next coming (in time) event corresponds to the event having the earliest date-time stamp. In other words, it is the first/front element of the event queue.
  • That (first) event/element is then removed from the event queue
  • The progress status is updated for the corresponding demand stream.
Returns:
stdair::EventStruct A copy of the event structure, which comes first in time from within the event queue.

Definition at line 515 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

bool TRADEMGEN::TRADEMGEN_Service::isQueueDone ( ) const

States whether the event queue has reached the end.

For now, that method states whether the event queue is empty.

Definition at line 534 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

bool TRADEMGEN::TRADEMGEN_Service::generateCancellation ( const stdair::TravelSolutionStruct &  iTravelSolution,
const stdair::PartySize_T &  iPartySize,
const stdair::DateTime_T &  iRequestTime,
const stdair::Date_T &  iDepartureDate 
) const

Generate the potential cancellation event.

Definition at line 557 of file TRADEMGEN_Service.cpp.

void TRADEMGEN::TRADEMGEN_Service::reset ( ) const

Reset the context of the demand streams for another demand generation without having to reparse the demand input file.

Definition at line 584 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().

std::string TRADEMGEN::TRADEMGEN_Service::csvDisplay ( ) const

Recursively display (dump in the returned string) the objects of the BOM tree.

Returns:
std::string Output string in which the BOM tree is logged/dumped.

Definition at line 300 of file TRADEMGEN_Service.cpp.

Referenced by generateDemand().


The documentation for this class was generated from the following files: