Package: trademgen
C++ Simulated Travel Demand Generation LibrarySummaryTraDemGen aims at providing a clean API, and the corresponding
C++ implementation, able to generate demand for travel solutions
(e.g., from JFK to PEK on 25-05-2019) according to characteristics
(e.g., Willingness-To-Pay, preferred airline, etc).TraDemGen makes an extensive use of existing open-source libraries for
increased functionality, speed and accuracy. In particular the
Boost (C++ Standard Extensions:https://www.boost.org) library is used.TraDemGen is the one of the components of the Travel Market Simulator
(https://travel-sim.org). However, it may be used in a
stand-alone mode.InstallationOn Fedora/CentOS/RedHat distributionJust use DNF (or Yum on older distributions):$dnf-yinstalltrademgen-develtrademgen-docYou can also get the RPM packages (which may work on Linux
distributions like Suse and Mandriva) from the Fedora repository
(e.g., for Fedora 32,https://fr2.rpmfind.net/linux/RPM/fedora/32/x86_64/)Building the library and test binary from Git repositoryThe Git repository may be cloned as following:$gitclonegit@github.com:airsim/trademgen.gittrademgengit# through SSH$gitclonehttps://github.com/airsim/trademgen.git# if the firewall filters SSH$cdtrademgengitThen, you need the following packages (Fedora/RedHat/CentOS names here,
but names may vary according to distributions):cmakegcc-c++boost-devel / libboost-devpython-devel / python-devgettext-devel / gettext-devsqlite3-devel / libsqlite3-devreadline-devel / readline-devncurses-develsoci-mysql-devel, soci-sqlite3-develstdair-devel / libstdair-devsevmgr-devel / libsevmgr-devdoxygen, ghostscript, graphviztetex-latex (optional)rpm-build (optional)Building the library and test binary from the tarballThe latest stable source tarball (trademgen*.tar.gzor.bz2) can be
found on GitHub:https://github.com/airsim/trademgen/tags,e.g.,https://github.com/airsim/trademgen/archive/trademgen-1.00.6.tar.gzAs TraDemGen depends on otherTravel Market Simulator (TvlSim/AirSim)modules, more specificallyStdAirandSEvMgr, it may be
convenient to use theMetaSim project,
which pulls at once all the components of TvlSim in the same place,
and then orchestrates the dependencies for the builds, installations
and use of components.If MetaSim is not used, in order to customise the following to your
environment, you can alter the path to the installation directory:exportINSTALL_BASEDIR="/home/user/dev/deliveries"exportTDG_VER="1.00.6"if[-d/usr/lib64];thenLIBSUFFIX="64";fiexportLIBSUFFIX_4_CMAKE="-DLIB_SUFFIX=${LIBSUFFIX}"Then, as usual:To configure the project, type something like:mkdirbuild&&cdbuildcmake-DCMAKE_INSTALL_PREFIX=${INSTALL_BASEDIR}/trademgen-$TDG_VER\-DWITH_SEVMGR_PREFIX=${INSTALL_BASEDIR}/sevmgr-stable\-DWITH_STDAIR_PREFIX=${INSTALL_BASEDIR}/stdair-stable\-DCMAKE_BUILD_TYPE:STRING=Debug-DENABLE_TEST:BOOL=ON\-DINSTALL_DOC:BOOL=ON-DRUN_GCOV:BOOL=OFF${LIBSUFFIX_4_CMAKE}..To build the project, type:makeTo test the project, type:makecheckTo install the library (libtrademgen*.so*) and the binary (trademgen),
just type:makeinstallcd${INSTALL_BASEDIR}rm-ftrademgen-stable&&ln-strademgen-${TDG_VER}trademgen-stablecd-To package the source files, type:makedistTo package the binary and the (HTML and PDF) documentation:makepackageTo browse the (just installed, if enabled) HTML documentation:midorifile://${INSTALL_BASEDIR}/trademgen-$TDG_VER/share/doc/trademgen/html/index.htmlTo browse the (just installed, if enabled) PDF documentation:evince${INSTALL_BASEDIR}/trademgen-$TDG_VER/share/doc/trademgen/html/refman.pdfTo run the local binary version:./trademgen/trademgen-bTo run the installed version:${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/trademgen-b${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/pytrademgen${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/trademgen_generateDemand${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/trademgen_extractBookingRequests${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/trademgen_drawBookingArrivals${INSTALL_BASEDIR}/trademgen-${TDG_VER}/bin/trademgen_with_dbPython extensionThe way to interact with a C++-based Python extension is extensively described
in theOpenTREP project.
Only a quick start is given here.Python dependenciesInstall Python dependencies:$python3-mpipinstall-Upip
$python3-mpipinstall-Uwheel
$python3-mpipinstall-Ubuildsetuptoolsscikit-buildtoxpytestsphinxtwineBuild the Python extensionBuild the Python extension with SciKit-Build:$rm-rf_skbuild/dist/MANIFEST_
$python3setup.py--build-type=Debugbuildsdistbdist_wheelThe Python artifacts should be similar to:$ls-lFhdist/
total5872-rw-r--r--1userstaff2.0MJun115:49rmol-1.0.5.post1-cp38-cp38-macosx_10_15_x86_64.whl
-rw-r--r--1userstaff834KJun115:49rmol-1.0.5.post1.tar.gzUpdload the RMOL Python extension onto PyPi:$twineupload-u__token__--repository-urlhttps://upload.pypi.org/legacy/dist/*The RMOL Python artifacts may then be browsed on PyyPI:https://pypi.org/project/rmol/Use the Python extensionLaunch the Python interpreter:$exportPYTHONPATH=${PWD}/_skbuild/macosx-10.15-x86_64-3.8/cmake-install/lib:${PWD}/_skbuild/macosx-10.15-x86_64-3.8/cmake-install/lib/python3.8/site-packages/pyrmol
$DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylibASAN_OPTIONS=detect_container_overflow=0/usr/local/Cellar/python@3.8/3.8.3/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/PythonWithin the Python interpreter, import, initialize
and use the RMOL Python extension:Python3.8.3(default,May272020,20:54:22)[Clang11.0.3(clang-1103.0.32.59)]ondarwinType"help","copyright","credits"or"license"formoreinformation.>>>importpyrmol>>>rmolLibrary=pyrmol.RMOLer()>>>rmolLibrary.init('rmol.log',40,1,'')True>>>rmolLibrary.rmol(100,10,40.0)'RMOL has completed the generation of the booking requests. See the log file for more details.\n'>>>quit()Back to the Shell session, look for the results in the RMOL log file:$catrmol.log
Pythonwrapperinitialisation[D]${STDAIR_PREFIX}/stdair/command/CmdBomManager.cpp:52:StdAirisbuildingtheBOMtreefrombuilt-inspecifications.
Pythonwrapperinitialised
Optimisationfor100draws,capacityof40,andwiththefollowingmethod:10[D]${RMOL_PREFIX}/rmol/service/RMOL_Service.cpp:491:OptimisationbyMonte-Carloperformedin0.000321[D]${RMOL_PREFIX}/rmol/service/RMOL_Service.cpp:492:Result:Yield:100.00,Protection:70.48,Bookinglimit:100.00
Yield:70.00,Protection:156.19,Bookinglimit:29.52
Yield:42.00,Protection:-0.00,Bookinglimit:-56.19[D]${RMOL_PREFIX}/rmol/service/RMOL_Service.cpp:505:Bid-PriceVector(BPV):100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,100.00,99.00,99.00,99.00,99.00,99.00,98.00,98.00,97.00,96.00,96.00,96.00,96.00,96.00,95.00,94.00,94.00,90.00,90.00,89.00,88.00,86.00,84.00,82.00,80.00,80.00,79.00,77.00,76.00,75.00,72.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00,70.00
Endoftheoptimisation.
RMOLoutput:Of course, a few more features could be added to the Python extension API,
in order not to have to leave the Python interpreter to interact with the
results of invoking the optimizer. Do not hesitate to contribute
throughPull Requests, which are
always welcome!