TraDemGen Logo  1.00.0
C++ Simulated Travel Demand Generation Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
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, SEVMGR::SEVMGR_ServicePtr_T, const stdair::RandomSeed_T &)
void parseAndLoad (const DemandFilePath &)
 ~TRADEMGEN_Service ()
void buildSampleBom ()
void clonePersistentBom ()
void buildComplementaryLinks (stdair::BomRoot &)
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
bool hasDemandStream (const stdair::DemandStreamKeyStr_T &) 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
const stdair::ProgressStatus & getProgressStatus () const
const stdair::ProgressStatus & getProgressStatus (const stdair::EventType::EN_EventType &) const
std::string jsonHandler (const stdair::JSONString &) const
std::string csvDisplay () const
std::string list () const
std::string list (const stdair::EventType::EN_EventType &) const
std::string displayDemandStream () const

Detailed Description

class holding the services related to Travel Demand Generation.

Definition at line 44 of file TRADEMGEN_Service.hpp.


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 78 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 54 of file TRADEMGEN_Service.cpp.

TRADEMGEN::TRADEMGEN_Service::TRADEMGEN_Service ( stdair::STDAIR_ServicePtr_T  ioSTDAIR_Service_ptr,
SEVMGR::SEVMGR_ServicePtr_T  ioSEVMGR_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 TVLSIM_Service).

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

Definition at line 104 of file TRADEMGEN_Service.cpp.

TRADEMGEN::TRADEMGEN_Service::~TRADEMGEN_Service ( )

Destructor.

Definition at line 125 of file TRADEMGEN_Service.cpp.


Member Function Documentation

void TRADEMGEN::TRADEMGEN_Service::parseAndLoad ( const DemandFilePath iDemandFilePath)

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:
constDemandFilePath& Filename of the input demand file.

Definition at line 241 of file TRADEMGEN_Service.cpp.

References buildComplementaryLinks(), clonePersistentBom(), and generateDemand().

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

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 310 of file TRADEMGEN_Service.cpp.

References buildComplementaryLinks(), and clonePersistentBom().

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

void TRADEMGEN::TRADEMGEN_Service::clonePersistentBom ( )

Clone the persistent BOM object.

Definition at line 382 of file TRADEMGEN_Service.cpp.

References buildComplementaryLinks().

Referenced by buildSampleBom(), and parseAndLoad().

void TRADEMGEN::TRADEMGEN_Service::buildComplementaryLinks ( stdair::BomRoot &  ioBomRoot)

Build all the complementary links in the given bom root object.

Note:
Do nothing for now.

Definition at line 419 of file TRADEMGEN_Service.cpp.

Referenced by buildSampleBom(), clonePersistentBom(), and parseAndLoad().

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 425 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 535 of file TRADEMGEN_Service.cpp.

Referenced by main().

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

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

Calls the SEvMgr service with the same name "getExpectedTotalNumberOfRequestsToBeGenerated", which computes 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 596 of file TRADEMGEN_Service.cpp.

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

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

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

Calls the SEvMgr service with the same name "getActualTotalNumberOfRequestsToBeGenerated", which computes 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 617 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 638 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 663 of file TRADEMGEN_Service.cpp.

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

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 689 of file TRADEMGEN_Service.cpp.

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

bool TRADEMGEN::TRADEMGEN_Service::hasDemandStream ( const stdair::DemandStreamKeyStr_T &  iDemandStreamKey) const

States whether a demand stream with the given key is used to generate demand.

Parameters:
constDemandStreamKey& A string identifying uniquely the demand stream (e.g., "SIN-HND 2010-Feb-08 Y").

Definition at line 868 of file TRADEMGEN_Service.cpp.

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

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

  • 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 713 of file TRADEMGEN_Service.cpp.

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

bool TRADEMGEN::TRADEMGEN_Service::isQueueDone ( ) const

States whether the event queue has reached the end.

Calls the SEvMgr service with the same name "isQueueDone", which states whether the event queue has reached the end.

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

Definition at line 729 of file TRADEMGEN_Service.cpp.

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

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 749 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 811 of file TRADEMGEN_Service.cpp.

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

const stdair::ProgressStatus & TRADEMGEN::TRADEMGEN_Service::getProgressStatus ( ) const

Get the overall progress status (for the whole event queue).

Definition at line 832 of file TRADEMGEN_Service.cpp.

const stdair::ProgressStatus & TRADEMGEN::TRADEMGEN_Service::getProgressStatus ( const stdair::EventType::EN_EventType &  iEventType) const

Get the progress status for the given event type (e.g., booking request, optimisation notification, schedule change, break point).

Definition at line 850 of file TRADEMGEN_Service.cpp.

std::string TRADEMGEN::TRADEMGEN_Service::jsonHandler ( const stdair::JSONString &  iJSONString) const

Dispatch the JSon command string to the SEvMgr service. (Only SEvMgr has json export commands for now).

Parameters:
conststdair::JSONString& Input string which contained the JSon command string.
Returns:
std::string Output string in which the asking objects are logged/dumped with a JSon format.

Definition at line 447 of file TRADEMGEN_Service.cpp.

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 468 of file TRADEMGEN_Service.cpp.

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

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

Display (dump in the returned string) the event list of the event queue.

Returns:
std::string Output string in which the events are logged/dumped.

Definition at line 490 of file TRADEMGEN_Service.cpp.

std::string TRADEMGEN::TRADEMGEN_Service::list ( const stdair::EventType::EN_EventType &  iEventType) const

Display (dump in the returned string) the events with the given type

Returns:
std::string Output string in which the events are logged/dumped.

Definition at line 513 of file TRADEMGEN_Service.cpp.

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

Display (dump in the returned string) the demand streams

Returns:
std::string Output string in which the demand streams are logged/dumped.

Definition at line 885 of file TRADEMGEN_Service.cpp.

References TRADEMGEN::DemandStream::describeKey().


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