The SimFQT
library contains classes for fare rule management. This document does not cover all the aspects of the SimFQT
library. It does however explain the most important things you need to know in order to start using SimFQT
.
Clone locally the full Git project:
cd ~ mkdir -p dev/sim cd ~/dev/sim git clone git://simfqt.git.sourceforge.net/gitroot/simfqt/simfqt simfqtgit cd simfqtgit git checkout trunk
Link with StdAir, create the distribution package (say, 0.5.0) and compile using the following commands:
cd ~/dev/sim/simfqtgit rm -rf build && mkdir -p build cd build cmake -DCMAKE_INSTALL_PREFIX=~/dev/deliveries/simfqt-0.5.0 \ -DWITH_STDAIR_PREFIX=~/dev/deliveries/stdair-stable \ -DCMAKE_BUILD_TYPE:STRING=Debug -DINSTALL_DOC:BOOL=ON .. make
After building the SimFQT project, the following commands run the tests:
cd ~/dev/sim/simfqtgit cd build make check
As a result, you should obtain a similar report:
[ 0%] Built target hdr_cfg_simfqt [ 90%] Built target simfqtlib [100%] Built target FQTTestSuitetst Test project /home/localoriuser/dev/sim/simfqt/simfqtgit/build/test/simfqt Start 1: FQTTestSuitetst 1/1 Test #1: FQTTestSuitetst .................. Passed 0.15 sec 100% tests passed, 0 tests failed out of 1 Total Test time (real) = 0.16 sec [100%] Built target check_simfqttst [100%] Built target check
After the step Build the SimFQT project, to install the library and its header files, type:
cd ~/dev/sim/simfqtgit cd build make install
You can check that the executables and other required files have been copied into the given final directory:
cd ~dev/deliveries/simfqt-0.5.0
To generate the SimFQT project documentation, the commands are:
cd ~/dev/sim/simfqtgit cd build make doc
The SimFQT project documentation is available in the following formats: HTML, LaTeX. Those documents are available in a subdirectory:
cd ~/dev/sim/simfqtgit cd build cd doc
The fare input file structure should look like the following sample:
Each line represents a fare rule (see SIMFQT::FareRuleStruct
), i.e., each line tells us the price a customer will be asked according to a lot of criteria such as:
Some fare input examples (including the example above named fare01.csv) are given in the stdair::samples directory.
The Fare Quoting Business Object Model (BOM) tree is a structure permitting to store all the SIMFQT::FareRuleStruct
objects of the simulation. That is why, the BOM tree is built parsing the fare file containing all the fare rules (as described in the previous section Input file of SimFQT Project). For convenience and first use of SimFQT (the input fare file building can be long and heavy), SimFQT API enables to build a small default BOM tree.
First, a BOM root object (i.e., a root for all the classes in the project) is instantiated by the stdair::STDAIR_ServiceContext
context object, when the stdair::STDAIR_Service
is itself instantiated, that is to say during the instanciation of the simfqt::SIMFQT_Service
object. The corresponding type
(class) stdair::BomRoot
is defined in the StdAir library.
Then, the BOM root can be either constructed thanks to the simfqt::SIMFQT_Service::buildSampleBom()
method:
or can be constructed using the fare dump file described above thanks to the simfqt::SIMFQT_Service::parseAndLoad (const stdair::Filename_T&)
method:
The fare quoting BOM tree can be displayed as done in the batches::simfqt.cpp
program:
When the default bom tree is used (-b
option of the main program simfqt.cpp
), the fare quoting BOM tree display should look like:
Here the fare quoting BOM tree is just composed of one fare rule.
As one can guess looking at the BOM tree display above, the tree is constructed as follow:
stdair::BomRoot
object (i.e., a root for all the classes in the project).stdair::AirportPair
objects (i.e., all the possible combinations of origin-destination). In the instance above, the only combination possible is from London to Sydney.stdair::AirportPair
, we find all the date periods of the fare rules applicable for this origin-destination.stdair::DatePeriod
, we find all the possible combinations of point-of-sale and channel applicable.stdair::PosChannel
object, we have the correponding stdair::TimePeriod
objects.stdair::FareFeatures
objects, that is to say the trip type, the advanced purchase and stay duration required, ...The project SimFQT aims at fare quoting a list of travel solutions corresponding to a booking request. The fare quoter looks for all the fare rules matching a travel solution: when a fare rule matches, it creates a fare option object and adds this object to the current travel solution.
A few steps:
A default booking request can be built using the simfqt::SIMFQT_Service::buildBookingRequest
method:
In the following sample, a list of travel solutions is given as input/output parameter of the simfqt::SIMFQT_Service::buildSampleTravelSolutions
method:
Once a booking request, its correponding list of travel solutions and the fare Quote BOM tree are constructed, the main fonction of the module can be called:
For each travel solution of the list, the applicable fare rules are picked from the BOM tree (information such as the trip type or the booking request date are only contained into the booking request, that is why we need this object too).
Each chosen fare rule enables to create a fare option structure which is finally stored into the travel solution.
This section lists the fatal errors you may encounter when using SimFQT:
In this case, the output error message will be similar to:
terminate called after throwing an instance of 'SIMFQT::FareInputFileNotFoundException' what(): The fare input file '~/<YourFileName>.csv' does not exist or can not be read Aborted
You can check:
This error message means that your input file has been opened but has not been fully read.
terminate called after throwing an instance of 'SIMFQT::FareFileParsingFailedException' what(): Parsing of fare input file: ~/<YourFileName>.csv failed Aborted
Your input file structure is somehow incorrect. See the tutorial section How to build a fare input file?.
If you obtain one of the error messages below and you are currently using your own input file, that means it has been fully read. However, at least one fare rule is missing to complete the fare quote.
terminate called after throwing an instance of 'SIMFQT::AirportPairNotFoundException' what(): No available fare rule for the Origin-Destination pair: xxx, xxx AbortedYou need to be sure that all your travel solutions have at least one corresponding origin-destination fare rule. It seems you should add one origin-destination (i.e., xxx, xxx) fare rule into your input file.
terminate called after throwing an instance of 'SIMFQT::FlightDateNotFoundException' what(): No available fare rule for the flight date x, xxxx-xxx-xx and to the Origin-Destination pair: xxx, xxx AbortedYou need to be sure that all your travel solutions have at least one corresponding fare rule: same origin-destination and valid date range. It seems you should add/change a fare rule with the Origin-Destination pair: xxx, xxx: its date range must include the flight date xxxx-xxx-xx.
terminate called after throwing an instance of 'SIMFQT::PosOrChannelNotFoundException' what(): No available fare rule for the point of sale xxx, the channel xx, the flight date x, xxxx-xxx-xx and the Origin-Destination pair: xxx, xxx AbortedYou need to be sure that all your travel solutions have at least one corresponding fare rule: same origin-destination, valid date range, same point-of-sale and same channel. It seems you should add/change a fare rule to have the same combination as given in the output error message: "the point of sale xxx, the channel xx, the flight date x, xxxx-xxx-xx and the Origin-Destination pair: xxx, xxx".
terminate called after throwing an instance of 'SIMFQT::FlightTimeNotFoundException' what(): No available fare rule corresponding to 'xx; x, xxxx-xxx-xx; xxx, xxx; xx:xx' (parsed key) and to 'xxx, xx' (POS and channel) AbortedYou need to be sure that all your travel solutions have at least one corresponding fare rule: same origin-destination, valid date range, same point-of-sale, same channel and valid time range. Add/change a fare rule if necessary.
terminate called after throwing an instance of 'SIMFQT::FeaturesNotFoundException' what(): No available fare rule corresponding to a trip type xx, to a stay duration of x, to a request date time of xxxx-xxx-xx xx:xx:xx, to 'xx; x, xxxx-xxx-xx; xxx, xxx; xx:xx' (parsed key) and to 'xxx, xx' (POS and channel), to 'xx; x, xxxx-xxx-xx; xxx, xxx; xx:xx' (parsed key) and to 'xxx, xx' (POS and channel) AbortedYou need to be sure that all your travel solutions have at least one corresponding fare rule: same origin-destination, valid date range, same point-of-sale, same channel, valid time range and valid features. The features are:
terminate called after throwing an instance of 'SIMFQT::AirlineNotFoundException' what(): No available fare rule corresponding to 'xx; x, xxxx-xxx-xx; xxx, xxx; xx:xx' (parsed key), to 'xxxx-xxx-xx xx:xx:xx, for (xxx, xx) xxx-xxx (xx) xxxx-xxx-xx (x days) xx:xx:xx x x x x x' (booking request) and to 'xxx, xx' (POS and channel) AbortedAt least one of your fare rules is correct except that the fare into question must be defined by the airline operating (see the first two letters of the parsed key in the error message to know which airline is operating).