TvlSim Logo  1.00.0
C++ Simulated Travel-Oriented Distribution System Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TVLSIM::TVLSIM_Service Class Reference

#include <tvlsim/TVLSIM_Service.hpp>

List of all members.

Public Member Functions

 TVLSIM_Service (const stdair::BasLogParams &, const stdair::BasDBParams &, const stdair::Date_T &iStartDate, const stdair::Date_T &iEndDate, const stdair::RandomSeed_T &, const stdair::DemandGenerationMethod &, const NbOfRuns_T &iNbOfRuns=DEFAULT_NUMBER_OF_RUNS)
 TVLSIM_Service (const stdair::BasLogParams &, const stdair::Date_T &iStartDate, const stdair::Date_T &iEndDate, const stdair::RandomSeed_T &, const stdair::DemandGenerationMethod &, const NbOfRuns_T &iNbOfRuns=DEFAULT_NUMBER_OF_RUNS)
 TVLSIM_Service (stdair::STDAIR_ServicePtr_T, const stdair::Date_T &iStartDate, const stdair::Date_T &iEndDate, const stdair::RandomSeed_T &, const stdair::DemandGenerationMethod &, const NbOfRuns_T &iNbOfRuns=DEFAULT_NUMBER_OF_RUNS)
 ~TVLSIM_Service ()
void simulate ()
void optimise (const stdair::RMEventStruct &)
void displayAirlineListFromDB () const
void buildSampleBom ()
void setInputFiles (const stdair::ScheduleFilePath &, const stdair::ODFilePath &, const stdair::FRAT5FilePath &, const stdair::FFDisutilityFilePath &, const AIRRAC::YieldFilePath &, const SIMFQT::FareFilePath &, const TRADEMGEN::DemandFilePath &)
void parseAndLoad ()
void initSnapshotAndRMEvents ()
const stdair::Count_T initBreakPointEvents (const stdair::BreakPointList_T &)
void reinitServices ()
void buildSampleTravelSolutions (stdair::TravelSolutionList_T &)
stdair::BookingRequestStruct buildSampleBookingRequest (const bool isForCRS=false)
void reset ()
bool sell (const std::string &iSegmentDateKey, const stdair::ClassCode_T &, const stdair::PartySize_T &)
std::string jsonHandler (const stdair::JSONString &)
std::string csvDisplay () const
std::string configDisplay () const
std::string listEvents () const
std::string listEvents (const stdair::EventType::EN_EventType &) const
std::string simulationStatusDisplay () const
std::string list (const stdair::AirlineCode_T &iAirlineCode="all", const stdair::FlightNumber_T &iFlightNumber=0) const
std::string csvDisplay (const stdair::AirlineCode_T &, const stdair::FlightNumber_T &, const stdair::Date_T &iDepartureDate) const
const SimulationStatusgetSimulationStatus ()

Detailed Description

Interface (API) for the simulator services.

Definition at line 46 of file TVLSIM_Service.hpp.


Constructor & Destructor Documentation

TVLSIM::TVLSIM_Service::TVLSIM_Service ( const stdair::BasLogParams &  iLogParams,
const stdair::BasDBParams &  iDBParams,
const stdair::Date_T &  iStartDate,
const stdair::Date_T &  iEndDate,
const stdair::RandomSeed_T &  iRandomSeed,
const stdair::DemandGenerationMethod &  iDemandGenerationMethod,
const NbOfRuns_T iNbOfRuns = DEFAULT_NUMBER_OF_RUNS 
)

Constructor.

The init() 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::Date_T& Start date of the simulation.
conststdair::Date_T& End date of the simulation.
conststdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen).
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.
constNbOfRuns_T& Number of simulation runs to be performed.

Definition at line 107 of file TVLSIM_Service.cpp.

TVLSIM::TVLSIM_Service::TVLSIM_Service ( const stdair::BasLogParams &  iLogParams,
const stdair::Date_T &  iStartDate,
const stdair::Date_T &  iEndDate,
const stdair::RandomSeed_T &  iRandomSeed,
const stdair::DemandGenerationMethod &  iDemandGenerationMethod,
const NbOfRuns_T iNbOfRuns = DEFAULT_NUMBER_OF_RUNS 
)

Constructor.

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

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

Moreover, 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::Date_T& Start date of the simulation.
conststdair::Date_T& End date of the simulation.
conststdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen).
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.
constNbOfRuns_T& Number of simulation runs to be performed.

Definition at line 64 of file TVLSIM_Service.cpp.

TVLSIM::TVLSIM_Service::TVLSIM_Service ( stdair::STDAIR_ServicePtr_T  ioSTDAIR_Service_ptr,
const stdair::Date_T &  iStartDate,
const stdair::Date_T &  iEndDate,
const stdair::RandomSeed_T &  iRandomSeed,
const stdair::DemandGenerationMethod &  iDemandGenerationMethod,
const NbOfRuns_T iNbOfRuns = DEFAULT_NUMBER_OF_RUNS 
)

Constructor.

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

Moreover, as no reference on any output stream 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 TVLSIM_Service is itself being initialised by another library service. However, there is currently no other known library service using/calling TvlSim).

Parameters:
stdair::STDAIR_ServicePtr_TReference on the STDAIR service.
conststdair::Date_T& Start date of the simulation.
conststdair::Date_T& End date of the simulation.
conststdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen).
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.
constNbOfRuns_T& Number of simulation runs to be performed.

Definition at line 151 of file TVLSIM_Service.cpp.

TVLSIM::TVLSIM_Service::~TVLSIM_Service ( )

Destructor.

Definition at line 189 of file TVLSIM_Service.cpp.


Member Function Documentation

void TVLSIM::TVLSIM_Service::simulate ( )

Perform a simulation.

Note:
Currently, the multi-run piece of functionality does not work properly. Indeed, only the demand generation service context is resetted correctly; the inventories, schedules, etc, are not resetted at all. Achieving a fully working multi-run simulation framework will require some significant work. In the meantime, a work around is to launch in a row several mono-run simulations, with a distinct random generation seed for every simulation run.

Definition at line 1272 of file TVLSIM_Service.cpp.

References TVLSIM::SimulationMode::BREAK, TVLSIM::SimulationStatus::displayEndStatusMessage(), TVLSIM::SimulationStatus::displayStartStatusMessage(), TVLSIM::SimulationMode::DONE, TVLSIM::SimulationStatus::getCurrentRun(), TVLSIM::SimulationStatus::getMode(), and TVLSIM::SimulationStatus::isTheSimulationDone().

Referenced by main().

void TVLSIM::TVLSIM_Service::optimise ( const stdair::RMEventStruct &  iRMEvent)

Optimise (revenue management) a flight-date/network-date

Definition at line 1422 of file TVLSIM_Service.cpp.

void TVLSIM::TVLSIM_Service::displayAirlineListFromDB ( ) const

Display the list of airlines.

Definition at line 1344 of file TVLSIM_Service.cpp.

Referenced by main().

void TVLSIM::TVLSIM_Service::buildSampleBom ( )

Build a sample BOM tree, and attach it to the BomRoot instance.

As for now, the BOM sample tree is the one built by the SimCRS and TraDemGen components.

See also:
SIMCRS::SIMCRS_Service, TRADEMGEN::TRADEMGEN_Service and stdair::CmdBomManager for more details.

Definition at line 619 of file TVLSIM_Service.cpp.

Referenced by main().

void TVLSIM::TVLSIM_Service::setInputFiles ( const stdair::ScheduleFilePath &  iScheduleInputFilename,
const stdair::ODFilePath &  iODInputFilename,
const stdair::FRAT5FilePath &  iFRAT5InputFilename,
const stdair::FFDisutilityFilePath &  iFFDisutilityInputFilename,
const AIRRAC::YieldFilePath &  iYieldInputFilepath,
const SIMFQT::FareFilePath &  iFareInputFilepath,
const TRADEMGEN::DemandFilePath &  iDemandFilepath 
)

Load the schedule, O&D, FRAT5, FFDisutility, yield, fare and demand input files.

The CSV files, describing the airline schedule, O&Ds, fares and yields for the simulator, are instantiated in the configuration holder.

Parameters:
conststdair::ScheduleFilePath& Filename of the input schedule file.
conststdair::ODFilePath& Filename of the input O&D file.
conststdair::FRAT5FilePath& Filename of the input FRAT5 file.
conststdair::FFDisutilityFilePath& Filename of the input FF disutility file.
constAIRRAC::YieldFilePath& Filename of the input yield file.
constSIMFQT::FareFilePath& Filename of the input fare file.
constTRADEMGEN::DemandFilePath& Filename of the input demand file.

Definition at line 480 of file TVLSIM_Service.cpp.

References TVLSIM::ConfigImport::importFiles().

Referenced by main().

void TVLSIM::TVLSIM_Service::parseAndLoad ( )

Parse the schedule, O&D, FRAT5, FFDisutility, yield, fare and demand input files.

The CSV files, describing the airline schedule, O&Ds, fares and yields for the simulator, are parsed and instantiated in memory accordingly.

Definition at line 513 of file TVLSIM_Service.cpp.

Referenced by main().

void TVLSIM::TVLSIM_Service::initSnapshotAndRMEvents ( )

Initialise the snapshot and RM events for the inventories.

Definition at line 1015 of file TVLSIM_Service.cpp.

References TVLSIM::SimulationStatus::getEndDate(), and TVLSIM::SimulationStatus::getStartDate().

Referenced by main(), and reset().

const stdair::Count_T TVLSIM::TVLSIM_Service::initBreakPointEvents ( const stdair::BreakPointList_T &  iBreakPointList)

Initialise the break points.

Parameters:
conststdair::BreakPointList_T& List of break points to add to the simulation event queue.
Returns:
const stdair::Count_T Number of break points actually added to the queue (some break points might be outside the simulation period, and thus are not added to the queue).

Definition at line 986 of file TVLSIM_Service.cpp.

void TVLSIM::TVLSIM_Service::reinitServices ( )

Re-initialise the simulation service, as well as all the other component services (e.g., SimCRS, TraDemGen, TravelCCM).

Definition at line 427 of file TVLSIM_Service.cpp.

void TVLSIM::TVLSIM_Service::buildSampleTravelSolutions ( stdair::TravelSolutionList_T &  ioTravelSolutionList)

Build a sample list of travel solutions.

As of now (March 2011), that list is made of the following travel solutions:

  • BA9
  • LHR-SYD
  • 2011-06-10
  • Q
  • WTP: 900
  • Change fee: 20; Non refundable; Saturday night stay
See also:
stdair::CmdBomManager for more details.
Parameters:
TravelSolutionList_T&Sample list of travel solution structures. It should be given empty. It is altered with the returned sample.

Definition at line 766 of file TVLSIM_Service.cpp.

stdair::BookingRequestStruct TVLSIM::TVLSIM_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 786 of file TVLSIM_Service.cpp.

void TVLSIM::TVLSIM_Service::reset ( )

Reset the context of the service

Definition at line 1160 of file TVLSIM_Service.cpp.

References initSnapshotAndRMEvents(), and TVLSIM::SimulationStatus::reset().

Referenced by jsonHandler().

bool TVLSIM::TVLSIM_Service::sell ( const std::string &  iSegmentDateKey,
const stdair::ClassCode_T &  iClassCode,
const stdair::PartySize_T &  iPartySize 
)

Register a booking.

Parameters:
conststd::string& Key for the segment on which the sale is made
conststdair::ClassCode_T& Class code where the sale is made
conststdair::PartySize_T& Party size
Returns:
bool Whether or not the sale was successfull

Definition at line 805 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::jsonHandler ( const stdair::JSONString &  iJSONString)

Dispatch the JSon command string to the right service: itself (TvlSim service), SimCRS service or TraDemGen service.

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 828 of file TVLSIM_Service.cpp.

References TVLSIM::BomJSONExport::jsonExportSimulationStatus(), and reset().

std::string TVLSIM::TVLSIM_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 1051 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::configDisplay ( ) const

Display (dump in the returned string) the configuration.

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

Definition at line 1402 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::listEvents ( ) 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 1071 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::listEvents ( const stdair::EventType::EN_EventType &  iEventType) const

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

Parameters:
conststdair::EventType::EN_EventType& Type of the events to display.
Returns:
std::string Output string in which the events are logged/dumped.

Definition at line 1094 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::simulationStatusDisplay ( ) const

Recursively display (dump in the returned string) the simulation status.

Returns:
std::string Output string in which the simulation status is logged/dumped.

Definition at line 1251 of file TVLSIM_Service.cpp.

References TVLSIM::SimulationStatus::describe().

std::string TVLSIM::TVLSIM_Service::list ( const stdair::AirlineCode_T &  iAirlineCode = "all",
const stdair::FlightNumber_T &  iFlightNumber = 0 
) const

Display the list of flight-dates (contained within the BOM tree) corresponding to the parameters given as input.

Parameters:
constAirlineCode& Airline for which the flight-dates should be displayed. If set to "all" (the default), all the inventories will be displayed.
constFlightNumber_T& Flight number for which all the departure dates should be displayed. If set to 0 (the default), all the flight numbers will be displayed.
Returns:
std::string Output string in which the BOM tree is logged/dumped.

Definition at line 1117 of file TVLSIM_Service.cpp.

std::string TVLSIM::TVLSIM_Service::csvDisplay ( const stdair::AirlineCode_T &  iAirlineCode,
const stdair::FlightNumber_T &  iFlightNumber,
const stdair::Date_T &  iDepartureDate 
) const

Recursively display (dump in the returned string) the flight-date corresponding to the parameters given as input.

Parameters:
conststdair::AirlineCode_T& Airline code of the flight to display
conststdair::FlightNumber_T& Flight number of the flight to display.
conststdair::Date_T& Departure date of the flight to display.
Returns:
std::string Output string in which the BOM tree is logged/dumped.

Definition at line 1138 of file TVLSIM_Service.cpp.

const SimulationStatus & TVLSIM::TVLSIM_Service::getSimulationStatus ( )

Get the simulation status.

Definition at line 1441 of file TVLSIM_Service.cpp.


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