#include <tvlsim/TVLSIM_Service.hpp>
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 SimulationStatus & | getSimulationStatus () |
Interface (API) for the simulator services.
Definition at line 46 of file TVLSIM_Service.hpp.
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.
const | stdair::BasLogParams& Parameters for the output log stream. |
const | stdair::BasDBParams& Parameters for the database access. |
const | stdair::Date_T& Start date of the simulation. |
const | stdair::Date_T& End date of the simulation. |
const | stdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen). |
const | stdair::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. |
const | NbOfRuns_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.
const | stdair::BasLogParams& Parameters for the output log stream. |
const | stdair::Date_T& Start date of the simulation. |
const | stdair::Date_T& End date of the simulation. |
const | stdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen). |
const | stdair::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. |
const | NbOfRuns_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).
stdair::STDAIR_ServicePtr_T | Reference on the STDAIR service. |
const | stdair::Date_T& Start date of the simulation. |
const | stdair::Date_T& End date of the simulation. |
const | stdair::RandomSeed_T& Seed for the random generation used by the demand generation component (TraDemGen). |
const | stdair::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. |
const | NbOfRuns_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.
void TVLSIM::TVLSIM_Service::simulate | ( | ) |
Perform a simulation.
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.
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.
const | stdair::ScheduleFilePath& Filename of the input schedule file. |
const | stdair::ODFilePath& Filename of the input O&D file. |
const | stdair::FRAT5FilePath& Filename of the input FRAT5 file. |
const | stdair::FFDisutilityFilePath& Filename of the input FF disutility file. |
const | AIRRAC::YieldFilePath& Filename of the input yield file. |
const | SIMFQT::FareFilePath& Filename of the input fare file. |
const | TRADEMGEN::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().
const stdair::Count_T TVLSIM::TVLSIM_Service::initBreakPointEvents | ( | const stdair::BreakPointList_T & | iBreakPointList | ) |
Initialise the break points.
const | stdair::BreakPointList_T& List of break points to add to the simulation event 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:
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:
As of now (March 2011), the CRS-related booking request is made of the following parameters:
const | bool isForCRS Whether the sample booking request is for CRS. |
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.
const | std::string& Key for the segment on which the sale is made |
const | stdair::ClassCode_T& Class code where the sale is made |
const | stdair::PartySize_T& Party size |
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.
const | stdair::JSONString& Input string which contained the JSon command string. |
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.
Definition at line 1051 of file TVLSIM_Service.cpp.
std::string TVLSIM::TVLSIM_Service::configDisplay | ( | ) | const |
Display (dump in the returned string) the configuration.
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.
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.
const | stdair::EventType::EN_EventType& Type of the events to display. |
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.
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.
const | AirlineCode& Airline for which the flight-dates should be displayed. If set to "all" (the default), all the inventories will be displayed. |
const | FlightNumber_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. |
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.
const | stdair::AirlineCode_T& Airline code of the flight to display |
const | stdair::FlightNumber_T& Flight number of the flight to display. |
const | stdair::Date_T& Departure date of the flight to display. |
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.