TvlSim Logo  1.00.0
C++ Simulated Travel-Oriented Distribution System Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
simulate.cpp File Reference
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <vector>
#include <string>
#include <boost/tokenizer.hpp>
#include <boost/program_options.hpp>
#include <stdair/stdair_basic_types.hpp>
#include <stdair/basic/BasConst_General.hpp>
#include <stdair/basic/BasLogParams.hpp>
#include <stdair/basic/BasDBParams.hpp>
#include <stdair/basic/DemandGenerationMethod.hpp>
#include <stdair/service/Logger.hpp>
#include <simfqt/SIMFQT_Types.hpp>
#include <tvlsim/TVLSIM_Service.hpp>
#include <tvlsim/config/tvlsim-paths.hpp>

Go to the source code of this file.

Typedefs

typedef unsigned int NbOfRuns_T
typedef std::vector< std::string > WordList_T

Functions

const std::string K_TVLSIM_DEFAULT_LOG_FILENAME ("simulate.log")
const std::string K_TVLSIM_DEFAULT_SCHEDULE_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/rds01/schedule.csv")
const std::string K_TVLSIM_DEFAULT_OND_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/ond01.csv")
const std::string K_TVLSIM_DEFAULT_FRAT5_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/frat5.csv")
const std::string K_TVLSIM_DEFAULT_FF_DISUTILITY_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/ffDisutility.csv")
const std::string K_TVLSIM_DEFAULT_YIELD_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/rds01/yield.csv")
const std::string K_TVLSIM_DEFAULT_FARE_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/rds01/fare.csv")
const std::string K_TVLSIM_DEFAULT_DEMAND_INPUT_FILENAME (STDAIR_SAMPLE_DIR"/rds01/demand.csv")
const char K_TVLSIM_DEMAND_GENERATION_METHOD_CHAR ('S')
const std::string K_TVLSIM_DEFAULT_QUERY_STRING ("my good old query")
const std::string K_TVLSIM_DEFAULT_DB_USER ("tvlsim")
const std::string K_TVLSIM_DEFAULT_DB_PASSWD ("tvlsim")
const std::string K_TVLSIM_DEFAULT_DB_DBNAME ("sim_tvlsim")
const std::string K_TVLSIM_DEFAULT_DB_HOST ("localhost")
const std::string K_TVLSIM_DEFAULT_DB_PORT ("3306")
void tokeniseStringIntoWordList (const std::string &iPhrase, WordList_T &ioWordList)
std::string createStringFromWordList (const WordList_T &iWordList)
template<class T >
std::ostream & operator<< (std::ostream &os, const std::vector< T > &v)
int readConfiguration (int argc, char *argv[], bool &ioIsBuiltin, stdair::RandomSeed_T &ioRandomSeed, NbOfRuns_T &ioRandomRuns, std::string &ioQueryString, stdair::Filename_T &ioScheduleInputFilename, stdair::Filename_T &ioOnDInputFilename, stdair::Filename_T &ioFRAT5Filename, stdair::Filename_T &ioFFDisutilityFilename, stdair::Filename_T &ioYieldInputFilename, stdair::Filename_T &ioFareInputFilename, stdair::Filename_T &ioDemandInputFilename, std::string &ioLogFilename, stdair::DemandGenerationMethod &ioDemandGenerationMethod, std::string &ioDBUser, std::string &ioDBPasswd, std::string &ioDBHost, std::string &ioDBPort, std::string &ioDBDBName)
int main (int argc, char *argv[])

Variables

const stdair::RandomSeed_T K_TRADEMGEN_DEFAULT_RANDOM_SEED
const NbOfRuns_T K_TRADEMGEN_DEFAULT_RANDOM_DRAWS = 1
const bool K_TVLSIM_DEFAULT_BUILT_IN_INPUT = false
const int K_TVLSIM_EARLY_RETURN_STATUS = 99

Typedef Documentation

typedef unsigned int NbOfRuns_T

Number of runs to be performed by the simulation.

Definition at line 28 of file simulate.cpp.

typedef std::vector<std::string> WordList_T

List of workds for a query.

Definition at line 33 of file simulate.cpp.


Function Documentation

const std::string K_TVLSIM_DEFAULT_LOG_FILENAME ( "simulate.log"  )

Default name and location for the log file.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_SCHEDULE_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/rds01/schedule.csv"  )

Default name and location for the (CSV) schedule input file.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_OND_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/ond01.csv"  )

Default name and location for the (CSV) O&D input file.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_FRAT5_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/frat5.csv"  )

FRAT5 curve input file name

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_FF_DISUTILITY_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/ffDisutility.csv"  )

Fare family disutility curve input file name

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_YIELD_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/rds01/yield.csv"  )

Default name and location for the (CSV) yield input file.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_FARE_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/rds01/fare.csv"  )

Default name and location for the (CSV) fare input file.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DEMAND_INPUT_FILENAME ( STDAIR_SAMPLE_DIR"/rds01/demand.csv"  )

Default name and location for the (CSV) demand input file.

Referenced by readConfiguration().

const char K_TVLSIM_DEMAND_GENERATION_METHOD_CHAR ( 'S'  )

Default demand generation method name: 'S' for Statistics Order.

Referenced by main(), and readConfiguration().

const std::string K_TVLSIM_DEFAULT_QUERY_STRING ( "my good old query"  )

Default query string.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DB_USER ( "tvlsim"  )

Default name and location for the Xapian database.

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DB_PASSWD ( "tvlsim"  )

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DB_DBNAME ( "sim_tvlsim"  )

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DB_HOST ( "localhost"  )

Referenced by readConfiguration().

const std::string K_TVLSIM_DEFAULT_DB_PORT ( "3306"  )

Referenced by readConfiguration().

void tokeniseStringIntoWordList ( const std::string &  iPhrase,
WordList_T ioWordList 
)

Definition at line 122 of file simulate.cpp.

Referenced by readConfiguration().

std::string createStringFromWordList ( const WordList_T iWordList)

Definition at line 144 of file simulate.cpp.

Referenced by readConfiguration().

template<class T >
std::ostream& operator<< ( std::ostream &  os,
const std::vector< T > &  v 
)

Definition at line 163 of file simulate.cpp.

int readConfiguration ( int  argc,
char *  argv[],
bool &  ioIsBuiltin,
stdair::RandomSeed_T &  ioRandomSeed,
NbOfRuns_T ioRandomRuns,
std::string &  ioQueryString,
stdair::Filename_T &  ioScheduleInputFilename,
stdair::Filename_T &  ioOnDInputFilename,
stdair::Filename_T &  ioFRAT5Filename,
stdair::Filename_T &  ioFFDisutilityFilename,
stdair::Filename_T &  ioYieldInputFilename,
stdair::Filename_T &  ioFareInputFilename,
stdair::Filename_T &  ioDemandInputFilename,
std::string &  ioLogFilename,
stdair::DemandGenerationMethod &  ioDemandGenerationMethod,
std::string &  ioDBUser,
std::string &  ioDBPasswd,
std::string &  ioDBHost,
std::string &  ioDBPort,
std::string &  ioDBDBName 
)

Variable Documentation

const stdair::RandomSeed_T K_TRADEMGEN_DEFAULT_RANDOM_SEED
Initial value:
stdair::DEFAULT_RANDOM_SEED

Default random generation seed (e.g., 120765987).

Definition at line 91 of file simulate.cpp.

Referenced by readConfiguration().

const NbOfRuns_T K_TRADEMGEN_DEFAULT_RANDOM_DRAWS = 1

Default number of random draws to be generated (best if over 100).

Definition at line 97 of file simulate.cpp.

Referenced by readConfiguration().

const bool K_TVLSIM_DEFAULT_BUILT_IN_INPUT = false

Default for the BOM tree building. The BOM tree can either be built-in or provided by an input file. That latter must then be given with input file options (-d, -s, -o, -f, -y).

Definition at line 104 of file simulate.cpp.

Referenced by readConfiguration().

const int K_TVLSIM_EARLY_RETURN_STATUS = 99

Early return status (so that it can be differentiated from an error).

Definition at line 170 of file simulate.cpp.

Referenced by main(), and readConfiguration().