You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(3) |
Feb
(2) |
Mar
(27) |
Apr
(8) |
May
(22) |
Jun
(10) |
Jul
(4) |
Aug
(3) |
Sep
(25) |
Oct
(12) |
Nov
|
Dec
(6) |
| 2010 |
Jan
(13) |
Feb
(3) |
Mar
(2) |
Apr
(1) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(14) |
Sep
(14) |
Oct
(4) |
Nov
(1) |
Dec
(2) |
|
From: <den...@us...> - 2010-03-15 10:31:13
|
Revision: 300
http://rmol.svn.sourceforge.net/rmol/?rev=300&view=rev
Author: denis_arnaud
Date: 2010-03-15 10:31:04 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
[Doc] Added a line in the README file.
Modified Paths:
--------------
trunk/rmol/README
Modified: trunk/rmol/README
===================================================================
--- trunk/rmol/README 2010-03-15 10:27:21 UTC (rev 299)
+++ trunk/rmol/README 2010-03-15 10:31:04 UTC (rev 300)
@@ -38,3 +38,4 @@
See the INSTALL file for more details.
Denis Arnaud (February 2007, revised September 2009)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-03-15 10:27:29
|
Revision: 299
http://rmol.svn.sourceforge.net/rmol/?rev=299&view=rev
Author: denis_arnaud
Date: 2010-03-15 10:27:21 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
[Test] Added the dependency on the StdAir library.
Modified Paths:
--------------
trunk/rmol/test/rmol/Makefile.am
Modified: trunk/rmol/test/rmol/Makefile.am
===================================================================
--- trunk/rmol/test/rmol/Makefile.am 2010-02-23 15:03:16 UTC (rev 298)
+++ trunk/rmol/test/rmol/Makefile.am 2010-03-15 10:27:21 UTC (rev 299)
@@ -1,4 +1,4 @@
-## test sub-directory
+## test/rmol sub-directory
include $(top_srcdir)/Makefile.common
MAINTAINERCLEANFILES = Makefile.in
@@ -22,6 +22,7 @@
OptimiseTestSuite_LDADD =
OptimiseTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
$(top_builddir)/extracppunit/libextracc-extracppunit.la \
+ $(top_builddir)/stdair/core/libstdair.la \
$(top_builddir)/rmol/core/librmol.la
SimulateTestSuite_SOURCES = SimulateTestSuite.hpp SimulateTestSuite.cpp
@@ -35,6 +36,7 @@
ForecasterTestSuite_LDADD =
ForecasterTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
$(top_builddir)/extracppunit/libextracc-extracppunit.la \
+ $(top_builddir)/stdair/core/libstdair.la \
$(top_builddir)/rmol/core/librmol.la
UnconstrainerTestSuite_SOURCES = UnconstrainerTestSuite.hpp \
@@ -43,6 +45,7 @@
UnconstrainerTestSuite_LDADD =
UnconstrainerTestSuite_LDFLAGS = $(CPPUNIT_LIBS) \
$(top_builddir)/extracppunit/libextracc-extracppunit.la \
+ $(top_builddir)/stdair/core/libstdair.la \
$(top_builddir)/rmol/core/librmol.la
bomsforforecaster_SOURCES = bomsforforecaster.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-02-23 15:03:47
|
Revision: 298
http://rmol.svn.sourceforge.net/rmol/?rev=298&view=rev
Author: denis_arnaud
Date: 2010-02-23 15:03:16 +0000 (Tue, 23 Feb 2010)
Log Message:
-----------
[Conf] Added a dependency on the GSL library for the RMOL batch.
Modified Paths:
--------------
trunk/rmol/rmol/batches/Makefile.am
Modified: trunk/rmol/rmol/batches/Makefile.am
===================================================================
--- trunk/rmol/rmol/batches/Makefile.am 2010-02-07 20:01:21 UTC (rev 297)
+++ trunk/rmol/rmol/batches/Makefile.am 2010-02-23 15:03:16 UTC (rev 298)
@@ -12,5 +12,5 @@
rmol_SOURCES = $(batches_h_sources) $(batches_cc_sources)
rmol_CXXFLAGS = $(BOOST_CFLAGS)
#rmol_LDADD =
-rmol_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) \
+rmol_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) $(GSL_LIBS) \
$(top_builddir)/rmol/core/librmol.la
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-02-07 20:01:27
|
Revision: 297
http://rmol.svn.sourceforge.net/rmol/?rev=297&view=rev
Author: denis_arnaud
Date: 2010-02-07 20:01:21 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
[StdAir] Added the command layer for StdAir.
Modified Paths:
--------------
trunk/rmol/configure.ac
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2010-02-07 03:21:23 UTC (rev 296)
+++ trunk/rmol/configure.ac 2010-02-07 20:01:21 UTC (rev 297)
@@ -338,9 +338,10 @@
stdair/bom/Makefile
stdair/dbadaptor/Makefile
stdair/factory/Makefile
+ stdair/command/Makefile
+ stdair/config/Makefile
stdair/service/Makefile
stdair/core/Makefile
- stdair/config/Makefile
rmol/Makefile
rmol/basic/Makefile
rmol/field/Makefile
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-02-07 03:21:29
|
Revision: 296
http://rmol.svn.sourceforge.net/rmol/?rev=296&view=rev
Author: denis_arnaud
Date: 2010-02-07 03:21:23 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
[DB] Added support for database administration, as well as a sample table (for airline description).
Modified Paths:
--------------
trunk/rmol/configure.ac
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2010-01-22 19:47:28 UTC (rev 295)
+++ trunk/rmol/configure.ac 2010-02-07 03:21:23 UTC (rev 296)
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script
#-------------------------------------------------------------------
AC_PREREQ(2.59)
-AC_COPYRIGHT([Copyright (C) 2007-2009 Denis Arnaud <den...@us...>])
+AC_COPYRIGHT([Copyright (C) 2007-2010 Denis Arnaud <den...@us...>])
AC_INIT([RMOL],[99.99.99],[den...@us...],[rmol])
AC_CONFIG_HEADER([rmol/config.h])
AC_CONFIG_SRCDIR([rmol/basic/BasConst.cpp])
@@ -119,6 +119,32 @@
AC_SUBST(GSL_CFLAGS)
AC_SUBST(GSL_LIBS)
+# -----------------------------------------------------------
+# Python: http://www.python.org
+# -----------------------------------------------------------
+PGAC_CHECK_PYTHON_EMBED_SETUP
+AC_SUBST(PYTHON_VERSION)
+AC_SUBST(PYTHON_LIBS)
+AC_SUBST(PYTHON_CFLAGS)
+AC_SUBST(PYTHON_ADD_LIBS)
+
+# -----------------------------------------------------------
+# MPICH2: http://www.mcs.anl.gov/research/projects/mpich2
+# Note: Boost.MPI depends on MPICH2, rather than on OpenMPI
+# -----------------------------------------------------------
+#AX_MPICH2
+#AC_SUBST(MPICH2_VERSION)
+#AC_SUBST(MPICH2_CFLAGS)
+#AC_SUBST(MPICH2_LIBS)
+
+# -----------------------------------------------------------
+# OpenMPI: http://www.open-mpi.org
+# -----------------------------------------------------------
+#AX_OPENMPI
+#AC_SUBST(OPENMPI_VERSION)
+#AC_SUBST(OPENMPI_CFLAGS)
+#AC_SUBST(OPENMPI_LIBS)
+
# --------------------------------------------------------
# Boost (STL Extensions: http://www.boost.org)
# --------------------------------------------------------
@@ -129,8 +155,29 @@
AC_SUBST(BOOST_DATE_TIME_LIB)
AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
AC_SUBST(BOOST_FILESYSTEM_LIB)
+AC_SUBST(BOOST_THREAD_LIB)
+AC_SUBST(BOOST_PYTHON_LIB)
+AC_SUBST(BOOST_ASIO_LIB)
+AC_SUBST(BOOST_MPI_LIB)
+AC_SUBST(BOOST_MPI_PYTHON_LIB)
+# --------------------------------------------------------------------
+# Support for MySQL (C client API): http://www.mysql.org
+# --------------------------------------------------------------------
+AX_MYSQL
+AC_SUBST(MYSQL_VERSION)
+AC_SUBST(MYSQL_CFLAGS)
+AC_SUBST(MYSQL_LIBS)
+# --------------------------------------------------------
+# SOCI (Database API: http://soci.sourceforge.net)
+# --------------------------------------------------------
+AX_SOCI([3.0])
+AC_SUBST(SOCI_VERSION)
+AC_SUBST(SOCI_CFLAGS)
+AC_SUBST(SOCI_LIBS)
+
+
# -------------------------------------------------------------------
# Support for documentation
# -------------------------------------------------------------------
@@ -289,6 +336,7 @@
stdair/Makefile
stdair/basic/Makefile
stdair/bom/Makefile
+ stdair/dbadaptor/Makefile
stdair/factory/Makefile
stdair/service/Makefile
stdair/core/Makefile
@@ -371,6 +419,12 @@
o GSL_CFLAGS ...... : ${GSL_CFLAGS}
o GSL_LIBS ........ : ${GSL_LIBS}
+ - Python ............. :
+ o PYTHON_version ... : ${PYTHON_VERSION}
+ o PYTHON_CFLAGS .... : ${PYTHON_CFLAGS}
+ o PYTHON_LIBS ...... : ${PYTHON_LIBS}
+ o PYTHON_ADD_LIBS .. : ${PYTHON_ADD_LIBS}
+
- Boost ............. :
o BOOST_VERSION ... : ${BOOST_VERSION}
o BOOST_CFLAGS .... : ${BOOST_CFLAGS}
@@ -378,7 +432,22 @@
o BOOST_DT_LIB .... : ${BOOST_DATE_TIME_LIB}
o BOOST_PO_LIB .... : ${BOOST_PROGRAM_OPTIONS_LIB}
o BOOST_FS_LIB .... : ${BOOST_FILESYSTEM_LIB}
+ o BOOST_THRD_LIB .. : ${BOOST_THREAD_LIB}
+ o BOOST_PY_LIB .... : ${BOOST_PYTHON_LIB}
+ o BOOST_ASIO_LIB .. : ${BOOST_ASIO_LIB}
+ o BOOST_MPI_LIB ... : ${BOOST_MPI_LIB}
+ o BOOST_MPIPY_LIB . : ${BOOST_MPI_PYTHON_LIB}
+ - MySQL ............. :
+ o MYSQL_version ... : ${MYSQL_VERSION}
+ o MYSQL_CFLAGS .... : ${MYSQL_CFLAGS}
+ o MYSQL_LIBS ...... : ${MYSQL_LIBS}
+
+ - Soci .............. :
+ o SOCI_VERSION .... : ${SOCI_VERSION}
+ o SOCI_CFLAGS ..... : ${SOCI_CFLAGS}
+ o SOCI_LIBS ....... : ${SOCI_LIBS}
+
- CPPUNIT ........... :
o CPPUNIT_VERSION . : ${CPPUNIT_VERSION}
o CPPUNIT_CFLAGS .. : ${CPPUNIT_CFLAGS}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-22 19:47:45
|
Revision: 295
http://rmol.svn.sourceforge.net/rmol/?rev=295&view=rev
Author: denis_arnaud
Date: 2010-01-22 19:47:28 +0000 (Fri, 22 Jan 2010)
Log Message:
-----------
[Dev] Added a STDAIR_Service, wrapper around both the static Logger instance and the stdair::FacSupervisor one.
Modified Paths:
--------------
trunk/rmol/rmol/RMOL_Service.hpp
trunk/rmol/rmol/service/RMOL_Service.cpp
trunk/rmol/rmol/service/RMOL_ServiceContext.hpp
Modified: trunk/rmol/rmol/RMOL_Service.hpp
===================================================================
--- trunk/rmol/rmol/RMOL_Service.hpp 2010-01-21 23:31:28 UTC (rev 294)
+++ trunk/rmol/rmol/RMOL_Service.hpp 2010-01-22 19:47:28 UTC (rev 295)
@@ -195,9 +195,21 @@
/** Default copy constructor. */
RMOL_Service (const RMOL_Service&);
- /** Initialise the log. */
- void logInit (const stdair::BasLogParams&);
+ /** Initialise the (RMOL) service context (i.e., the
+ RMOL_ServiceContext object).
+ @param AirlineCode_T& Code of the owner airline. */
+ void initServiceContext (const stdair::AirlineCode_T&);
+ /** Initialise the (RMOL) service context (i.e., the
+ RMOL_ServiceContext object).
+ @param AirlineCode_T& Code of the owner airline.
+ @param const ResourceCapacity_T Capacity of the resource to optimise. */
+ void initServiceContext (const stdair::AirlineCode_T&,
+ const ResourceCapacity_T);
+
+ /** Initialise the STDAIR service (including the log service). */
+ void initStdAirService (const stdair::BasLogParams&);
+
/** Initialise.
@param AirlineCode_T& Code of the owner airline. */
void init (const stdair::AirlineCode_T&);
Modified: trunk/rmol/rmol/service/RMOL_Service.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 23:31:28 UTC (rev 294)
+++ trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-22 19:47:28 UTC (rev 295)
@@ -7,8 +7,8 @@
#include <stdair/basic/BasChronometer.hpp>
#include <stdair/basic/BasFileMgr.hpp>
#include <stdair/bom/BomManager.hpp> // for display()
-#include <stdair/factory/FacSupervisor.hpp>
#include <stdair/service/Logger.hpp>
+#include <stdair/STDAIR_Service.hpp>
// RMOL
#include <rmol/basic/BasConst_RMOL_Service.hpp>
#include <rmol/field/FldYieldRange.hpp>
@@ -17,6 +17,7 @@
#include <rmol/bom/Bucket.hpp>
#include <rmol/bom/BucketHolder.hpp>
#include <rmol/bom/StudyStatManager.hpp>
+#include <rmol/factory/FacSupervisor.hpp>
#include <rmol/factory/FacRmolServiceContext.hpp>
#include <rmol/command/Optimiser.hpp>
#include <rmol/command/Unconstrainer.hpp>
@@ -42,9 +43,12 @@
const stdair::AirlineCode_T& iAirlineCode) :
_rmolServiceContext (NULL) {
- // Set the log file
- logInit (iLogParams);
+ // Initialise the service context
+ initServiceContext (iAirlineCode);
+ // Initialise the STDAIR service handler
+ initStdAirService (iLogParams);
+
// Initialise the (remaining of the) context
init (iAirlineCode);
}
@@ -63,39 +67,63 @@
const ResourceCapacity_T iResourceCapacity) :
_rmolServiceContext (NULL) {
- // Set the log file
- logInit (iLogParams);
-
+ // Initialise the service context
+ initServiceContext (iAirlineCode, iResourceCapacity);
+
+ // Initialise the STDAIR service handler
+ initStdAirService (iLogParams);
+
// Initialise the (remaining of the) context
init (iAirlineCode, iResourceCapacity);
}
// //////////////////////////////////////////////////////////////////////
RMOL_Service::~RMOL_Service () {
- // Clean all the StdAir objects, including the log service
- stdair::FacSupervisor::cleanFactory();
+ // Clean all the RMOL-scoped objects
+ FacSupervisor::cleanFactory();
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::logInit (const stdair::BasLogParams& iLogParams) {
- stdair::Logger::init (iLogParams);
+ void RMOL_Service::
+ initServiceContext (const stdair::AirlineCode_T& iAirlineCode) {
+ // Initialise the service context
+ RMOL_ServiceContext& lRMOL_ServiceContext =
+ FacRmolServiceContext::instance().create (iAirlineCode);
+ _rmolServiceContext = &lRMOL_ServiceContext;
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::init (const stdair::AirlineCode_T& iAirlineCode) {
- // Initialise the context
+ void RMOL_Service::
+ initServiceContext (const stdair::AirlineCode_T& iAirlineCode,
+ const ResourceCapacity_T iResourceCapacity) {
+ // Initialise the service context
RMOL_ServiceContext& lRMOL_ServiceContext =
- FacRmolServiceContext::instance().create (iAirlineCode);
+ FacRmolServiceContext::instance().create (iAirlineCode, iResourceCapacity);
_rmolServiceContext = &lRMOL_ServiceContext;
}
// //////////////////////////////////////////////////////////////////////
+ void RMOL_Service::
+ initStdAirService (const stdair::BasLogParams& iLogParams) {
+ assert (_rmolServiceContext != NULL);
+
+ // Initialise the STDAIR service handler
+ // Note that the track on the object memory is kept thanks to the Boost
+ // Smart Pointers component.
+ STDAIR_ServicePtr_T lSTDAIR_Service =
+ STDAIR_ServicePtr_T (new stdair::STDAIR_Service (iLogParams));
+
+ // Store the STDAIR service object within the (RMOL) service context
+ _rmolServiceContext->setSTDAIR_Service (lSTDAIR_Service);
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ void RMOL_Service::init (const stdair::AirlineCode_T& iAirlineCode) {
+ }
+
+ // //////////////////////////////////////////////////////////////////////
void RMOL_Service::init (const stdair::AirlineCode_T& iAirlineCode,
const ResourceCapacity_T iResourceCapacity) {
- // Initialise the context
- RMOL_ServiceContext& lRMOL_ServiceContext =
- FacRmolServiceContext::instance().create (iAirlineCode, iResourceCapacity);
- _rmolServiceContext = &lRMOL_ServiceContext;
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/service/RMOL_ServiceContext.hpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2010-01-21 23:31:28 UTC (rev 294)
+++ trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2010-01-22 19:47:28 UTC (rev 295)
@@ -6,18 +6,29 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <string>
+// Boost
+#include <boost/shared_ptr.hpp>
// StdAir
#include <stdair/STDAIR_Types.hpp>
// RMOL
#include <rmol/RMOL_Types.hpp>
#include <rmol/service/ServiceAbstract.hpp>
+// Forward declarations
+namespace stdair {
+ class STDAIR_Service;
+}
+
namespace RMOL {
/** Forward declaration. */
class BucketHolder;
class StudyStatManager;
+ /** Pointer on the STDAIR Service handler. */
+ typedef boost::shared_ptr<stdair::STDAIR_Service> STDAIR_ServicePtr_T;
+
+
/** Inner class holding the context for the RMOL Service object. */
class RMOL_ServiceContext : public ServiceAbstract {
/** The RMOL_Service class should be the sole class to get access to
@@ -61,7 +72,12 @@
/** Destructor. */
~RMOL_ServiceContext();
-
+ private:
+ /** Set the pointer on the STDAIR service handler. */
+ void setSTDAIR_Service (STDAIR_ServicePtr_T ioSTDAIR_ServicePtr) {
+ _stdairService = ioSTDAIR_ServicePtr;
+ }
+
/** Set the cabin availability. */
void setResourceCapacity (const ResourceCapacity_T iResourceCapacity);
@@ -115,6 +131,12 @@
private:
+ // ///////////// Children ////////////
+ /** Standard Airline (StdAir) Service Handler. */
+ STDAIR_ServicePtr_T _stdairService;
+
+
+ private:
// //////////// Attributes //////////////////
/** Internal pointer on BucketHolder. */
BucketHolder* _bucketHolder;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 23:31:35
|
Revision: 294
http://rmol.svn.sourceforge.net/rmol/?rev=294&view=rev
Author: denis_arnaud
Date: 2010-01-21 23:31:28 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The static log service instance is now cleaned directly within the FacSupervisor::cleanFactory() method.
Modified Paths:
--------------
trunk/rmol/rmol/service/RMOL_Service.cpp
Modified: trunk/rmol/rmol/service/RMOL_Service.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 22:51:05 UTC (rev 293)
+++ trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 23:31:28 UTC (rev 294)
@@ -7,6 +7,7 @@
#include <stdair/basic/BasChronometer.hpp>
#include <stdair/basic/BasFileMgr.hpp>
#include <stdair/bom/BomManager.hpp> // for display()
+#include <stdair/factory/FacSupervisor.hpp>
#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/basic/BasConst_RMOL_Service.hpp>
@@ -71,6 +72,8 @@
// //////////////////////////////////////////////////////////////////////
RMOL_Service::~RMOL_Service () {
+ // Clean all the StdAir objects, including the log service
+ stdair::FacSupervisor::cleanFactory();
}
// //////////////////////////////////////////////////////////////////////
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 22:51:30
|
Revision: 293
http://rmol.svn.sourceforge.net/rmol/?rev=293&view=rev
Author: denis_arnaud
Date: 2010-01-21 22:51:05 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Conf] Added the stdair/service layer.
Modified Paths:
--------------
trunk/rmol/configure.ac
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2010-01-21 20:03:59 UTC (rev 292)
+++ trunk/rmol/configure.ac 2010-01-21 22:51:05 UTC (rev 293)
@@ -290,6 +290,7 @@
stdair/basic/Makefile
stdair/bom/Makefile
stdair/factory/Makefile
+ stdair/service/Makefile
stdair/core/Makefile
stdair/config/Makefile
rmol/Makefile
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 20:04:06
|
Revision: 292
http://rmol.svn.sourceforge.net/rmol/?rev=292&view=rev
Author: denis_arnaud
Date: 2010-01-21 20:03:59 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The initialisation now requires an airline code.
Modified Paths:
--------------
trunk/rmol/test/rmol/ForecasterTestSuite.cpp
trunk/rmol/test/rmol/OptimiseTestSuite.cpp
trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
trunk/rmol/test/rmol/bomsforforecaster.cpp
Modified: trunk/rmol/test/rmol/ForecasterTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2010-01-21 20:03:39 UTC (rev 291)
+++ trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2010-01-21 20:03:59 UTC (rev 292)
@@ -34,7 +34,8 @@
// Initialise the RMOL service
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- RMOL::RMOL_Service rmolService (lLogParams);
+ const stdair::AirlineCode_T lAirlineCode ("BA");
+ RMOL::RMOL_Service rmolService (lLogParams, lAirlineCode);
// A sample historical demand data to be processed by forecaster
// Class | Q | M | B | Y |
Modified: trunk/rmol/test/rmol/OptimiseTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-21 20:03:39 UTC (rev 291)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-21 20:03:59 UTC (rev 292)
@@ -42,7 +42,8 @@
// Initialise the RMOL service
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- RMOL::RMOL_Service rmolService (lLogParams, cabinCapacity);
+ const stdair::AirlineCode_T lAirlineCode ("BA");
+ RMOL::RMOL_Service rmolService (lLogParams, lAirlineCode, cabinCapacity);
rmolService.setUpStudyStatManager();
// Define bid price and booking Limit vectors
Modified: trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2010-01-21 20:03:39 UTC (rev 291)
+++ trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2010-01-21 20:03:59 UTC (rev 292)
@@ -34,7 +34,8 @@
// Initialise the RMOL service
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- RMOL::RMOL_Service rmolService (lLogParams);
+ const stdair::AirlineCode_T lAirlineCode ("BA");
+ RMOL::RMOL_Service rmolService (lLogParams, lAirlineCode);
// A sample historical booking data to be processed by unconstrainer
RMOL::ConstrainedDataHolder_T lConstrainedDataHolder;
Modified: trunk/rmol/test/rmol/bomsforforecaster.cpp
===================================================================
--- trunk/rmol/test/rmol/bomsforforecaster.cpp 2010-01-21 20:03:39 UTC (rev 291)
+++ trunk/rmol/test/rmol/bomsforforecaster.cpp 2010-01-21 20:03:59 UTC (rev 292)
@@ -190,7 +190,8 @@
// Initialise the RMOL service
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- RMOL::RMOL_Service lRmolService (lLogParams);
+ const stdair::AirlineCode_T lAirlineCode ("BA");
+ RMOL::RMOL_Service lRmolService (lLogParams, lAirlineCode);
// Register BCDataSet
RMOL::BookingClassDataSet lBookingClassDataSet;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 20:03:46
|
Revision: 291
http://rmol.svn.sourceforge.net/rmol/?rev=291&view=rev
Author: denis_arnaud
Date: 2010-01-21 20:03:39 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The initialisation now requires an airline code.
Modified Paths:
--------------
trunk/rmol/rmol/RMOL_Service.hpp
trunk/rmol/rmol/basic/BasConst.cpp
trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp
trunk/rmol/rmol/batches/rmol.cpp
trunk/rmol/rmol/factory/FacRmolServiceContext.cpp
trunk/rmol/rmol/factory/FacRmolServiceContext.hpp
trunk/rmol/rmol/service/RMOL_Service.cpp
trunk/rmol/rmol/service/RMOL_ServiceContext.cpp
trunk/rmol/rmol/service/RMOL_ServiceContext.hpp
Modified: trunk/rmol/rmol/RMOL_Service.hpp
===================================================================
--- trunk/rmol/rmol/RMOL_Service.hpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/RMOL_Service.hpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -108,8 +108,9 @@
<br>Moreover, a reference on an output stream is given, so
that log outputs can be directed onto that stream.
@param const stdair::BasLogParams& Parameters for the output log
- stream. */
- RMOL_Service (const stdair::BasLogParams&);
+ stream.
+ @param AirlineCode_T& Code of the owner airline. */
+ RMOL_Service (const stdair::BasLogParams&, const stdair::AirlineCode_T&);
/** Constructor.
<br>The init() method is called; see the corresponding documentation
@@ -119,8 +120,9 @@
initialised with the proper log output stream by some other
methods in the calling chain (for instance, when the RMOL_Service
is itself being initialised by another library service such as
- AIRINV_Service). */
- RMOL_Service ();
+ AIRINV_Service).
+ @param AirlineCode_T& Code of the owner airline. */
+ RMOL_Service (const stdair::AirlineCode_T&);
/** Constructor.
<br>The init() method is called; see the corresponding documentation
@@ -128,8 +130,10 @@
<br>Moreover, a reference on an output stream is given, so
that log outputs can be directed onto that stream.
@param const stdair::BasLogParams& Parameters for the output log stream.
+ @param AirlineCode_T& Code of the owner airline.
@param const ResourceCapacity_T Capacity of the resource to optimise. */
- RMOL_Service (const stdair::BasLogParams&, const ResourceCapacity_T);
+ RMOL_Service (const stdair::BasLogParams&, const stdair::AirlineCode_T&,
+ const ResourceCapacity_T);
/** Constructor.
<br>The init() method is called; see the corresponding documentation
@@ -140,8 +144,9 @@
methods in the calling chain (for instance, when the RMOL_Service
is itself being initialised by another library service such as
AIRINV_Service).
+ @param AirlineCode_T& Code of the owner airline.
@param const ResourceCapacity_T Capacity of the resource to optimise. */
- RMOL_Service (const ResourceCapacity_T);
+ RMOL_Service (const stdair::AirlineCode_T&, const ResourceCapacity_T);
/** Destructor. */
~RMOL_Service();
@@ -184,18 +189,23 @@
private:
- /** Default Constructors. */
+ // /////// Construction and Destruction helper methods ///////
+ /** Default constructor. */
+ RMOL_Service ();
+ /** Default copy constructor. */
RMOL_Service (const RMOL_Service&);
/** Initialise the log. */
void logInit (const stdair::BasLogParams&);
- /** Initialise. */
- void init ();
+ /** Initialise.
+ @param AirlineCode_T& Code of the owner airline. */
+ void init (const stdair::AirlineCode_T&);
/** Initialise.
+ @param AirlineCode_T& Code of the owner airline.
@param const ResourceCapacity_T Capacity of the resource to optimise. */
- void init (const ResourceCapacity_T);
+ void init (const stdair::AirlineCode_T&, const ResourceCapacity_T);
/** Finaliser. */
void finalise ();
Modified: trunk/rmol/rmol/basic/BasConst.cpp
===================================================================
--- trunk/rmol/rmol/basic/BasConst.cpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/basic/BasConst.cpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -1,3 +1,6 @@
+// //////////////////////////////////////////////////////////////////////
+// Import section
+// //////////////////////////////////////////////////////////////////////
#include <rmol/basic/BasConst_General.hpp>
#include <rmol/basic/BasConst_Overbooking.hpp>
#include <rmol/basic/BasConst_RMOL_Service.hpp>
@@ -4,6 +7,9 @@
namespace RMOL {
+ /** Default airline code for the RMOL_Service. */
+ const stdair::AirlineCode_T DEFAULT_RMOL_SERVICE_AIRLINE_CODE = "BA";
+
/** Default capacity for the RMOL_Service. */
const double DEFAULT_RMOL_SERVICE_CAPACITY = 1.0;
Modified: trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp
===================================================================
--- trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -6,11 +6,16 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <vector>
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
// RMOL
#include <rmol/RMOL_Types.hpp>
namespace RMOL {
+ /** Default airline code for the RMOL_Service. */
+ extern const stdair::AirlineCode_T DEFAULT_RMOL_SERVICE_AIRLINE_CODE;
+
/** Default capacity for the RMOL_Service. */
extern const double DEFAULT_RMOL_SERVICE_CAPACITY;
Modified: trunk/rmol/rmol/batches/rmol.cpp
===================================================================
--- trunk/rmol/rmol/batches/rmol.cpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/batches/rmol.cpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -225,7 +225,8 @@
// Initialise the list of classes/buckets
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- RMOL::RMOL_Service rmolService (lLogParams, lCapacity);
+ const stdair::AirlineCode_T lAirlineCode ("BA");
+ RMOL::RMOL_Service rmolService (lLogParams, lAirlineCode, lCapacity);
rmolService.setUpStudyStatManager();
if (hasInputFile) {
Modified: trunk/rmol/rmol/factory/FacRmolServiceContext.cpp
===================================================================
--- trunk/rmol/rmol/factory/FacRmolServiceContext.cpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/factory/FacRmolServiceContext.cpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -1,8 +1,8 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
+// STL
+#include <cassert>
// RMOL
#include <rmol/service/RMOL_ServiceContext.hpp>
#include <rmol/factory/FacSupervisor.hpp>
@@ -30,10 +30,11 @@
}
// //////////////////////////////////////////////////////////////////////
- RMOL_ServiceContext& FacRmolServiceContext::create () {
+ RMOL_ServiceContext& FacRmolServiceContext::
+ create (const stdair::AirlineCode_T& iAirlineCode) {
RMOL_ServiceContext* aServiceContext_ptr = NULL;
- aServiceContext_ptr = new RMOL_ServiceContext ();
+ aServiceContext_ptr = new RMOL_ServiceContext (iAirlineCode);
assert (aServiceContext_ptr != NULL);
// The new object is added to the Bom pool
@@ -44,10 +45,12 @@
// //////////////////////////////////////////////////////////////////////
RMOL_ServiceContext& FacRmolServiceContext::
- create (const ResourceCapacity_T iResourceCapacity) {
+ create (const stdair::AirlineCode_T& iAirlineCode,
+ const ResourceCapacity_T iResourceCapacity) {
RMOL_ServiceContext* aServiceContext_ptr = NULL;
- aServiceContext_ptr = new RMOL_ServiceContext (iResourceCapacity);
+ aServiceContext_ptr = new RMOL_ServiceContext (iAirlineCode,
+ iResourceCapacity);
assert (aServiceContext_ptr != NULL);
// The new object is added to the Bom pool
Modified: trunk/rmol/rmol/factory/FacRmolServiceContext.hpp
===================================================================
--- trunk/rmol/rmol/factory/FacRmolServiceContext.hpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/factory/FacRmolServiceContext.hpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -4,6 +4,8 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
// RMOL
#include <rmol/RMOL_Types.hpp>
#include <rmol/factory/FacServiceAbstract.hpp>
@@ -30,12 +32,13 @@
/** Create a new ServiceContext object.
<br>This new object is added to the list of instantiated objects.
@return ServiceContext& The newly created object. */
- RMOL_ServiceContext& create ();
+ RMOL_ServiceContext& create (const stdair::AirlineCode_T&);
/** Create a new ServiceContext object.
<br>This new object is added to the list of instantiated objects.
@return ServiceContext& The newly created object. */
- RMOL_ServiceContext& create (const ResourceCapacity_T iResourceCapacity);
+ RMOL_ServiceContext& create (const stdair::AirlineCode_T&,
+ const ResourceCapacity_T);
protected:
Modified: trunk/rmol/rmol/service/RMOL_Service.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -26,31 +26,39 @@
namespace RMOL {
// //////////////////////////////////////////////////////////////////////
+ RMOL_Service::RMOL_Service () : _rmolServiceContext (NULL) {
+ assert (false);
+ }
+
+ // //////////////////////////////////////////////////////////////////////
RMOL_Service::RMOL_Service (const RMOL_Service& iService) :
_rmolServiceContext (NULL) {
assert (false);
}
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service (const stdair::BasLogParams& iLogParams) :
+ RMOL_Service::RMOL_Service (const stdair::BasLogParams& iLogParams,
+ const stdair::AirlineCode_T& iAirlineCode) :
_rmolServiceContext (NULL) {
// Set the log file
logInit (iLogParams);
// Initialise the (remaining of the) context
- init ();
+ init (iAirlineCode);
}
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service () :
+ RMOL_Service::RMOL_Service (const stdair::AirlineCode_T& iAirlineCode) :
_rmolServiceContext (NULL) {
+
// Initialise the context
- init ();
+ init (iAirlineCode);
}
// //////////////////////////////////////////////////////////////////////
RMOL_Service::RMOL_Service (const stdair::BasLogParams& iLogParams,
+ const stdair::AirlineCode_T& iAirlineCode,
const ResourceCapacity_T iResourceCapacity) :
_rmolServiceContext (NULL) {
@@ -58,7 +66,7 @@
logInit (iLogParams);
// Initialise the (remaining of the) context
- init (iResourceCapacity);
+ init (iAirlineCode, iResourceCapacity);
}
// //////////////////////////////////////////////////////////////////////
@@ -71,18 +79,19 @@
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::init () {
+ void RMOL_Service::init (const stdair::AirlineCode_T& iAirlineCode) {
// Initialise the context
RMOL_ServiceContext& lRMOL_ServiceContext =
- FacRmolServiceContext::instance().create ();
+ FacRmolServiceContext::instance().create (iAirlineCode);
_rmolServiceContext = &lRMOL_ServiceContext;
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::init (const ResourceCapacity_T iResourceCapacity) {
+ void RMOL_Service::init (const stdair::AirlineCode_T& iAirlineCode,
+ const ResourceCapacity_T iResourceCapacity) {
// Initialise the context
RMOL_ServiceContext& lRMOL_ServiceContext =
- FacRmolServiceContext::instance().create (iResourceCapacity);
+ FacRmolServiceContext::instance().create (iAirlineCode, iResourceCapacity);
_rmolServiceContext = &lRMOL_ServiceContext;
}
Modified: trunk/rmol/rmol/service/RMOL_ServiceContext.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_ServiceContext.cpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/service/RMOL_ServiceContext.cpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -1,8 +1,8 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
+// STL
+#include <cassert>
// RMOL
#include <rmol/basic/BasConst_RMOL_Service.hpp>
#include <rmol/field/FldYieldRange.hpp>
@@ -23,30 +23,36 @@
namespace RMOL {
// //////////////////////////////////////////////////////////////////////
- RMOL_ServiceContext::
- RMOL_ServiceContext (const ResourceCapacity_T iResourceCapacity) :
- _bucketHolder (NULL), _capacity (iResourceCapacity),
- _studyStatManager (NULL),
- _generatedDemandVectorHolder (DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER) {
- init (iResourceCapacity);
+ RMOL_ServiceContext::RMOL_ServiceContext () :
+ _bucketHolder (NULL), _studyStatManager (NULL) {
+ assert (false);
}
// //////////////////////////////////////////////////////////////////////
- RMOL_ServiceContext::RMOL_ServiceContext () :
- _bucketHolder (NULL), _capacity (DEFAULT_RMOL_SERVICE_CAPACITY),
- _studyStatManager (NULL),
+ RMOL_ServiceContext::RMOL_ServiceContext (const RMOL_ServiceContext&) :
+ _bucketHolder (NULL), _studyStatManager (NULL) {
+ assert (false);
+ }
+
+ // //////////////////////////////////////////////////////////////////////
+ RMOL_ServiceContext::
+ RMOL_ServiceContext (const stdair::AirlineCode_T& iAirlineCode) :
+ _bucketHolder (NULL), _studyStatManager (NULL),
+ _airlineCode (iAirlineCode), _capacity (DEFAULT_RMOL_SERVICE_CAPACITY),
_generatedDemandVectorHolder (DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER) {
init (DEFAULT_RMOL_SERVICE_CAPACITY);
}
// //////////////////////////////////////////////////////////////////////
- RMOL_ServiceContext::RMOL_ServiceContext (const RMOL_ServiceContext&) :
- _bucketHolder (NULL), _capacity (DEFAULT_RMOL_SERVICE_CAPACITY),
- _studyStatManager (NULL),
+ RMOL_ServiceContext::
+ RMOL_ServiceContext (const stdair::AirlineCode_T& iAirlineCode,
+ const ResourceCapacity_T iResourceCapacity) :
+ _bucketHolder (NULL), _studyStatManager (NULL),
+ _airlineCode (iAirlineCode), _capacity (iResourceCapacity),
_generatedDemandVectorHolder (DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER) {
- init (DEFAULT_RMOL_SERVICE_CAPACITY);
+ init (iResourceCapacity);
}
-
+
// //////////////////////////////////////////////////////////////////////
RMOL_ServiceContext::~RMOL_ServiceContext() {
}
Modified: trunk/rmol/rmol/service/RMOL_ServiceContext.hpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2010-01-21 19:33:33 UTC (rev 290)
+++ trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2010-01-21 20:03:39 UTC (rev 291)
@@ -6,6 +6,8 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <string>
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
// RMOL
#include <rmol/RMOL_Types.hpp>
#include <rmol/service/ServiceAbstract.hpp>
@@ -24,17 +26,42 @@
friend class RMOL_Service;
friend class FacRmolServiceContext;
+ public:
+ // ///////// Getters //////////
+ /** Get the airline code. */
+ const stdair::AirlineCode_T& getAirlineCode () const {
+ return _airlineCode;
+ }
+
+
+ // ///////// Setters //////////
+ /** Set the airline code. */
+ void setAirlineCode (const stdair::AirlineCode_T& iAirlineCode) {
+ _airlineCode = iAirlineCode;
+ }
+
+
+ public:
+ /** Set up the StudyStatManager. */
+ void setUpStudyStatManager ();
+
+
private:
+ // /////// Construction / initialisation ////////
/** Constructors. */
RMOL_ServiceContext ();
RMOL_ServiceContext (const RMOL_ServiceContext&);
- RMOL_ServiceContext (const ResourceCapacity_T iResourceCapacity);
- void init (const ResourceCapacity_T iResourceCapacity);
+ RMOL_ServiceContext (const stdair::AirlineCode_T&);
+ RMOL_ServiceContext (const stdair::AirlineCode_T&, const ResourceCapacity_T);
+ void init (const ResourceCapacity_T);
+
/** Initialise the StudyStatManager. */
void initStudyStatManager ();
+
/** Destructor. */
~RMOL_ServiceContext();
+
/** Set the cabin availability. */
void setResourceCapacity (const ResourceCapacity_T iResourceCapacity);
@@ -86,20 +113,21 @@
return _capacity;
}
- public:
- /** Set up the StudyStatManager. */
- void setUpStudyStatManager ();
private:
+ // //////////// Attributes //////////////////
/** Internal pointer on BucketHolder. */
BucketHolder* _bucketHolder;
+ /** Statistic Manager. */
+ StudyStatManager* _studyStatManager;
+
+ /** Code of the airline owner of the revenue management system. */
+ stdair::AirlineCode_T _airlineCode;
+
/** Resource Capacity. */
ResourceCapacity_T _capacity;
- /** Statistic Manager. */
- StudyStatManager* _studyStatManager;
-
/** Holder of the generated demand vectors. */
GeneratedDemandVectorHolder_T _generatedDemandVectorHolder;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 19:34:04
|
Revision: 290
http://rmol.svn.sourceforge.net/rmol/?rev=290&view=rev
Author: denis_arnaud
Date: 2010-01-21 19:33:33 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The log output stream initialisation has been moved into the StdAir library.
Modified Paths:
--------------
trunk/rmol/test/rmol/ForecasterTestSuite.cpp
trunk/rmol/test/rmol/OptimiseTestSuite.cpp
trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
trunk/rmol/test/rmol/bomsforforecaster.cpp
Modified: trunk/rmol/test/rmol/ForecasterTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2010-01-21 19:33:17 UTC (rev 289)
+++ trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2010-01-21 19:33:33 UTC (rev 290)
@@ -33,7 +33,8 @@
std::ostringstream oDebugStr;
// Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile);
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ RMOL::RMOL_Service rmolService (lLogParams);
// A sample historical demand data to be processed by forecaster
// Class | Q | M | B | Y |
Modified: trunk/rmol/test/rmol/OptimiseTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-21 19:33:17 UTC (rev 289)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-21 19:33:33 UTC (rev 290)
@@ -41,7 +41,9 @@
logOutputFile.clear();
// Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile, cabinCapacity);
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ RMOL::RMOL_Service rmolService (lLogParams, cabinCapacity);
+ rmolService.setUpStudyStatManager();
// Define bid price and booking Limit vectors
RMOL::BidPriceVector_T lBidPriceVector;
@@ -69,66 +71,70 @@
}
switch (METHOD_FLAG) {
+ case 0 : {
+ // Calculate the optimal protections by the Monte Carlo
+ // Integration approach
+ rmolService.optimalOptimisationByMCIntegration (K);
+ break;
+ }
+
+ case 1 : {
+ // Calculate the optimal protections by DP.
+ rmolService.optimalOptimisationByDP ();
+ break;
+ }
+
+ case 2 : {
+ // Calculate the Bid-Price Vector by EMSR
+ rmolService.heuristicOptimisationByEmsr ();
+ break;
+ }
+
+ case 3 : {
+ // Calculate the protections by EMSR-a
+ // Test the EMSR-a algorithm implementation
+ rmolService.heuristicOptimisationByEmsrA (lBidPriceVector,
+ lProtectionLevelVector,
+ lBookingLimitVector);
- case 0 : // Calculate the optimal protections by the Monte Carlo
- // Integration approach
- {
- rmolService.optimalOptimisationByMCIntegration (K);
- break;
- }
- case 1 : // Calculate the optimal protections by DP.
- {
- rmolService.optimalOptimisationByDP ();
- break;
+ // Return a cumulated booking limit value to test
+ oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
+ break;
+ }
+
+ case 4 : {
+ // Calculate the protections by EMSR-b
+ rmolService.heuristicOptimisationByEmsrB ();
+ break;
+ }
+
+ case 5 : {
+ // Calculate the protection by EMSR-a with sellup
+ // Create an empty sell-up probability vector
+ std::vector<double> sellupProbabilityVector;
+
+ // Define the sell-up probability to be 20%
+ const double sampleProbability = 0.2;
+
+ // NOTE: size of sellup vector should be equal to no of buckets - 1
+ // TODO: check that with an assertion
+ const short nbOfSampleBucket = 4;
+ for (short i = 1; i <= nbOfSampleBucket - 1; i++) {
+ sellupProbabilityVector.push_back (sampleProbability);
}
- case 2 : // Calculate the Bid-Price Vector by EMSR
- {
- rmolService.heuristicOptimisationByEmsr ();
- break;
- }
- case 3 : // Calculate the protections by EMSR-a
- {
- // Test the EMSR-a algorithm implementation
- rmolService.heuristicOptimisationByEmsrA (lBidPriceVector,
- lProtectionLevelVector,
- lBookingLimitVector);
+
+ // Test the algorithm with the sample sell-up vector
+ rmolService.heuristicOptimisationByEmsrAwithSellup
+ (sellupProbabilityVector, lProtectionLevelVector,
+ lBidPriceVector, lBookingLimitVector);
+
+ // Return a cumulated booking limit value to test
+ oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
+
+ break;
+ }
- // Return a cumulated booking limit value to test
- oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
- break;
- }
- case 4 : // Calculate the protections by EMSR-b
- {
- rmolService.heuristicOptimisationByEmsrB ();
- break;
- }
- case 5 : // Calculate the protection by EMSR-a with sellup
- {
- // Create an empty sell-up probability vector
- std::vector<double> sellupProbabilityVector;
-
- // Define the sell-up probability to be 20%
- const double sampleProbability = 0.2;
-
- // NOTE: size of sellup vector should be equal to no of buckets - 1
- // TODO: check that with an assertion
- const short nbOfSampleBucket = 4;
- for (short i = 1; i <= nbOfSampleBucket - 1; i++) {
- sellupProbabilityVector.push_back (sampleProbability);
- }
-
- // Test the algorithm with the sample sell-up vector
- rmolService.heuristicOptimisationByEmsrAwithSellup
- (sellupProbabilityVector, lProtectionLevelVector,
- lBidPriceVector, lBookingLimitVector);
-
- // Return a cumulated booking limit value to test
- oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
-
- break;
- }
-
- default : rmolService.optimalOptimisationByMCIntegration (K);
+ default: rmolService.optimalOptimisationByMCIntegration (K);
}
} catch (const std::exception& stde) {
@@ -172,7 +178,7 @@
// EMSR-a
void OptimiseTestSuite::testOptimiseEMSRa() {
const int lExpectedBookingLimit = testOptimiseHelper(3);
- CPPUNIT_ASSERT(lExpectedBookingLimit == 61);
+ CPPUNIT_ASSERT (lExpectedBookingLimit == 61);
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2010-01-21 19:33:17 UTC (rev 289)
+++ trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2010-01-21 19:33:33 UTC (rev 290)
@@ -33,7 +33,8 @@
std::ostringstream oDebugStr;
// Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile);
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ RMOL::RMOL_Service rmolService (lLogParams);
// A sample historical booking data to be processed by unconstrainer
RMOL::ConstrainedDataHolder_T lConstrainedDataHolder;
Modified: trunk/rmol/test/rmol/bomsforforecaster.cpp
===================================================================
--- trunk/rmol/test/rmol/bomsforforecaster.cpp 2010-01-21 19:33:17 UTC (rev 289)
+++ trunk/rmol/test/rmol/bomsforforecaster.cpp 2010-01-21 19:33:33 UTC (rev 290)
@@ -3,14 +3,11 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
-#include <sstream>
#include <fstream>
-#include <string>
-#include <limits>
-// #include <iostream>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/RMOL_Service.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -190,8 +187,11 @@
// Open and clean the log outputfile
logOutputFile.open (lLogFilename.c_str());
logOutputFile.clear();
- RMOL::RMOL_Service lRmolService(logOutputFile);
+ // Initialise the RMOL service
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ RMOL::RMOL_Service lRmolService (lLogParams);
+
// Register BCDataSet
RMOL::BookingClassDataSet lBookingClassDataSet;
@@ -202,10 +202,10 @@
RMOL::BookingClassData YClassData (0, 300, 0.3, false);
// Display
- RMOL_LOG_DEBUG(QClassData.toString());
- RMOL_LOG_DEBUG(MClassData.toString());
- RMOL_LOG_DEBUG(BClassData.toString());
- RMOL_LOG_DEBUG(YClassData.toString());
+ STDAIR_LOG_DEBUG(QClassData.toString());
+ STDAIR_LOG_DEBUG(MClassData.toString());
+ STDAIR_LOG_DEBUG(BClassData.toString());
+ STDAIR_LOG_DEBUG(YClassData.toString());
// Add BookingClassData into the BCDataSet
lBookingClassDataSet.addBookingClassData (QClassData );
@@ -214,22 +214,24 @@
lBookingClassDataSet.addBookingClassData( YClassData );
//Display
- RMOL_LOG_DEBUG( lBookingClassDataSet.toString() );
+ STDAIR_LOG_DEBUG( lBookingClassDataSet.toString() );
// Number of classes
const unsigned int lNoOfClass = lBookingClassDataSet.getNumberOfClass();
- RMOL_LOG_DEBUG( "Number of Classes: " << lNoOfClass );
+ STDAIR_LOG_DEBUG( "Number of Classes: " << lNoOfClass );
// Minimum fare
lBookingClassDataSet.updateMinimumFare();
const double lMinFare = lBookingClassDataSet.getMinimumFare();
- RMOL_LOG_DEBUG( "Minimum fare: " << lMinFare );
+ STDAIR_LOG_DEBUG( "Minimum fare: " << lMinFare );
// Censorship flag
lBookingClassDataSet.updateCensorshipFlag();
const bool lCensorshipFlag = lBookingClassDataSet.getCensorshipFlag();
- RMOL_LOG_DEBUG( "Censorship Flag: " << lCensorshipFlag );
+ // DEBUG
+ STDAIR_LOG_DEBUG ( "Censorship Flag: " << lCensorshipFlag );
+
// Close the log output file
logOutputFile.close();
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-21 19:33:24
|
Revision: 289
http://rmol.svn.sourceforge.net/rmol/?rev=289&view=rev
Author: denis_arnaud
Date: 2010-01-21 19:33:17 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
[Dev] The log output stream initialisation has been moved into the StdAir library.
Modified Paths:
--------------
trunk/rmol/rmol/RMOL_Service.hpp
trunk/rmol/rmol/batches/rmol.cpp
trunk/rmol/rmol/bom/DPOptimiser.cpp
trunk/rmol/rmol/bom/ExpectationMaximization.cpp
trunk/rmol/rmol/bom/MCOptimiser.cpp
trunk/rmol/rmol/bom/QForecaster.cpp
trunk/rmol/rmol/bom/StatAggregatorStruct.cpp
trunk/rmol/rmol/bom/StudyStatManager.cpp
trunk/rmol/rmol/command/FileMgr.cpp
trunk/rmol/rmol/command/Forecaster.cpp
trunk/rmol/rmol/command/Optimiser.cpp
trunk/rmol/rmol/command/Unconstrainer.cpp
trunk/rmol/rmol/command/Utilities.cpp
trunk/rmol/rmol/factory/FacStudyStatManager.cpp
trunk/rmol/rmol/factory/FacSupervisor.cpp
trunk/rmol/rmol/factory/FacSupervisor.hpp
trunk/rmol/rmol/service/RMOL_Service.cpp
trunk/rmol/rmol/service/sources.mk
Removed Paths:
-------------
trunk/rmol/rmol/service/Logger.cpp
trunk/rmol/rmol/service/Logger.hpp
Modified: trunk/rmol/rmol/RMOL_Service.hpp
===================================================================
--- trunk/rmol/rmol/RMOL_Service.hpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/RMOL_Service.hpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -6,6 +6,9 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <string>
+// StdAir
+#include <stdair/STDAIR_Types.hpp>
+#include <stdair/basic/BasLogParams.hpp>
// RMOL
#include <rmol/RMOL_Types.hpp>
#include <rmol/RMOL_FORECASTER_Types.hpp>
@@ -20,48 +23,7 @@
/** Interface for the RMOL Services. */
class RMOL_Service {
public:
- /** Constructor. */
- RMOL_Service (std::ostream& ioLogStream);
-
- RMOL_Service (std::ostream& ioLogStream,
- const ResourceCapacity_T iResourceCapacity);
- /** Destructor. */
- ~RMOL_Service();
-
- /** Set up the StudyStatManager. */
- void setUpStudyStatManager ();
-
- /** Set the cabin availability. */
- void setResourceCapacity (const ResourceCapacity_T iResourceCapacity);
-
- /** Add a bucket to the context. */
- void addBucket (const double iYieldRange, const double iDemandMean,
- const double iDemandStandardDev);
-
- /** Add a bucket to the context. */
- void addBucket (const double iYieldRange, const double iDemandMean,
- const double iDemandStandardDev,
- GeneratedDemandVector_T* ioGeneratedDemandVector);
-
- /** Generate demand for a given (Gaussian) distribution. */
- GeneratedDemandVector_T* generateDemand (const int K,
- const double& iMean,
- const double& iDeviation);
-
- /** Sum the two generated demand vectors . */
- GeneratedDemandVector_T* generateDemand (GeneratedDemandVector_T*,
- GeneratedDemandVector_T*);
-
- /** Read the input data from a file. */
- void readFromInputFile (const std::string& iInputFileName);
-
- /** Build the context with the generated demand for Monte-Carlo
- Integration algorithm. */
- void buildContextForMC (const int K);
-
- /** Clear the context (cabin capacity, bucket holder). */
- void reset ();
-
+ // /////////// Business Methods /////////////
/** Single resource optimization using the Monte Carlo algorithm. */
void optimalOptimisationByMCIntegration (const int K);
@@ -138,20 +100,103 @@
PriceHolder_T&,
SellupFactorHolder_T&);
+
+ // ////////// Constructors and destructors //////////
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>Moreover, a reference on an output stream is given, so
+ that log outputs can be directed onto that stream.
+ @param const stdair::BasLogParams& Parameters for the output log
+ stream. */
+ RMOL_Service (const stdair::BasLogParams&);
+
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>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 RMOL_Service
+ is itself being initialised by another library service such as
+ AIRINV_Service). */
+ RMOL_Service ();
+
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>Moreover, a reference on an output stream is given, so
+ that log outputs can be directed onto that stream.
+ @param const stdair::BasLogParams& Parameters for the output log stream.
+ @param const ResourceCapacity_T Capacity of the resource to optimise. */
+ RMOL_Service (const stdair::BasLogParams&, const ResourceCapacity_T);
+
+ /** Constructor.
+ <br>The init() method is called; see the corresponding documentation
+ for more details.
+ <br>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 RMOL_Service
+ is itself being initialised by another library service such as
+ AIRINV_Service).
+ @param const ResourceCapacity_T Capacity of the resource to optimise. */
+ RMOL_Service (const ResourceCapacity_T);
+
+ /** Destructor. */
+ ~RMOL_Service();
+
+
+ // //////// Initialisation support methods ///////////
+ /** Set up the StudyStatManager. */
+ void setUpStudyStatManager ();
+
+ /** Set the cabin availability. */
+ void setResourceCapacity (const ResourceCapacity_T iResourceCapacity);
+
+ /** Add a bucket to the context. */
+ void addBucket (const double iYieldRange, const double iDemandMean,
+ const double iDemandStandardDev);
+
+ /** Add a bucket to the context. */
+ void addBucket (const double iYieldRange, const double iDemandMean,
+ const double iDemandStandardDev,
+ GeneratedDemandVector_T* ioGeneratedDemandVector);
+
+ /** Generate demand for a given (Gaussian) distribution. */
+ GeneratedDemandVector_T* generateDemand (const int K,
+ const double& iMean,
+ const double& iDeviation);
+
+ /** Sum the two generated demand vectors . */
+ GeneratedDemandVector_T* generateDemand (GeneratedDemandVector_T*,
+ GeneratedDemandVector_T*);
+
+ /** Read the input data from a file. */
+ void readFromInputFile (const std::string& iInputFileName);
+
+ /** Build the context with the generated demand for Monte-Carlo
+ Integration algorithm. */
+ void buildContextForMC (const int K);
+
+ /** Clear the context (cabin capacity, bucket holder). */
+ void reset ();
+
+
private:
/** Default Constructors. */
- RMOL_Service ();
RMOL_Service (const RMOL_Service&);
+ /** Initialise the log. */
+ void logInit (const stdair::BasLogParams&);
+
/** Initialise. */
- void init (std::ostream& ioLogStream);
+ void init ();
- void init (std::ostream& ioLogStream,
- const ResourceCapacity_T iResourceCapacity);
+ /** Initialise.
+ @param const ResourceCapacity_T Capacity of the resource to optimise. */
+ void init (const ResourceCapacity_T);
- /** Initilise the log. */
- void logInit (const LOG::EN_LogLevel iLogLevel, std::ostream& ioLogStream);
-
/** Finaliser. */
void finalise ();
Modified: trunk/rmol/rmol/batches/rmol.cpp
===================================================================
--- trunk/rmol/rmol/batches/rmol.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/batches/rmol.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -224,7 +224,8 @@
logOutputFile.clear();
// Initialise the list of classes/buckets
- RMOL::RMOL_Service rmolService (logOutputFile, lCapacity);
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ RMOL::RMOL_Service rmolService (lLogParams, lCapacity);
rmolService.setUpStudyStatManager();
if (hasInputFile) {
Modified: trunk/rmol/rmol/bom/DPOptimiser.cpp
===================================================================
--- trunk/rmol/rmol/bom/DPOptimiser.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/DPOptimiser.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -4,18 +4,18 @@
// GSL Random Number Generation (GSL Reference Manual, version 1.7, Chapter 19)
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_randist.h>
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <sstream>
#include <vector>
#include <cmath>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/basic/BasConst_General.hpp>
#include <rmol/bom/DPOptimiser.hpp>
#include <rmol/bom/Bucket.hpp>
#include <rmol/bom/BucketHolder.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -159,7 +159,7 @@
ostr << currentGradient << std::endl
<< "x = " << x << std::endl
<< "class: " << currentBucketIndex << std::endl;
- RMOL_LOG_DEBUG (ostr.str());
+ STDAIR_LOG_DEBUG (ostr.str());
}
/*
@@ -183,7 +183,7 @@
}
// DEBUG
- RMOL_LOG_DEBUG ("Vmaxindex = " << currentMERVector.back());
+ STDAIR_LOG_DEBUG ("Vmaxindex = " << currentMERVector.back());
MERVectorHolder.push_back (currentMERVector);
Modified: trunk/rmol/rmol/bom/ExpectationMaximization.cpp
===================================================================
--- trunk/rmol/rmol/bom/ExpectationMaximization.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/ExpectationMaximization.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,16 +1,17 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-//GSL
+// GSL
#include <gsl/gsl_cdf.h>
// STL
-#include <math.h>
+#include <cassert>
+#include <cmath>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
-#include <rmol/service/Logger.hpp>
#include <rmol/basic/BasConst_General.hpp>
#include <rmol/command/Utilities.hpp>
#include <rmol/bom/ExpectationMaximization.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -65,7 +66,7 @@
lCompleteDataMean, lCompleteDataSD);
// Debug
- RMOL_LOG_DEBUG ("\nUnconstrained data: "
+ STDAIR_LOG_DEBUG ("\nUnconstrained data: "
<< Utilities::vectorToString
(lUnconstrainedDataDuringIteration));
// Maximization step
@@ -85,7 +86,7 @@
lSqErrorOfConstrainedData) / (lTotalNumberOfData-1));
// Debug
- RMOL_LOG_DEBUG ("\nEstimated Mean: " << lEstimatedMean
+ STDAIR_LOG_DEBUG ("\nEstimated Mean: " << lEstimatedMean
<< "\nnEstimated s.d.: " << lEstimatedSD);
} while(fabs(lCompleteDataMean - lEstimatedMean ) > iStoppingCriterion
@@ -97,13 +98,12 @@
ioConstrainedDataHolder = lUnconstrainedDataDuringIteration;
}
// Job finished as all are unconstrained or nothing to be unconstrained
+
+ } else {
+ STDAIR_LOG_ERROR ("At least one unconstrained data is required to "
+ << "correct constrained data with Expectation "
+ << "Maximization algorithm.");
}
- else {
- RMOL_LOG_ERROR ("At least one unconstrained data is required to "
- << "correct constrained data with Expectation "
- << "Maximization algorithm.");
- }
-
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/bom/MCOptimiser.cpp
===================================================================
--- trunk/rmol/rmol/bom/MCOptimiser.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/MCOptimiser.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -9,6 +9,7 @@
#include <cmath>
// StdAir
#include <stdair/basic/BasChronometer.hpp>
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/bom/StudyStatManager.hpp>
#include <rmol/bom/VariateList.hpp>
@@ -19,7 +20,6 @@
#include <rmol/bom/PartialSumHolderHolder.hpp>
//#include <rmol/bom/Resource.hpp>
#include <rmol/bom/MCOptimiser.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -78,7 +78,7 @@
const Gaussian gaussianDemandGenerator (aDistribParams);
/** DEBUG
- RMOL_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( "
+ STDAIR_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( "
<< aDistribParams.getMean() << ", "
<< aDistribParams.getStandardDeviation() << ").");
*/
@@ -113,7 +113,7 @@
currentPartialSumList.addPartialSum (sjk);
/* DEBUG
- RMOL_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk
+ STDAIR_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk
<< "; S'(" << j-1 << ", " << lj+k << "); " << spjm1lpk
<< "; S(" << j << ", " << k << "); " << sjk);
*/
@@ -141,7 +141,7 @@
lj = static_cast<int> (ljdouble);
/** DEBUG
- RMOL_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj
+ STDAIR_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj
<< ", Kj = " << Kj << " => " << Kj - lj
<< " points above y(j)");
*/
@@ -158,7 +158,7 @@
const double yj = (sjl + sjlp1) / 2;
/** DEBUG
- RMOL_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1
+ STDAIR_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1
<< ", y(j) = " << yj);
*/
@@ -311,7 +311,7 @@
const Gaussian gaussianDemandGenerator (aDistribParams);
/** DEBUG
- RMOL_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( "
+ STDAIR_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( "
<< aDistribParams.getMean() << ", "
<< aDistribParams.getStandardDeviation() << ").");
*/
@@ -347,7 +347,7 @@
currentPartialSumList.addPartialSum (sjk);
/* DEBUG
- RMOL_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk
+ STDAIR_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk
<< "; S'(" << j-1 << ", " << lj+k << "); " << spjm1lpk
<< "; S(" << j << ", " << k << "); " << sjk);
*/
@@ -381,7 +381,7 @@
lj = static_cast<int> (ljdouble);
/** DEBUG
- RMOL_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj
+ STDAIR_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj
<< ", Kj = " << Kj << " => " << Kj - lj << " points above y(j)");
*/
@@ -397,7 +397,7 @@
const double yj = (sjl + sjlp1) / 2;
/** DEBUG
- RMOL_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1
+ STDAIR_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1
<< ", y(j) = " << yj);
*/
Modified: trunk/rmol/rmol/bom/QForecaster.cpp
===================================================================
--- trunk/rmol/rmol/bom/QForecaster.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/QForecaster.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -7,11 +7,12 @@
#include <numeric>
#include <sstream>
#include <fstream>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/RMOL_UTILITY_Types.hpp>
#include <rmol/bom/QForecaster.hpp>
#include <rmol/command/Utilities.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -93,8 +94,10 @@
// 2. Compute Q-equivalent demand mean and standard deviation
Utilities::updateMeanAndStandardDeviation (ioQEquivalentDemandParameterHolder,
- lQEquivalentDemandHolder);
- RMOL_LOG_DEBUG (oDebugStr.str());
+ lQEquivalentDemandHolder);
+
+ // DEBUG
+ STDAIR_LOG_DEBUG (oDebugStr.str());
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/bom/StatAggregatorStruct.cpp
===================================================================
--- trunk/rmol/rmol/bom/StatAggregatorStruct.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/StatAggregatorStruct.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,15 +1,14 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <sstream>
#include <limits>
-#include <stdexcept>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/bom/StatAggregatorStruct.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -62,7 +61,7 @@
// //////////////////////////////////////////////////////////////////////
void StatAggregatorStruct_T::display() const {
- RMOL_LOG_DEBUG (describe());
+ STDAIR_LOG_DEBUG (describe());
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/bom/StudyStatManager.cpp
===================================================================
--- trunk/rmol/rmol/bom/StudyStatManager.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/bom/StudyStatManager.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,13 +1,13 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <sstream>
#include <limits>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL Common
-#include <rmol/service/Logger.hpp>
#include <rmol/bom/StatAggregatorStruct.hpp>
#include <rmol/bom/StudyStatManager.hpp>
@@ -59,7 +59,8 @@
// Reset formatting flags of stream
ostr.flags (oldFlags);
- RMOL_LOG_DEBUG (ostr.str());
+ // DEBUG
+ STDAIR_LOG_DEBUG (ostr.str());
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/command/FileMgr.cpp
===================================================================
--- trunk/rmol/rmol/command/FileMgr.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/command/FileMgr.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -2,10 +2,12 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
-#include <iostream>
+#include <ostream>
#include <istream>
#include <sstream>
#include <fstream>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/field/FldYieldRange.hpp>
#include <rmol/field/FldDistributionParameters.hpp>
@@ -16,7 +18,6 @@
#include <rmol/factory/FacBucket.hpp>
#include <rmol/factory/FacBucketHolder.hpp>
#include <rmol/command/FileMgr.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -27,7 +28,7 @@
// Open the input file
std::ifstream inputFile (iInputFileName.c_str());
if (! inputFile) {
- RMOL_LOG_ERROR ("Can not open input file \"" << iInputFileName << "\"");
+ STDAIR_LOG_ERROR ("Can not open input file \"" << iInputFileName << "\"");
throw new FileNotFoundException();
}
Modified: trunk/rmol/rmol/command/Forecaster.cpp
===================================================================
--- trunk/rmol/rmol/command/Forecaster.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/command/Forecaster.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -2,15 +2,13 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
-#include <cmath>
-#include <string>
-#include <sstream>
-#include <fstream>
+#include <cassert>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/bom/QForecaster.hpp>
#include <rmol/command/Forecaster.hpp>
#include <rmol/command/Utilities.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -97,6 +95,8 @@
oDebugStr << "Q-equivalent distribution parameters per class "
<< Utilities::vectorToString (lMeanAndSDOfAClass);
}
- RMOL_LOG_DEBUG(oDebugStr.str());
+
+ // DEBUG
+ STDAIR_LOG_DEBUG(oDebugStr.str());
}
}
Modified: trunk/rmol/rmol/command/Optimiser.cpp
===================================================================
--- trunk/rmol/rmol/command/Optimiser.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/command/Optimiser.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -3,11 +3,10 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
-//#include <cmath>
#include <sstream>
-#include <iomanip>
// StdAir
#include <stdair/basic/BasChronometer.hpp>
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/field/FldYieldRange.hpp>
#include <rmol/field/FldDistributionParameters.hpp>
@@ -22,7 +21,6 @@
#include <rmol/factory/FacDemand.hpp>
#include <rmol/factory/FacBucket.hpp>
#include <rmol/command/Optimiser.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -134,7 +132,8 @@
// Reset formatting flags of stream
ostr.flags (oldFlags);
- RMOL_LOG_DEBUG (ostr.str());
+ // DEBUG
+ STDAIR_LOG_DEBUG (ostr.str());
}
// //////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/command/Unconstrainer.cpp
===================================================================
--- trunk/rmol/rmol/command/Unconstrainer.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/command/Unconstrainer.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -2,10 +2,10 @@
// Import section
// //////////////////////////////////////////////////////////////////////
// STL
-#include <iostream>
-// #include <fstream>
+#include <cassert>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
-#include <rmol/service/Logger.hpp>
#include <rmol/RMOL_UNCONSTRAINER_Types.hpp>
#include <rmol/command/Utilities.hpp>
#include <rmol/command/Unconstrainer.hpp>
@@ -34,10 +34,8 @@
oDebugStr << "After unconstraining, the constrained data became "
<< Utilities::vectorToString(ioConstrainedDataHolder);
- RMOL_LOG_DEBUG (oDebugStr.str());
-
+ // DEBUG
+ STDAIR_LOG_DEBUG (oDebugStr.str());
}
- // //////////////////////////////////////////////////////////////////////
-
}
Modified: trunk/rmol/rmol/command/Utilities.cpp
===================================================================
--- trunk/rmol/rmol/command/Utilities.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/command/Utilities.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -2,22 +2,20 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-//STL
-#include <algorithm>
+// STL
+#include <cassert>
#include <string>
-#include <sstream>
#include <numeric>
-#include <cmath>
-#include <cassert>
-#include <functional>
+// StdAir
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/command/Utilities.hpp>
-#include <rmol/service/Logger.hpp>
+
namespace RMOL {
// /////////////////////////////////////////////////////////////////////
void Utilities::updateMinimumElement (double& oMinValue,
- std::vector<double>& iVector) {
+ std::vector<double>& iVector) {
assert(!iVector.empty());
std::vector<double>::iterator pos = min_element (iVector.begin(),
@@ -33,7 +31,7 @@
if (lSize > 0) {
oSum = std::accumulate(iVector.begin(), iVector.end(), 0.0);
}
- else {RMOL_LOG_ERROR ("There is no element to sum up.");}
+ else {STDAIR_LOG_ERROR ("There is no element to sum up.");}
}
// /////////////////////////////////////////////////////////////////////
@@ -49,7 +47,7 @@
std::vector<double>& iVector,
double& iMean) {
if (iMean < 0) {
- RMOL_LOG_ERROR ("Negative mean is not expected.");
+ STDAIR_LOG_ERROR ("Negative mean is not expected.");
} else {
const unsigned int lSize = iVector.size();
@@ -63,7 +61,7 @@
}
} else {
- RMOL_LOG_ERROR ("No value to compute the squared error");
+ STDAIR_LOG_ERROR ("No value to compute the squared error");
}
}
}
Modified: trunk/rmol/rmol/factory/FacStudyStatManager.cpp
===================================================================
--- trunk/rmol/rmol/factory/FacStudyStatManager.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/factory/FacStudyStatManager.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,13 +1,14 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
+// STL
+#include <cassert>
+// StdAir
+//#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/bom/StudyStatManager.hpp>
#include <rmol/factory/FacSupervisor.hpp>
#include <rmol/factory/FacStudyStatManager.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
Modified: trunk/rmol/rmol/factory/FacSupervisor.cpp
===================================================================
--- trunk/rmol/rmol/factory/FacSupervisor.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/factory/FacSupervisor.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -7,7 +7,6 @@
#include <rmol/factory/FacBomAbstract.hpp>
#include <rmol/factory/FacServiceAbstract.hpp>
#include <rmol/factory/FacSupervisor.hpp>
-#include <rmol/service/Logger.hpp>
namespace RMOL {
@@ -34,15 +33,9 @@
}
// //////////////////////////////////////////////////////////////////////
- void FacSupervisor::registerLoggerService (Logger* ioLogger_ptr) {
- _logger = ioLogger_ptr;
- }
-
- // //////////////////////////////////////////////////////////////////////
FacSupervisor::~FacSupervisor() {
cleanBomLayer();
cleanServiceLayer();
- cleanLoggerService();
}
// //////////////////////////////////////////////////////////////////////
@@ -74,16 +67,10 @@
}
// //////////////////////////////////////////////////////////////////////
- void FacSupervisor::cleanLoggerService() {
- delete _logger; _logger = NULL;
- }
-
- // //////////////////////////////////////////////////////////////////////
void FacSupervisor::cleanFactory () {
if (_instance != NULL) {
_instance->cleanBomLayer();
_instance->cleanServiceLayer();
- _instance->cleanLoggerService();
}
delete (_instance); _instance = NULL;
}
Modified: trunk/rmol/rmol/factory/FacSupervisor.hpp
===================================================================
--- trunk/rmol/rmol/factory/FacSupervisor.hpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/factory/FacSupervisor.hpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -12,7 +12,6 @@
// Forward declarations
class FacBomAbstract;
class FacServiceAbstract;
- class Logger;
/** Singleton class to register and clean all Factories. */
class FacSupervisor {
@@ -39,16 +38,6 @@
@param FacServiceAbstract& the concrete Factory to register. */
void registerServiceFactory (FacServiceAbstract*);
- /** Register a newly instantiated concrete factory for the
- Logger object. In fact, as the Logger object
- follows the singleton pattern, the concrete factory is the
- Logger object itself.
- <br>When a concrete Factory is firstly instantiated this
- factory have to register itself to the FacSupervisor.
- @param FacServiceAbstract& the concrete Factory to
- register. */
- void registerLoggerService (Logger*);
-
/** Clean all created object.
<br>Call the clean method of all the instantiated factories
for the Bom layer. */
@@ -59,9 +48,6 @@
for the Service layer. */
void cleanServiceLayer();
- /** Delete the Logger object. */
- void cleanLoggerService();
-
/** Clean the static instance.
<br> The singleton is deleted.*/
static void cleanFactory ();
@@ -84,15 +70,12 @@
/** The unique instance.*/
static FacSupervisor* _instance;
- /** Logger (singleton) instance. */
- Logger* _logger;
-
/** List of instantiated factories for the Bom layer. */
BomFactoryPool_T _bomPool;
/** List of instantiated factories for the Service layer. */
ServiceFactoryPool_T _svcPool;
-
};
+
}
#endif // __RMOL_FAC_FACSUPERVISOR_HPP
Deleted: trunk/rmol/rmol/service/Logger.cpp
===================================================================
--- trunk/rmol/rmol/service/Logger.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/service/Logger.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,66 +0,0 @@
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
-// STL
-#include <iostream>
-// Rmol Logger
-#include <rmol/factory/FacSupervisor.hpp>
-#include <rmol/service/Logger.hpp>
-
-namespace RMOL {
-
- Logger* Logger::_instance = NULL;
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger () : _logStream (&std::cout) {
- assert (false);
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger (const Logger&) : _logStream (&std::cout) {
- assert (false);
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::Logger (const LOG::EN_LogLevel iLevel, std::ostream& ioLogStream)
- : _level (iLevel), _logStream (&ioLogStream) {
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger::~Logger () {
- _logStream = NULL;
- }
-
- // //////////////////////////////////////////////////////////////////////
- LOG::EN_LogLevel Logger::getLogLevel() {
- return _level;
- }
-
- // //////////////////////////////////////////////////////////////////////
- std::ostream& Logger::getLogStream() {
- assert (_logStream != NULL);
- return *_logStream;
- }
-
- // //////////////////////////////////////////////////////////////////////
- void Logger::setLogParameters (const LOG::EN_LogLevel iLogLevel,
- std::ostream& ioLogStream) {
- _level = iLogLevel;
- _logStream = &ioLogStream;
- }
-
- // //////////////////////////////////////////////////////////////////////
- Logger& Logger::instance() {
- if (_instance == NULL) {
- _instance = new Logger (LOG::DEBUG, std::cout);
-
- assert (_instance != NULL);
-
- FacSupervisor::instance().registerLoggerService (_instance);
- }
- return *_instance;
- }
-
-}
Deleted: trunk/rmol/rmol/service/Logger.hpp
===================================================================
--- trunk/rmol/rmol/service/Logger.hpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/service/Logger.hpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,95 +0,0 @@
-#ifndef __RMOL_SVC_LOGGER_HPP
-#define __RMOL_SVC_LOGGER_HPP
-
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
-// STL
-#include <sstream>
-#include <string>
-// RMOL
-#include <rmol/RMOL_Types.hpp>
-
-// /////////////// LOG MACROS /////////////////
-#define RMOL_LOG_CORE(iLevel, iToBeLogged) \
- { std::ostringstream ostr; ostr << iToBeLogged; \
- RMOL::Logger::instance().log (iLevel, __LINE__, __FILE__, ostr.str()); }
-
-#define RMOL_LOG_CRITICAL(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::CRITICAL, iToBeLogged)
-
-#define RMOL_LOG_ERROR(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::ERROR, iToBeLogged)
-
-#define RMOL_LOG_NOTIFICATION(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::NOTIFICATION, iToBeLogged)
-
-#define RMOL_LOG_WARNING(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::WARNING, iToBeLogged)
-
-#define RMOL_LOG_DEBUG(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::DEBUG, iToBeLogged)
-
-#define RMOL_LOG_VERBOSE(iToBeLogged) \
- RMOL_LOG_CORE (RMOL::LOG::VERBOSE, iToBeLogged)
-// /////////// (END OF) LOG MACROS /////////////
-
-
-namespace RMOL {
-
- /** Class holding the stream for logs.
- <br>Note that the error logs are seen as standard output logs,
- but with a higher level of visibility. */
- class Logger {
- // Friend classes
- friend class FacSupervisor;
- public:
-
- /** Main log entry. */
- template <typename T>
- void log (const LOG::EN_LogLevel iLevel, const int iLineNumber,
- const std::string& iFileName, const T& iToBeLogged) {
- if (iLevel <= _level) {
- assert (_logStream != NULL);
- *_logStream << iFileName << ":" << iLineNumber
- << ": " << iToBeLogged << std::endl;
- }
- }
-
- /** Get the log level. */
- LOG::EN_LogLevel getLogLevel();
-
- /** get the log stream. */
- std::ostream& getLogStream();
-
- /** Set the logger parameters (level and stream). */
- void setLogParameters (const LOG::EN_LogLevel iLogLevel,
- std::ostream& ioLogStream);
-
- /** Returns a current Logger instance.*/
- static Logger& instance();
-
- private:
- /** Default constructors are private so that only the required
- constructor can be used. */
- Logger ();
- Logger (const Logger&);
- Logger (const LOG::EN_LogLevel iLevel, std::ostream& ioLogStream);
- /** Destructor. */
- ~Logger ();
-
- private:
- /** Log level. */
- LOG::EN_LogLevel _level;
-
- /** Stream dedicated to the logs. */
- std::ostream* _logStream;
-
- /** Instance object.*/
- static Logger* _instance;
- };
-
-}
-#endif // __RMOL_SVC_LOGGER_HPP
Modified: trunk/rmol/rmol/service/RMOL_Service.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-21 19:33:17 UTC (rev 289)
@@ -3,11 +3,11 @@
// //////////////////////////////////////////////////////////////////////
// STL
#include <cassert>
-#include <iomanip>
-#include <sstream>
-#include <iostream>
// StdAir
#include <stdair/basic/BasChronometer.hpp>
+#include <stdair/basic/BasFileMgr.hpp>
+#include <stdair/bom/BomManager.hpp> // for display()
+#include <stdair/service/Logger.hpp>
// RMOL
#include <rmol/basic/BasConst_RMOL_Service.hpp>
#include <rmol/field/FldYieldRange.hpp>
@@ -21,32 +21,44 @@
#include <rmol/command/Unconstrainer.hpp>
#include <rmol/command/Forecaster.hpp>
#include <rmol/service/RMOL_ServiceContext.hpp>
-#include <rmol/service/Logger.hpp>
#include <rmol/RMOL_Service.hpp>
namespace RMOL {
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service () :
+ RMOL_Service::RMOL_Service (const RMOL_Service& iService) :
_rmolServiceContext (NULL) {
+ assert (false);
}
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service (const RMOL_Service& iService) :
- _rmolServiceContext (iService._rmolServiceContext) {
+ RMOL_Service::RMOL_Service (const stdair::BasLogParams& iLogParams) :
+ _rmolServiceContext (NULL) {
+
+ // Set the log file
+ logInit (iLogParams);
+
+ // Initialise the (remaining of the) context
+ init ();
}
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service (std::ostream& ioLogStream) {
+ RMOL_Service::RMOL_Service () :
+ _rmolServiceContext (NULL) {
// Initialise the context
- init (ioLogStream);
+ init ();
}
// //////////////////////////////////////////////////////////////////////
- RMOL_Service::RMOL_Service (std::ostream& ioLogStream,
- const ResourceCapacity_T iResourceCapacity) {
- // Initialise the context
- init (ioLogStream, iResourceCapacity);
+ RMOL_Service::RMOL_Service (const stdair::BasLogParams& iLogParams,
+ const ResourceCapacity_T iResourceCapacity) :
+ _rmolServiceContext (NULL) {
+
+ // Set the log file
+ logInit (iLogParams);
+
+ // Initialise the (remaining of the) context
+ init (iResourceCapacity);
}
// //////////////////////////////////////////////////////////////////////
@@ -54,10 +66,12 @@
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::init (std::ostream& ioLogStream) {
- // Set the log file
- logInit (LOG::DEBUG, ioLogStream);
+ void RMOL_Service::logInit (const stdair::BasLogParams& iLogParams) {
+ stdair::Logger::init (iLogParams);
+ }
+ // //////////////////////////////////////////////////////////////////////
+ void RMOL_Service::init () {
// Initialise the context
RMOL_ServiceContext& lRMOL_ServiceContext =
FacRmolServiceContext::instance().create ();
@@ -65,11 +79,7 @@
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::init (std::ostream& ioLogStream,
- const ResourceCapacity_T iResourceCapacity) {
- // Set the log file
- logInit (LOG::DEBUG, ioLogStream);
-
+ void RMOL_Service::init (const ResourceCapacity_T iResourceCapacity) {
// Initialise the context
RMOL_ServiceContext& lRMOL_ServiceContext =
FacRmolServiceContext::instance().create (iResourceCapacity);
@@ -77,12 +87,6 @@
}
// //////////////////////////////////////////////////////////////////////
- void RMOL_Service::logInit (const LOG::EN_LogLevel iLogLevel,
- std::ostream& ioLogOutputFile) {
- Logger::instance().setLogParameters (iLogLevel, ioLogOutputFile);
- }
-
- // //////////////////////////////////////////////////////////////////////
void RMOL_Service::setUpStudyStatManager () {
assert (_rmolServiceContext != NULL);
_rmolServiceContext->setUpStudyStatManager ();
@@ -129,6 +133,15 @@
// //////////////////////////////////////////////////////////////////////
void RMOL_Service::readFromInputFile (const std::string& iInputFileName) {
+ // Check that the file path given as input corresponds to an actual file
+ const bool doesExistAndIsReadable =
+ stdair::BasFileMgr::doesExistAndIsReadable (iInputFileName);
+ if (doesExistAndIsReadable == false) {
+ STDAIR_LOG_ERROR ("The input file, '" << iInputFileName
+ << "', can not be retrieved on the file-system");
+ throw FileNotFoundException();
+ }
+
assert (_rmolServiceContext != NULL);
_rmolServiceContext->readFromInputFile (iInputFileName);
}
@@ -175,9 +188,9 @@
const double lOptimisationMeasure = lOptimisationChronometer.elapsed();
// DEBUG
- RMOL_LOG_DEBUG ("Optimisation by Monte-Carlo performed in "
+ STDAIR_LOG_DEBUG ("Optimisation by Monte-Carlo performed in "
<< lOptimisationMeasure);
- RMOL_LOG_DEBUG ("Resulting buckets: " << oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG ("Resulting buckets: " << oBucketHolder_ptr->display());
std::ostringstream logStream;
logStream << "Bid-Price Vector (BPV): ";
@@ -187,10 +200,10 @@
const double bidPrice = lBidPriceVector.at(i);
logStream << std::fixed << std::setprecision (2) << bidPrice << " ";
}
- RMOL_LOG_DEBUG (logStream.str());
+ STDAIR_LOG_DEBUG (logStream.str());
if (lStudyStatManager_ptr != NULL) {
- RMOL_LOG_DEBUG (lStudyStatManager_ptr->describe());
+ STDAIR_LOG_DEBUG (lStudyStatManager_ptr->describe());
}
}
@@ -225,7 +238,7 @@
Optimiser::optimalOptimisationByDP (iCapacity, *oBucketHolder_ptr);
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (oBucketHolder_ptr->display());
}
// //////////////////////////////////////////////////////////////////////
@@ -265,7 +278,7 @@
}
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (oBucketHolder_ptr->display());
std::ostringstream logStream;
logStream << "Bid-Price Vector (BPV): ";
unsigned int size = lBidPriceVector.size();
@@ -274,10 +287,10 @@
const double bidPrice = lBidPriceVector.at(i);
logStream << std::fixed << std::setprecision (2) << bidPrice << " ";
}
- RMOL_LOG_DEBUG (logStream.str());
+ STDAIR_LOG_DEBUG (logStream.str());
if (lStudyStatManager_ptr != NULL) {
- RMOL_LOG_DEBUG (lStudyStatManager_ptr->describe());
+ STDAIR_LOG_DEBUG (lStudyStatManager_ptr->describe());
}
}
@@ -307,7 +320,7 @@
Optimiser::heuristicOptimisationByEmsrA (iCapacity, *oBucketHolder_ptr);
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (oBucketHolder_ptr->display());
}
// //////////////////////////////////////////////////////////////////////
@@ -342,7 +355,7 @@
iSellupProbabilityVector);
// DEBUG
- RMOL_LOG_DEBUG (ioBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (ioBucketHolder_ptr->display());
}
// //////////////////////////////////////////////////////////////////////
@@ -377,7 +390,7 @@
Optimiser::heuristicOptimisationByEmsrB (iCapacity, *oBucketHolder_ptr);
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (oBucketHolder_ptr->display());
}
// //////////////////////////////////////////////////////////////////////
@@ -397,7 +410,7 @@
}
// ///////////////////////////////////////////////////////////////////////
- void RMOL_Service:: legOptimisationByMC () {
+ void RMOL_Service::legOptimisationByMC () {
assert (_rmolServiceContext != NULL);
const ResourceCapacity_T iCapacity = _rmolServiceContext->getCapacity();
BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder();
@@ -408,7 +421,7 @@
lBidPriceVector);
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ STDAIR_LOG_DEBUG (oBucketHolder_ptr->display());
std::ostringstream logStream;
logStream << "Bid-Price Vector (BPV): ";
unsigned int size = lBidPriceVector.size();
@@ -417,7 +430,9 @@
const double bidPrice = lBidPriceVector.at(i);
logStream << std::fixed << std::setprecision (2) << bidPrice << " ";
}
- RMOL_LOG_DEBUG (logStream.str());
+
+ // DEBUG
+ STDAIR_LOG_DEBUG (logStream.str());
}
// ///////////////////////////////////////////////////////////////////////
Modified: trunk/rmol/rmol/service/sources.mk
===================================================================
--- trunk/rmol/rmol/service/sources.mk 2010-01-20 20:10:23 UTC (rev 288)
+++ trunk/rmol/rmol/service/sources.mk 2010-01-21 19:33:17 UTC (rev 289)
@@ -1,7 +1,5 @@
svc_h_sources = $(top_srcdir)/rmol/service/ServiceAbstract.hpp \
- $(top_srcdir)/rmol/service/RMOL_ServiceContext.hpp \
- $(top_srcdir)/rmol/service/Logger.hpp
+ $(top_srcdir)/rmol/service/RMOL_ServiceContext.hpp
svc_cc_sources = $(top_srcdir)/rmol/service/ServiceAbstract.cpp \
$(top_srcdir)/rmol/service/RMOL_ServiceContext.cpp \
- $(top_srcdir)/rmol/service/Logger.cpp \
$(top_srcdir)/rmol/service/RMOL_Service.cpp
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 20:10:31
|
Revision: 288
http://rmol.svn.sourceforge.net/rmol/?rev=288&view=rev
Author: denis_arnaud
Date: 2010-01-20 20:10:23 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Conf] Added a dependency on Boost.Filesystem.
Modified Paths:
--------------
trunk/rmol/rmol/core/Makefile.am
Modified: trunk/rmol/rmol/core/Makefile.am
===================================================================
--- trunk/rmol/rmol/core/Makefile.am 2010-01-20 17:38:13 UTC (rev 287)
+++ trunk/rmol/rmol/core/Makefile.am 2010-01-20 20:10:23 UTC (rev 288)
@@ -20,6 +20,6 @@
$(top_builddir)/rmol/command/libcmd.la \
$(top_builddir)/rmol/service/libsvc.la
librmol_la_LDFLAGS = \
- $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
+ $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB) \
$(top_builddir)/stdair/core/libstdair.la \
$(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 17:38:19
|
Revision: 287
http://rmol.svn.sourceforge.net/rmol/?rev=287&view=rev
Author: denis_arnaud
Date: 2010-01-20 17:38:13 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Test] The sample (CSV) file has been moved to the samples sub-directory of the StdAir library.
Modified Paths:
--------------
trunk/rmol/test/rmol/OptimiseTestSuite.cpp
Modified: trunk/rmol/test/rmol/OptimiseTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-20 17:15:14 UTC (rev 286)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2010-01-20 17:38:13 UTC (rev 287)
@@ -31,7 +31,7 @@
const double cabinCapacity = 100.0;
// Input file name
- const std::string inputFileName ("sample2.csv");
+ const std::string inputFileName ("../samples/rm02.csv");
const bool hasInputFile = true;
// Set the log parameters
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 17:15:20
|
Revision: 286
http://rmol.svn.sourceforge.net/rmol/?rev=286&view=rev
Author: denis_arnaud
Date: 2010-01-20 17:15:14 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Test] The sample (CSV) files have been copied into the samples directory of the StdAir library. Those should be used by default.
Modified Paths:
--------------
trunk/rmol/configure.ac
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2010-01-20 17:08:19 UTC (rev 285)
+++ trunk/rmol/configure.ac 2010-01-20 17:15:14 UTC (rev 286)
@@ -316,6 +316,7 @@
po/Makefile.in
extracppunit/Makefile
test/Makefile
+ test/samples/Makefile
test/stdair/Makefile
test/rmol/Makefile
win32/Makefile)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 17:08:27
|
Revision: 285
http://rmol.svn.sourceforge.net/rmol/?rev=285&view=rev
Author: denis_arnaud
Date: 2010-01-20 17:08:19 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Test] The sample (CSV) files have been copied into the samples directory of the StdAir library. Those should be used by default.
Modified Paths:
--------------
trunk/rmol/rmol/batches/rmol.cpp
trunk/rmol/samples/sources.mk
Added Paths:
-----------
trunk/rmol/samples/rm01.csv
trunk/rmol/samples/rm02.csv
trunk/rmol/samples/rm03.csv
trunk/rmol/samples/rm04.csv
Removed Paths:
-------------
trunk/rmol/samples/sample1.csv
trunk/rmol/samples/sample2.csv
trunk/rmol/samples/sample3.csv
trunk/rmol/samples/sample4.csv
Property Changed:
----------------
trunk/rmol/
Property changes on: trunk/rmol
___________________________________________________________________
Modified: svn:externals
- config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config
stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit
+ https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config config
https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair stdair
https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit extracppunit
https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/test/samples test/samples
Modified: trunk/rmol/rmol/batches/rmol.cpp
===================================================================
--- trunk/rmol/rmol/batches/rmol.cpp 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/rmol/batches/rmol.cpp 2010-01-20 17:08:19 UTC (rev 285)
@@ -19,7 +19,7 @@
const std::string K_RMOL_DEFAULT_LOG_FILENAME ("rmol.log");
/** Default name and location for the (CSV) input file. */
-const std::string K_RMOL_DEFAULT_INPUT_FILENAME ("class.csv");
+const std::string K_RMOL_DEFAULT_INPUT_FILENAME ("../../test/samples/rm01.csv");
/** Default number of random draws to be generated (best if over 100). */
const int K_RMOL_DEFAULT_RANDOM_DRAWS = 100000;
Copied: trunk/rmol/samples/rm01.csv (from rev 284, trunk/rmol/samples/sample1.csv)
===================================================================
--- trunk/rmol/samples/rm01.csv (rev 0)
+++ trunk/rmol/samples/rm01.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -0,0 +1,4 @@
+price; mean; standard deviation;
+100; 20; 9;
+70; 45; 12;
+42; 80; 16;
Copied: trunk/rmol/samples/rm02.csv (from rev 284, trunk/rmol/samples/sample2.csv)
===================================================================
--- trunk/rmol/samples/rm02.csv (rev 0)
+++ trunk/rmol/samples/rm02.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -0,0 +1,5 @@
+price; mean; standard deviation;
+1050; 17.3; 5.8;
+567; 45.1; 15.0;
+534; 39.6; 13.2;
+520; 34.0; 11.3;
Copied: trunk/rmol/samples/rm03.csv (from rev 284, trunk/rmol/samples/sample3.csv)
===================================================================
--- trunk/rmol/samples/rm03.csv (rev 0)
+++ trunk/rmol/samples/rm03.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -0,0 +1,5 @@
+price; mean; standard deviation;
+1050; 17.3; 5.8;
+950; 45.1; 15.0;
+699; 39.6; 13.2;
+520; 34.0; 11.3;
Copied: trunk/rmol/samples/rm04.csv (from rev 284, trunk/rmol/samples/sample4.csv)
===================================================================
--- trunk/rmol/samples/rm04.csv (rev 0)
+++ trunk/rmol/samples/rm04.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -0,0 +1,17 @@
+price; mean; standard deviation;
+2000; 7.3; 2.8;
+1850; 15.1; 5.0;
+1800; 19.6; 5.2;
+1623; 24.0; 6.3;
+1511; 27.3; 5.8;
+1430; 25.1; 7.0;
+1290; 29.6; 7.2;
+1100; 24.0; 6.3;
+1050; 17.3; 5.8;
+950; 25.1; 5.0;
+799; 29.6; 10.2;
+750; 24.0; 11.3;
+700; 27.3; 5.8;
+655; 25.1; 7.0;
+599; 39.6; 13.2;
+520; 44.0; 15.3;
Deleted: trunk/rmol/samples/sample1.csv
===================================================================
--- trunk/rmol/samples/sample1.csv 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/samples/sample1.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -1,4 +0,0 @@
-price; mean; standard deviation;
-100; 20; 9;
-70; 45; 12;
-42; 80; 16;
Deleted: trunk/rmol/samples/sample2.csv
===================================================================
--- trunk/rmol/samples/sample2.csv 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/samples/sample2.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -1,5 +0,0 @@
-price; mean; standard deviation;
-1050; 17.3; 5.8;
-567; 45.1; 15.0;
-534; 39.6; 13.2;
-520; 34.0; 11.3;
Deleted: trunk/rmol/samples/sample3.csv
===================================================================
--- trunk/rmol/samples/sample3.csv 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/samples/sample3.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -1,5 +0,0 @@
-price; mean; standard deviation;
-1050; 17.3; 5.8;
-950; 45.1; 15.0;
-699; 39.6; 13.2;
-520; 34.0; 11.3;
Deleted: trunk/rmol/samples/sample4.csv
===================================================================
--- trunk/rmol/samples/sample4.csv 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/samples/sample4.csv 2010-01-20 17:08:19 UTC (rev 285)
@@ -1,17 +0,0 @@
-price; mean; standard deviation;
-2000; 7.3; 2.8;
-1850; 15.1; 5.0;
-1800; 19.6; 5.2;
-1623; 24.0; 6.3;
-1511; 27.3; 5.8;
-1430; 25.1; 7.0;
-1290; 29.6; 7.2;
-1100; 24.0; 6.3;
-1050; 17.3; 5.8;
-950; 25.1; 5.0;
-799; 29.6; 10.2;
-750; 24.0; 11.3;
-700; 27.3; 5.8;
-655; 25.1; 7.0;
-599; 39.6; 13.2;
-520; 44.0; 15.3;
Modified: trunk/rmol/samples/sources.mk
===================================================================
--- trunk/rmol/samples/sources.mk 2010-01-20 16:51:17 UTC (rev 284)
+++ trunk/rmol/samples/sources.mk 2010-01-20 17:08:19 UTC (rev 285)
@@ -1,5 +1,6 @@
sample_csv_sources = \
- $(top_srcdir)/samples/sample1.csv \
- $(top_srcdir)/samples/sample2.csv \
- $(top_srcdir)/samples/sample3.csv \
- $(top_srcdir)/samples/sample4.csv
+ $(top_srcdir)/samples/rm01.csv \
+ $(top_srcdir)/samples/rm02.csv \
+ $(top_srcdir)/samples/rm03.csv \
+ $(top_srcdir)/samples/rm04.csv
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 16:51:25
|
Revision: 284
http://rmol.svn.sourceforge.net/rmol/?rev=284&view=rev
Author: denis_arnaud
Date: 2010-01-20 16:51:17 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Dev] Removed the BasChronometer class, as it is now given by the StdAir library.
Modified Paths:
--------------
trunk/rmol/rmol/bom/MCOptimiser.cpp
trunk/rmol/rmol/command/Optimiser.cpp
trunk/rmol/rmol/core/Makefile.am
Modified: trunk/rmol/rmol/bom/MCOptimiser.cpp
===================================================================
--- trunk/rmol/rmol/bom/MCOptimiser.cpp 2010-01-20 16:41:38 UTC (rev 283)
+++ trunk/rmol/rmol/bom/MCOptimiser.cpp 2010-01-20 16:51:17 UTC (rev 284)
@@ -1,15 +1,15 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <string>
#include <fstream>
#include <sstream>
#include <cmath>
+// StdAir
+#include <stdair/basic/BasChronometer.hpp>
// RMOL
-#include <rmol/basic/BasChronometer.hpp>
#include <rmol/bom/StudyStatManager.hpp>
#include <rmol/bom/VariateList.hpp>
#include <rmol/bom/Gaussian.hpp>
@@ -259,9 +259,9 @@
// Retrieve the BucketHolder
// BucketHolder& ioBucketHolder = ioResource.getBucketHolder();
- BasChronometer lDrawBasChronometer;
- BasChronometer lSortBasChronometer;
- BasChronometer lBVPCalculationBasChronometer;
+ stdair::BasChronometer lDrawBasChronometer;
+ stdair::BasChronometer lSortBasChronometer;
+ stdair::BasChronometer lBVPCalculationBasChronometer;
// Number of classes/buckets: n
const short nbOfClasses = ioBucketHolder.getSize();
Modified: trunk/rmol/rmol/command/Optimiser.cpp
===================================================================
--- trunk/rmol/rmol/command/Optimiser.cpp 2010-01-20 16:41:38 UTC (rev 283)
+++ trunk/rmol/rmol/command/Optimiser.cpp 2010-01-20 16:51:17 UTC (rev 284)
@@ -1,14 +1,14 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
// STL
+#include <cassert>
//#include <cmath>
#include <sstream>
#include <iomanip>
+// StdAir
+#include <stdair/basic/BasChronometer.hpp>
// RMOL
-#include <rmol/basic/BasChronometer.hpp>
#include <rmol/field/FldYieldRange.hpp>
#include <rmol/field/FldDistributionParameters.hpp>
#include <rmol/bom/StudyStatManager.hpp>
@@ -70,7 +70,7 @@
BucketHolder& ioBucketHolder,
BidPriceVector_T& ioBidPriceVector,
StudyStatManager& ioStudyStatManager) {
- BasChronometer lMCIntegrationBasChrono;
+ stdair::BasChronometer lMCIntegrationBasChrono;
lMCIntegrationBasChrono.start();
// Retrieve the BucketHolder
// BucketHolder& ioBucketHolder = ioResource.getBucketHolder();
@@ -153,7 +153,7 @@
BucketHolder& ioBucketHolder,
BidPriceVector_T& ioBidPriceVector,
StudyStatManager& ioStudyStatManager) {
- BasChronometer lEMRSBasChrono;
+ stdair::BasChronometer lEMRSBasChrono;
lEMRSBasChrono.start();
Emsr::heuristicOptimisationByEmsr (iCabinCapacity,
ioBucketHolder,
Modified: trunk/rmol/rmol/core/Makefile.am
===================================================================
--- trunk/rmol/rmol/core/Makefile.am 2010-01-20 16:41:38 UTC (rev 283)
+++ trunk/rmol/rmol/core/Makefile.am 2010-01-20 16:51:17 UTC (rev 284)
@@ -21,4 +21,5 @@
$(top_builddir)/rmol/service/libsvc.la
librmol_la_LDFLAGS = \
$(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
+ $(top_builddir)/stdair/core/libstdair.la \
$(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-20 16:41:44
|
Revision: 283
http://rmol.svn.sourceforge.net/rmol/?rev=283&view=rev
Author: denis_arnaud
Date: 2010-01-20 16:41:38 +0000 (Wed, 20 Jan 2010)
Log Message:
-----------
[Dev] Removed the BasChronometer class, as it is now given by the StdAir library.
Modified Paths:
--------------
trunk/rmol/rmol/basic/sources.mk
trunk/rmol/rmol/service/RMOL_Service.cpp
Removed Paths:
-------------
trunk/rmol/rmol/basic/BasChronometer.cpp
trunk/rmol/rmol/basic/BasChronometer.hpp
Deleted: trunk/rmol/rmol/basic/BasChronometer.cpp
===================================================================
--- trunk/rmol/rmol/basic/BasChronometer.cpp 2009-12-29 13:24:06 UTC (rev 282)
+++ trunk/rmol/rmol/basic/BasChronometer.cpp 2010-01-20 16:41:38 UTC (rev 283)
@@ -1,50 +0,0 @@
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
-// Rmol
-#include <rmol/basic/BasChronometer.hpp>
-#include <rmol/service/Logger.hpp>
-
-namespace RMOL {
-
- // //////////////////////////////////////////////////////////////////////
- BasChronometer::BasChronometer () : _startTimeLaunched (false) {
- }
-
- // //////////////////////////////////////////////////////////////////////
- void BasChronometer::start () {
- // Get the time-stamp of now, and store it for later use
- _startTime = boost::posix_time::microsec_clock::local_time();
-
- // Update the boolean which states whether the chronometer
- // is launched
- _startTimeLaunched = true;
- }
-
- // //////////////////////////////////////////////////////////////////////
- double BasChronometer::elapsed () const {
- assert (_startTimeLaunched == true);
-
- // Get the time-stamp of now
- const boost::posix_time::ptime lStopTime =
- boost::posix_time::microsec_clock::local_time();
-
- // Calculate the time elapsed since the last time-stamp
- const boost::posix_time::time_duration lElapsedTime =
- lStopTime - _startTime;
-
- // Derived the corresponding number of milliseconds
- const double lElapsedTimeInMicroSeconds =
- static_cast<const double> (lElapsedTime.total_microseconds());
-
- /*RMOL_LOG_DEBUG ("Elapsed: " << lElapsedTime
- << "; (micros): "
- << lElapsedTimeInMicroSeconds / 1e6);*/
-
- // The elapsed time given in return is expressed in seconds
- return (lElapsedTimeInMicroSeconds / 1e6);
- }
-
-}
Deleted: trunk/rmol/rmol/basic/BasChronometer.hpp
===================================================================
--- trunk/rmol/rmol/basic/BasChronometer.hpp 2009-12-29 13:24:06 UTC (rev 282)
+++ trunk/rmol/rmol/basic/BasChronometer.hpp 2010-01-20 16:41:38 UTC (rev 283)
@@ -1,40 +0,0 @@
-#ifndef __RMOL_COM_BAS_BASCHRONOMETER_HPP
-#define __RMOL_COM_BAS_BASCHRONOMETER_HPP
-
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// Boost Date-Time (http://boost.org/doc/html/date_time/posix_time.html)
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-namespace RMOL {
-
- /** Structure allowing measuring the time elapsed between two events. */
- struct BasChronometer {
- /** Constructor. */
- BasChronometer();
-
- /** Start the chronometer from the local time
- <br>The elapsed time given is the one elapsed since the start
- is launched. */
- void start ();
-
- /** Get the start time. */
- std::string getStart () const {
- return boost::posix_time::to_simple_string (_startTime);
- }
-
- /** Return the time elapsed since the structure has been instanciated.
- <br>That elapsed time is expressed in seconds. */
- double elapsed () const;
-
- private:
- /** Start time. */
- boost::posix_time::ptime _startTime;
-
- /** Boolean which states whether the chronometer is started or not.*/
- bool _startTimeLaunched;
- };
-
-}
-#endif // __RMOL_COM_BAS_BASCHRONOMETER_HPP
Modified: trunk/rmol/rmol/basic/sources.mk
===================================================================
--- trunk/rmol/rmol/basic/sources.mk 2009-12-29 13:24:06 UTC (rev 282)
+++ trunk/rmol/rmol/basic/sources.mk 2010-01-20 16:41:38 UTC (rev 283)
@@ -1,6 +1,4 @@
bas_h_sources = $(top_srcdir)/rmol/basic/BasConst_General.hpp \
$(top_srcdir)/rmol/basic/BasConst_Overbooking.hpp \
- $(top_srcdir)/rmol/basic/BasConst_RMOL_Service.hpp \
- $(top_srcdir)/rmol/basic/BasChronometer.hpp
-bas_cc_sources = $(top_srcdir)/rmol/basic/BasConst.cpp \
- $(top_srcdir)/rmol/basic/BasChronometer.cpp
+ $(top_srcdir)/rmol/basic/BasConst_RMOL_Service.hpp
+bas_cc_sources = $(top_srcdir)/rmol/basic/BasConst.cpp
Modified: trunk/rmol/rmol/service/RMOL_Service.cpp
===================================================================
--- trunk/rmol/rmol/service/RMOL_Service.cpp 2009-12-29 13:24:06 UTC (rev 282)
+++ trunk/rmol/rmol/service/RMOL_Service.cpp 2010-01-20 16:41:38 UTC (rev 283)
@@ -1,12 +1,13 @@
// //////////////////////////////////////////////////////////////////////
// Import section
// //////////////////////////////////////////////////////////////////////
-// C
-#include <assert.h>
// STL
+#include <cassert>
#include <iomanip>
#include <sstream>
#include <iostream>
+// StdAir
+#include <stdair/basic/BasChronometer.hpp>
// RMOL
#include <rmol/basic/BasConst_RMOL_Service.hpp>
#include <rmol/field/FldYieldRange.hpp>
@@ -152,11 +153,14 @@
const double iCapacity = _rmolServiceContext->getCapacity();
BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder();
assert (oBucketHolder_ptr != NULL);
+
BidPriceVector_T lBidPriceVector;
-
StudyStatManager* lStudyStatManager_ptr =
_rmolServiceContext->getStudyStatManager();
+ stdair::BasChronometer lOptimisationChronometer;
+ lOptimisationChronometer.start();
+
if (lStudyStatManager_ptr == NULL) {
Optimiser::optimalOptimisationByMCIntegration (K, iCapacity,
*oBucketHolder_ptr,
@@ -167,8 +171,13 @@
lBidPriceVector,
*lStudyStatManager_ptr);
}
+
+ const double lOptimisationMeasure = lOptimisationChronometer.elapsed();
+
// DEBUG
- RMOL_LOG_DEBUG (oBucketHolder_ptr->display());
+ RMOL_LOG_DEBUG ("Optimisation by Monte-Carlo performed in "
+ << lOptimisationMeasure);
+ RMOL_LOG_DEBUG ("Resulting buckets: " << oBucketHolder_ptr->display());
std::ostringstream logStream;
logStream << "Bid-Price Vector (BPV): ";
@@ -452,6 +461,5 @@
iSellupFactorHolder);
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-29 13:24:16
|
Revision: 282
http://rmol.svn.sourceforge.net/rmol/?rev=282&view=rev
Author: denis_arnaud
Date: 2009-12-29 13:24:06 +0000 (Tue, 29 Dec 2009)
Log Message:
-----------
[Conf] Removed the config directory, so as to have it as an external reference.
Removed Paths:
-------------
trunk/rmol/config/
Property Changed:
----------------
trunk/rmol/
Property changes on: trunk/rmol
___________________________________________________________________
Modified: svn:externals
- stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit
+ config https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/config
stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 18:22:44
|
Revision: 281
http://rmol.svn.sourceforge.net/rmol/?rev=281&view=rev
Author: denis_arnaud
Date: 2009-12-28 18:22:37 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Fixed a compilation bug.
Modified Paths:
--------------
trunk/rmol/test/rmol/bomsforforecaster.cpp
Modified: trunk/rmol/test/rmol/bomsforforecaster.cpp
===================================================================
--- trunk/rmol/test/rmol/bomsforforecaster.cpp 2009-12-28 16:08:18 UTC (rev 280)
+++ trunk/rmol/test/rmol/bomsforforecaster.cpp 2009-12-28 18:22:37 UTC (rev 281)
@@ -9,7 +9,7 @@
#include <limits>
// #include <iostream>
// RMOL
-#include <RMOL_Service.hpp>
+#include <rmol/RMOL_Service.hpp>
#include <rmol/service/Logger.hpp>
namespace RMOL {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 16:08:32
|
Revision: 280
http://rmol.svn.sourceforge.net/rmol/?rev=280&view=rev
Author: denis_arnaud
Date: 2009-12-28 16:08:18 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] The ExtraCC library is now embedded within the project.
Modified Paths:
--------------
trunk/rmol/Makefile.am
trunk/rmol/configure.ac
trunk/rmol/test/Makefile.am
trunk/rmol/test/rmol/ForecasterTestSuite.cpp
trunk/rmol/test/rmol/Makefile.am
trunk/rmol/test/rmol/OptimiseTestSuite.cpp
trunk/rmol/test/rmol/SimulateTestSuite.cpp
trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
Property Changed:
----------------
trunk/rmol/
trunk/rmol/test/
Property changes on: trunk/rmol
___________________________________________________________________
Modified: svn:externals
- stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
+ stdair https://stdair.svn.sourceforge.net/svnroot/stdair/trunk/stdair/stdair
extracppunit https://extracc.svn.sourceforge.net/svnroot/extracc/trunk/extracc/extracppunit
Modified: trunk/rmol/Makefile.am
===================================================================
--- trunk/rmol/Makefile.am 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/Makefile.am 2009-12-28 16:08:18 UTC (rev 280)
@@ -25,7 +25,8 @@
EXTRA_DIST =
# Build in these directories:
-SUBDIRS = stdair rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) samples $(TEST_DIR)
+SUBDIRS = stdair rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) \
+ samples extracppunit $(TEST_DIR)
# Configuration helpers
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/configure.ac 2009-12-28 16:08:18 UTC (rev 280)
@@ -314,8 +314,8 @@
doc/doxygen_html.cfg
doc/sourceforge/howto_release_rmol.html
po/Makefile.in
+ extracppunit/Makefile
test/Makefile
- test/com/Makefile
test/stdair/Makefile
test/rmol/Makefile
win32/Makefile)
Property changes on: trunk/rmol/test
___________________________________________________________________
Added: svn:externals
+
Modified: trunk/rmol/test/Makefile.am
===================================================================
--- trunk/rmol/test/Makefile.am 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/Makefile.am 2009-12-28 16:08:18 UTC (rev 280)
@@ -4,7 +4,7 @@
MAINTAINERCLEANFILES = Makefile.in
##
-SUBDIRS = com rmol
+SUBDIRS = rmol
##
EXTRA_TESTS = valarrays
Modified: trunk/rmol/test/rmol/ForecasterTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2009-12-28 16:08:18 UTC (rev 280)
@@ -6,7 +6,7 @@
#include <vector>
#include <cmath>
// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
+#include <extracppunit/CppUnitCore.hpp>
// RMOL
#include <rmol/RMOL_Service.hpp>
#include <rmol/RMOL_Types.hpp>
Modified: trunk/rmol/test/rmol/Makefile.am
===================================================================
--- trunk/rmol/test/rmol/Makefile.am 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/rmol/Makefile.am 2009-12-28 16:08:18 UTC (rev 280)
@@ -21,20 +21,20 @@
OptimiseTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
OptimiseTestSuite_LDADD =
OptimiseTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/extracppunit/libextracc-extracppunit.la \
$(top_builddir)/rmol/core/librmol.la
SimulateTestSuite_SOURCES = SimulateTestSuite.hpp SimulateTestSuite.cpp
SimulateTestSuite_CXXFLAGS = $(BOOST_CFLAGS) $(GSL_CFLAGS) $(CPPUNIT_CFLAGS)
SimulateTestSuite_LDADD =
SimulateTestSuite_LDFLAGS = $(BOOST_LIBS) $(GSL_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la
+ $(top_builddir)/extracppunit/libextracc-extracppunit.la
ForecasterTestSuite_SOURCES = ForecasterTestSuite.hpp ForecasterTestSuite.cpp
ForecasterTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
ForecasterTestSuite_LDADD =
ForecasterTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/extracppunit/libextracc-extracppunit.la \
$(top_builddir)/rmol/core/librmol.la
UnconstrainerTestSuite_SOURCES = UnconstrainerTestSuite.hpp \
@@ -42,7 +42,7 @@
UnconstrainerTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS)
UnconstrainerTestSuite_LDADD =
UnconstrainerTestSuite_LDFLAGS = $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/extracppunit/libextracc-extracppunit.la \
$(top_builddir)/rmol/core/librmol.la
bomsforforecaster_SOURCES = bomsforforecaster.cpp
Modified: trunk/rmol/test/rmol/OptimiseTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2009-12-28 16:08:18 UTC (rev 280)
@@ -2,7 +2,7 @@
#include <fstream>
#include <string>
// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
+#include <extracppunit/CppUnitCore.hpp>
// RMOL
#include <rmol/RMOL_Service.hpp>
#include <rmol/RMOL_Types.hpp>
Modified: trunk/rmol/test/rmol/SimulateTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/SimulateTestSuite.cpp 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/rmol/SimulateTestSuite.cpp 2009-12-28 16:08:18 UTC (rev 280)
@@ -9,7 +9,7 @@
// Chapter 19)
#include <gsl/gsl_randist.h>
// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
+#include <extracppunit/CppUnitCore.hpp>
// RMOL Test Suite
#include <test/rmol/SimulateTestSuite.hpp>
Modified: trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
===================================================================
--- trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2009-12-28 15:27:45 UTC (rev 279)
+++ trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp 2009-12-28 16:08:18 UTC (rev 280)
@@ -4,7 +4,7 @@
#include <fstream>
#include <string>
// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
+#include <extracppunit/CppUnitCore.hpp>
// RMOL
#include <rmol/RMOL_Service.hpp>
#include <rmol/RMOL_Types.hpp>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 15:27:52
|
Revision: 279
http://rmol.svn.sourceforge.net/rmol/?rev=279&view=rev
Author: denis_arnaud
Date: 2009-12-28 15:27:45 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Removed the com sub-directory, in order to replace it by an external reference to ExtraCC.
Removed Paths:
-------------
trunk/rmol/test/com/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-12-28 14:24:49
|
Revision: 278
http://rmol.svn.sourceforge.net/rmol/?rev=278&view=rev
Author: denis_arnaud
Date: 2009-12-28 14:24:38 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Moved the tests into a sub-directory labelled 'rmol', so that it can be exported and shared by other projects.
Modified Paths:
--------------
trunk/rmol/configure.ac
Added Paths:
-----------
trunk/rmol/test/Makefile.am
trunk/rmol/test/rmol/
trunk/rmol/test/rmol/ForecasterTestSuite.cpp
trunk/rmol/test/rmol/ForecasterTestSuite.hpp
trunk/rmol/test/rmol/Makefile.am
trunk/rmol/test/rmol/OptimiseTestSuite.cpp
trunk/rmol/test/rmol/OptimiseTestSuite.hpp
trunk/rmol/test/rmol/SimulateTestSuite.cpp
trunk/rmol/test/rmol/SimulateTestSuite.hpp
trunk/rmol/test/rmol/UnconstrainerTestSuite.cpp
trunk/rmol/test/rmol/UnconstrainerTestSuite.hpp
trunk/rmol/test/rmol/bomsforforecaster.cpp
trunk/rmol/test/rmol/sample2.csv
trunk/rmol/test/rmol/testLib.sh
trunk/rmol/test/rmol/testSim.sh
Removed Paths:
-------------
trunk/rmol/test/ForecasterTestSuite.cpp
trunk/rmol/test/ForecasterTestSuite.hpp
trunk/rmol/test/Makefile.am
trunk/rmol/test/OptimiseTestSuite.cpp
trunk/rmol/test/OptimiseTestSuite.hpp
trunk/rmol/test/SimulateTestSuite.cpp
trunk/rmol/test/SimulateTestSuite.hpp
trunk/rmol/test/UnconstrainerTestSuite.cpp
trunk/rmol/test/UnconstrainerTestSuite.hpp
trunk/rmol/test/bomsforforecaster.cpp
trunk/rmol/test/testLib.sh
trunk/rmol/test/testSim.sh
Modified: trunk/rmol/configure.ac
===================================================================
--- trunk/rmol/configure.ac 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/configure.ac 2009-12-28 14:24:38 UTC (rev 278)
@@ -317,6 +317,7 @@
test/Makefile
test/com/Makefile
test/stdair/Makefile
+ test/rmol/Makefile
win32/Makefile)
AC_OUTPUT
Deleted: trunk/rmol/test/ForecasterTestSuite.cpp
===================================================================
--- trunk/rmol/test/ForecasterTestSuite.cpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/ForecasterTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,158 +0,0 @@
-// STL
-#include <sstream>
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <vector>
-#include <cmath>
-// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
-// RMOL
-#include <rmol/RMOL_Service.hpp>
-#include <rmol/RMOL_Types.hpp>
-#include <rmol/RMOL_FORECASTER_Types.hpp>
-// RMOL Test Suite
-#include <test/ForecasterTestSuite.hpp>
-
-// //////////////////////////////////////////////////////////////////////
-int testForecasterHelper (const unsigned short forecastingMethodFlag) {
- int passedTests = 0;
- try {
-
- // Output log File
- std::string lLogFilename ("ForecasterTestSuite.log");
-
- // Methods of forecasting (0 = Q-Forecasting)
- const unsigned short METHOD_FLAG = forecastingMethodFlag;
-
- // Set the log parameters
- std::ofstream logOutputFile;
- // Open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
- std::ostringstream oDebugStr;
-
- // Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile);
-
- // A sample historical demand data to be processed by forecaster
- // Class | Q | M | B | Y |
- // Price | 100 | 200 | 300 | 400 |
- // Historical uncensored demand data at a DCP
- // | 10 | 5 | 0 | 0 | <- 2008/01/01
- // | 0 | 10 | 0 | 0 | <- 2008/01/08
- // | 0 | 12 | 0 | 0 | <- 2008/01/15
- // | 0 | 0 | 5 | 2 | <- 2008/01/22
- // The order of the vectors: M, Q, Y, B
-
- // Sample historical data vector
- RMOL::HistoricalDataHolderHolder_T lHistoricalDataHolderHolder;
- std::vector<double> azeroVector(3,0); // 3 copies of 0 element
- std::vector<double> sampleHistoricalDataHolder;
- // Historical data of M class
- sampleHistoricalDataHolder.push_back(5);
- sampleHistoricalDataHolder.push_back(10);
- sampleHistoricalDataHolder.push_back(12);
- sampleHistoricalDataHolder.push_back(0);
- lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
- // Historical data of Q class
- sampleHistoricalDataHolder = azeroVector;
- sampleHistoricalDataHolder.insert
- (sampleHistoricalDataHolder.begin(), 1, 10);
- lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
- // Historical data of Y class
- sampleHistoricalDataHolder = azeroVector;
- sampleHistoricalDataHolder.insert
- (sampleHistoricalDataHolder.end(), 1, 2);
- lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
- // Historical data of B class
- sampleHistoricalDataHolder = azeroVector;
- sampleHistoricalDataHolder.insert
- (sampleHistoricalDataHolder.end(), 1, 5);
- lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
-
- // Sample price vector
- RMOL::PriceHolder_T lPriceVector;
- lPriceVector.push_back(200);
- lPriceVector.push_back(100);
- lPriceVector.push_back(400);
- lPriceVector.push_back(300);
-
- // Sample Sellup Factor Vector
- // that makes sell up probability of [Q,M,B,Y] = [1, 0.5, 0.4, 0.2]
- RMOL::SellupFactorHolder_T lSellupFactorHolder;
- lSellupFactorHolder.push_back(log(2));
- lSellupFactorHolder.push_back(1);
- lSellupFactorHolder.push_back(log(5)/3);
- lSellupFactorHolder.push_back(log(2.5)/2);
-
- // Forecaster output container
- RMOL::ForecastedDemandParameterList_T lForecastedDemandParameterList;
- switch (METHOD_FLAG) {
-
- case 0 : // Calculate Q-equivalent demand
- {
- rmolService.demandForecastByQForecasting (lForecastedDemandParameterList,
- lHistoricalDataHolderHolder,
- lPriceVector,
- lSellupFactorHolder);
- // Verify the known mean is returned
- oDebugStr << "Case 0: Tested Q-Forecasting algorithm for the given example\n"
- << "Before the test, the flag is " << passedTests << "\n";
- std::vector<double> demandParametersOfAClass =
- lForecastedDemandParameterList.at(1);
- if (demandParametersOfAClass.at(0) == 10.8125) {passedTests = 1;};
- oDebugStr << "After the test, the flag is " << passedTests << "\n";
- break;
- }
- case 1 :
- {
- oDebugStr << "Case 1: Tested "
- << "Before the test, the flag is " << passedTests << "\n";
- //
- oDebugStr << "After the test, the flag is " << passedTests << "\n";
- break;
- }
-
-
- default :
- {
- rmolService.demandForecastByQForecasting (lForecastedDemandParameterList,
- lHistoricalDataHolderHolder,
- lPriceVector,
- lSellupFactorHolder);
- oDebugStr << "Default case Tested Q-Forecasting algorithm for the given example\n"
- << "Before the test, the flag is " << passedTests << "\n";
- std::vector<double> demandParametersOfAClass =
- lForecastedDemandParameterList.at(1);
- if (demandParametersOfAClass.at(0) == 10.8125) {passedTests = 1;};
- oDebugStr << "After the test, the flag is " << passedTests << "\n";
- }
- }
- logOutputFile << oDebugStr.str() << "\n";
- logOutputFile.close();
-
- } catch (const std::exception& stde) {
- std::cerr << "Standard exception: " << stde.what() << std::endl;
-
- } catch (...) {
- std::cerr << "Unknown exception" << std::endl;
- }
-
- return passedTests;
-}
-
-// //////////////////////////////////////////////////////////////////////
-void ForecasterTestSuite::testQForecaster() {
- const int lTestSuccessFlag = testForecasterHelper(0);
- CPPUNIT_ASSERT (lTestSuccessFlag == 1);
-}
-
-// //////////////////////////////////////////////////////////////////////
-ForecasterTestSuite::ForecasterTestSuite () {
- _describeKey << "Running test on RMOL Forecast function";
-}
-
-// /////////////// M A I N /////////////////
-CPPUNIT_MAIN()
-
Deleted: trunk/rmol/test/ForecasterTestSuite.hpp
===================================================================
--- trunk/rmol/test/ForecasterTestSuite.hpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/ForecasterTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,22 +0,0 @@
-// STL
-#include <sstream>
-// CPPUNIT
-#include <cppunit/extensions/HelperMacros.h>
-
-class ForecasterTestSuite : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE (ForecasterTestSuite);
- CPPUNIT_TEST (testQForecaster);
- CPPUNIT_TEST_SUITE_END ();
-public:
-
- /** Test Q-forecaster. */
- void testQForecaster();
-
- /** Constructor. */
- ForecasterTestSuite ();
-
-protected:
- std::stringstream _describeKey;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION (ForecasterTestSuite);
Deleted: trunk/rmol/test/Makefile.am
===================================================================
--- trunk/rmol/test/Makefile.am 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/Makefile.am 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,56 +0,0 @@
-## test sub-directory
-include $(top_srcdir)/Makefile.common
-
-MAINTAINERCLEANFILES = Makefile.in
-
-##
-SUBDIRS = com
-
-EXTRA_DIST = testLib.sh
-##
-
-EXTRA_TESTS = valarrays bomsforforecaster
-STD_CHECKS = OptimiseTestSuite SimulateTestSuite ForecasterTestSuite UnconstrainerTestSuite
-check_PROGRAMS = $(STD_CHECKS) $(EXTRA_TESTS)
-TESTS = $(STD_CHECKS)
-XFAIL_TESTS = #IndexBuildingTestSuite
-
-OptimiseTestSuite_SOURCES = OptimiseTestSuite.hpp OptimiseTestSuite.cpp
-OptimiseTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
-OptimiseTestSuite_LDADD =
-OptimiseTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la
-
-SimulateTestSuite_SOURCES = SimulateTestSuite.hpp SimulateTestSuite.cpp
-SimulateTestSuite_CXXFLAGS = $(BOOST_CFLAGS) $(GSL_CFLAGS) $(CPPUNIT_CFLAGS)
-SimulateTestSuite_LDADD =
-SimulateTestSuite_LDFLAGS = $(BOOST_LIBS) $(GSL_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la
-
-ForecasterTestSuite_SOURCES = ForecasterTestSuite.hpp ForecasterTestSuite.cpp
-ForecasterTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
-ForecasterTestSuite_LDADD =
-ForecasterTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la
-
-UnconstrainerTestSuite_SOURCES = UnconstrainerTestSuite.hpp UnconstrainerTestSuite.cpp
-UnconstrainerTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS)
-UnconstrainerTestSuite_LDADD =
-UnconstrainerTestSuite_LDFLAGS = $(CPPUNIT_LIBS) \
- $(top_builddir)/test/com/libcppunitcore.la \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la
-
-valarrays_SOURCES = valarrays.cpp
-valarrays_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
-valarrays_LDADD =
-valarrays_LDFLAGS = $(BOOST_LIBS)
-
-bomsforforecaster_SOURCES = bomsforforecaster.cpp
-bomsforforecaster_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
-bomsforforecaster_LDADD =
-bomsforforecaster_LDFLAGS = $(BOOST_LIBS) \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la \
- $(top_builddir)/@PACKAGE@/service/libsvc.la
-
Added: trunk/rmol/test/Makefile.am
===================================================================
--- trunk/rmol/test/Makefile.am (rev 0)
+++ trunk/rmol/test/Makefile.am 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,21 @@
+## test sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+##
+SUBDIRS = com rmol
+
+##
+EXTRA_TESTS = valarrays
+
+STD_CHECKS =
+check_PROGRAMS = $(STD_CHECKS) $(EXTRA_TESTS)
+TESTS = $(STD_CHECKS)
+XFAIL_TESTS = #valarrays
+
+
+valarrays_SOURCES = valarrays.cpp
+valarrays_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
+valarrays_LDADD =
+valarrays_LDFLAGS = $(BOOST_LIBS)
Deleted: trunk/rmol/test/OptimiseTestSuite.cpp
===================================================================
--- trunk/rmol/test/OptimiseTestSuite.cpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/OptimiseTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,203 +0,0 @@
-// STL
-#include <fstream>
-#include <string>
-// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
-// RMOL
-#include <rmol/RMOL_Service.hpp>
-#include <rmol/RMOL_Types.hpp>
-// RMOL Test Suite
-#include <test/OptimiseTestSuite.hpp>
-
-// //////////////////////////////////////////////////////////////////////
-int testOptimiseHelper (const unsigned short optimisationMethodFlag) {
-
- // Return value
- int oExpectedBookingLimit = 0;
-
- try {
-
- // Output log File
- std::string lLogFilename ("OptimiseTestSuite.log");
-
- // Number of random draws to be generated (best if greater than 100)
- const int K = 100000;
-
- // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming,
- // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sellup prob.)
- const unsigned short METHOD_FLAG = optimisationMethodFlag;
-
- // Cabin Capacity (it must be greater then 100 here)
- const double cabinCapacity = 100.0;
-
- // Input file name
- const std::string inputFileName ("../samples/sample2.csv");
- const bool hasInputFile = true;
-
- // Set the log parameters
- std::ofstream logOutputFile;
- // Open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
-
- // Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile, cabinCapacity);
-
- // Define bid price and booking Limit vectors
- RMOL::BidPriceVector_T lBidPriceVector;
- RMOL::ProtectionLevelVector_T lProtectionLevelVector;
- RMOL::BookingLimitVector_T lBookingLimitVector;
-
- if (hasInputFile) {
- // Read the input file
- rmolService.readFromInputFile (inputFileName);
-
- } else {
- // No input file has been provided. So, process a sample.
-
- // STEP 0.
- // List of demand distribution parameters (mean and standard deviation)
-
- // Class/bucket 1: N (20, 9), p1 = 100
- rmolService.addBucket (100.0, 20, 9);
-
- // Class/bucket 2: N (45, 12), p2 = 70
- rmolService.addBucket (70.0, 45, 12);
-
- // Class/bucket 3: no need to define a demand distribution, p3 = 42
- rmolService.addBucket (42.0, 0, 0);
- }
-
- switch (METHOD_FLAG) {
-
- case 0 : // Calculate the optimal protections by the Monte Carlo
- // Integration approach
- {
- rmolService.optimalOptimisationByMCIntegration (K);
- break;
- }
- case 1 : // Calculate the optimal protections by DP.
- {
- rmolService.optimalOptimisationByDP ();
- break;
- }
- case 2 : // Calculate the Bid-Price Vector by EMSR
- {
- rmolService.heuristicOptimisationByEmsr ();
- break;
- }
- case 3 : // Calculate the protections by EMSR-a
- {
- // Test the EMSR-a algorithm implementation
- rmolService.heuristicOptimisationByEmsrA (lBidPriceVector,
- lProtectionLevelVector,
- lBookingLimitVector);
-
- // Return a cumulated booking limit value to test
- oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
- break;
- }
- case 4 : // Calculate the protections by EMSR-b
- {
- rmolService.heuristicOptimisationByEmsrB ();
- break;
- }
- case 5 : // Calculate the protection by EMSR-a with sellup
- {
- // Create an empty sell-up probability vector
- std::vector<double> sellupProbabilityVector;
-
- // Define the sell-up probability to be 20%
- const double sampleProbability = 0.2;
-
- // NOTE: size of sellup vector should be equal to no of buckets - 1
- // TODO: check that with an assertion
- const short nbOfSampleBucket = 4;
- for (short i = 1; i <= nbOfSampleBucket - 1; i++) {
- sellupProbabilityVector.push_back (sampleProbability);
- }
-
- // Test the algorithm with the sample sell-up vector
- rmolService.heuristicOptimisationByEmsrAwithSellup
- (sellupProbabilityVector, lProtectionLevelVector,
- lBidPriceVector, lBookingLimitVector);
-
- // Return a cumulated booking limit value to test
- oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
-
- break;
- }
-
- default : rmolService.optimalOptimisationByMCIntegration (K);
- }
-
- } catch (const std::exception& stde) {
- std::cerr << "Standard exception: " << stde.what() << std::endl;
-
- } catch (...) {
- std::cerr << "Unknown exception" << std::endl;
- }
-
- return oExpectedBookingLimit;
-}
-
-
-// //////////////////////////////////////////////////////////////////////
-// Test is based on the following inputs values
-// price; mean; standard deviation;
-// 1050; 17.3; 5.8;
-// 567; 45.1; 15.0;
-// 534; 39.6; 13.2;
-// 520; 34.0; 11.3;
-// //////////////////////////////////////////////////////////////////////
-
-// Monte-Carlo (MC)
-void OptimiseTestSuite::testOptimiseMC() {
- CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(0););
-}
-
-// //////////////////////////////////////////////////////////////////////
-// Dynamic Programming (DP)
-void OptimiseTestSuite::testOptimiseDP() {
- CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(1););
-}
-
-// //////////////////////////////////////////////////////////////////////
-// EMSR
-void OptimiseTestSuite::testOptimiseEMSR() {
- CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(2););
-}
-
-// //////////////////////////////////////////////////////////////////////
-// EMSR-a
-void OptimiseTestSuite::testOptimiseEMSRa() {
- const int lExpectedBookingLimit = testOptimiseHelper(3);
- CPPUNIT_ASSERT(lExpectedBookingLimit == 61);
-}
-
-// //////////////////////////////////////////////////////////////////////
-// EMSR-b
-void OptimiseTestSuite::testOptimiseEMSRb() {
- CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(4););
-}
-
-// //////////////////////////////////////////////////////////////////////
-// EMSR-a with sell-up
-void OptimiseTestSuite::testOptimiseEMSRaWithSU() {
- const int lExpectedBookingLimit = testOptimiseHelper(5);
- CPPUNIT_ASSERT(lExpectedBookingLimit == 59);
-}
-
-// //////////////////////////////////////////////////////////////////////
-// void OptimiseTestSuite::errorCase () {
-// CPPUNIT_ASSERT (false);
-// }
-
-// //////////////////////////////////////////////////////////////////////
-OptimiseTestSuite::OptimiseTestSuite () {
- _describeKey << "Running test on RMOL Optimisation function";
-}
-
-// /////////////// M A I N /////////////////
-CPPUNIT_MAIN()
-
Deleted: trunk/rmol/test/OptimiseTestSuite.hpp
===================================================================
--- trunk/rmol/test/OptimiseTestSuite.hpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/OptimiseTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,50 +0,0 @@
-// STL
-#include <sstream>
-// CPPUNIT
-#include <cppunit/extensions/HelperMacros.h>
-
-class OptimiseTestSuite : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE (OptimiseTestSuite);
- CPPUNIT_TEST (testOptimiseMC);
- CPPUNIT_TEST (testOptimiseDP);
- CPPUNIT_TEST (testOptimiseEMSR);
- CPPUNIT_TEST (testOptimiseEMSRa);
- CPPUNIT_TEST (testOptimiseEMSRb);
- CPPUNIT_TEST (testOptimiseEMSRaWithSU);
- // CPPUNIT_TEST (errorCase);
- CPPUNIT_TEST_SUITE_END ();
-public:
-
- /** Test the Monte-Carlo (MC) Optimisation functionality. */
- void testOptimiseMC();
-
- /** Test the Dynamic Programming (DP) Optimisation functionality. */
- void testOptimiseDP();
-
- /** Test the Expected Marginal Seat Revenue (EMSR) Optimisation
- functionality. */
- void testOptimiseEMSR();
-
- /** Test the Expected Marginal Seat Revenue, variant a (EMSR-a),
- Optimisation functionality. */
- void testOptimiseEMSRa();
-
- /** Test the Expected Marginal Seat Revenue, variant b (EMSR-b),
- Optimisation functionality. */
- void testOptimiseEMSRb();
-
- /** Test the Expected Marginal Seat Revenue, variant a (EMSR-a) with
- sell-up (fare/yield adjustment), Optimisation functionality. */
- void testOptimiseEMSRaWithSU();
-
- /** Test some error detection functionalities. */
- // void errorCase ();
-
- /** Constructor. */
- OptimiseTestSuite ();
-
-protected:
- std::stringstream _describeKey;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION (OptimiseTestSuite);
Deleted: trunk/rmol/test/SimulateTestSuite.cpp
===================================================================
--- trunk/rmol/test/SimulateTestSuite.cpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/SimulateTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,138 +0,0 @@
-// STL
-#include <iostream>
-#include <sstream>
-// Boost (Extended STL)
-#include <boost/date_time/posix_time/posix_time.hpp>
-// GSL Random Number Generation (GSL Reference Manual, version 1.7, Chapter 17)
-#include <gsl/gsl_rng.h>
-// GSL Random Number Distributions (GSL Reference Manual, version 1.7,
-// Chapter 19)
-#include <gsl/gsl_randist.h>
-// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
-// RMOL Test Suite
-#include <test/SimulateTestSuite.hpp>
-
-// Random Generator Type
-const gsl_rng_type* _rngTypePtr = NULL;
-
-// Random Generator
-gsl_rng* _rngExponentialPtr = NULL;
-gsl_rng* _rngPoissonPtr = NULL;
-
-// ///////////////////////////////////////////////////
-void init () {
- // Random Generator type
- _rngTypePtr = gsl_rng_default;
-
- // Initialise the Random Generator
- gsl_rng_env_setup ();
-
- // Allocate the memory for the random generator
- _rngExponentialPtr = gsl_rng_alloc (_rngTypePtr);
- _rngPoissonPtr = gsl_rng_alloc (_rngTypePtr);
-}
-
-// ///////////////////////////////////////////////////
-double generateExponentialVariate (const double iLambda) {
- const double lMu = 1/iLambda;
- double result = gsl_ran_exponential (_rngExponentialPtr, lMu);
- return result;
-}
-
-// ///////////////////////////////////////////////////
-double generatePoissonVariate (const double iMu) {
- double result = gsl_ran_poisson (_rngPoissonPtr, iMu);
- return result;
-}
-
-// ///////////////////////////////////////////////////
-void finalise () {
- gsl_rng_free (_rngExponentialPtr);
- gsl_rng_free (_rngPoissonPtr);
-}
-
-// //////////////////////////////////////////////////////////////////////
-void testSimulateHelper() {
- try {
-
- // Output log File
- std::string lLogFilename ("SimulateTestSuite.log");
-
- // Time duration representing a full day
- // (i.e., 24h or 1,440 minutes or 86,400 seconds)
- const boost::posix_time::time_duration kDay (24, 0, 0, 0);
-
- // Length of the Simulation (time-length)
- const int kSimulationLength = 365;
-
- // Rate, expressed as a number of events per day
- // (lambda => mu = 1/ lambda)
- const double lambda = 10.0;
- // mu = 0.1 (= 2.4h, i.e., in average, an event occurs every 2.4h)
-
- // Initialisation of random generators
- init();
-
- // Generate k draws
- // std::cout << "Event#; Time; " << std::endl;
- for (int i=1; i != kSimulationLength; i++) {
-
- // Current time
- boost::posix_time::time_duration lCurrentTime (0, 0, 0, 0);
-
- // Current number of events
- int lEventNumber = 0;
-
- // Repeat until the current time exceeds 24h (i.e., 86,400 seconds)
- while (lCurrentTime <= kDay) {
- const double lExponentialVariateDay =
- generateExponentialVariate (lambda);
- const long int lExponentialVariateHours =
- static_cast<long int> (lExponentialVariateDay * 24);
- const boost::posix_time::time_duration lExponentialVariateSeconds =
- boost::posix_time::hours (lExponentialVariateHours);
-
- // Add an event
- lEventNumber++;
-
- // Add the inter-arrival time to the current time
- lCurrentTime += lExponentialVariateSeconds;
-
- // const double lPoissonVariate = generatePoissonVariate (lambda);
-
- // std::cout << lEventNumber << "; " << lCurrentTime << "; " << std::endl;
- }
- }
-
- // Cleaning of random generators
- finalise();
-
- // TODO: check that the average number of events corresponds to the given
- // input
-
- } catch (const std::exception& stde) {
- std::cerr << "Standard exception: " << stde.what() << std::endl;
-
- } catch (...) {
- std::cerr << "Unknown exception" << std::endl;
- }
-}
-
-// //////////////////////////////////////////////////////////////////////
-void SimulateTestSuite::testSimulate() {
- CPPUNIT_ASSERT_NO_THROW (testSimulateHelper(););
-}
-
-// //////////////////////////////////////////////////////////////////////
-// void SimulateTestSuite::errorCase () {
-// CPPUNIT_ASSERT (false);
-// }
-
-// //////////////////////////////////////////////////////////////////////
-SimulateTestSuite::SimulateTestSuite () {
- _describeKey << "Running test on RMOL Simulation function";
-}
-
-// /////////////// M A I N /////////////////
-CPPUNIT_MAIN()
Deleted: trunk/rmol/test/SimulateTestSuite.hpp
===================================================================
--- trunk/rmol/test/SimulateTestSuite.hpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/SimulateTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,25 +0,0 @@
-// STL
-#include <sstream>
-// CPPUNIT
-#include <cppunit/extensions/HelperMacros.h>
-
-class SimulateTestSuite : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE (SimulateTestSuite);
- CPPUNIT_TEST (testSimulate);
- // CPPUNIT_TEST (errorCase);
- CPPUNIT_TEST_SUITE_END ();
-public:
-
- /** Test the Simulation functionality. */
- void testSimulate ();
-
- /** Test some error detection functionalities. */
- // void errorCase ();
-
- /** Constructor. */
- SimulateTestSuite ();
-
-protected:
- std::stringstream _describeKey;
-};
-CPPUNIT_TEST_SUITE_REGISTRATION (SimulateTestSuite);
Deleted: trunk/rmol/test/UnconstrainerTestSuite.cpp
===================================================================
--- trunk/rmol/test/UnconstrainerTestSuite.cpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/UnconstrainerTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,112 +0,0 @@
-// STL
-#include <sstream>
-#include <iostream>
-#include <fstream>
-#include <string>
-// CPPUNIT
-#include <test/com/CppUnitCore.hpp>
-// RMOL
-#include <rmol/RMOL_Service.hpp>
-#include <rmol/RMOL_Types.hpp>
-#include <rmol/RMOL_UNCONSTRAINER_Types.hpp>
-#include <rmol/RMOL_UTILITY_Types.hpp>
-// RMOL Test Suite
-#include <test/UnconstrainerTestSuite.hpp>
-
-// //////////////////////////////////////////////////////////////////////
-int testUnconstrainerHelper (const unsigned short unconstrainingMethodFlag) {
- int passedTests = 0;
- try {
-
- // Output log File
- std::string lLogFilename ("UnconstrainerTestSuite.log");
-
- // Methods of unconstraining:
- // 0 = Unconstraining by Expectation Maximization
- const unsigned short METHOD_FLAG = unconstrainingMethodFlag;
-
- // Set the log parameters
- std::ofstream logOutputFile;
- // Open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
- std::ostringstream oDebugStr;
-
- // Initialise the RMOL service
- RMOL::RMOL_Service rmolService (logOutputFile);
-
- // A sample historical booking data to be processed by unconstrainer
- RMOL::ConstrainedDataHolder_T lConstrainedDataHolder;
- lConstrainedDataHolder.push_back(3);
- RMOL::UnconstrainedDataHolder_T lUnconstrainedDataHolder;
- lUnconstrainedDataHolder.push_back(4);
- lUnconstrainedDataHolder.push_back(3);
- lUnconstrainedDataHolder.push_back(7);
- lUnconstrainedDataHolder.push_back(5);
-
- // Sample price vector
- RMOL::StoppingCriterion_T lStoppingCriterion = 0.0001;
-
- switch (METHOD_FLAG) {
-
- case 0 : // Calculate expected unconstrained value of constrained data
- {
- rmolService.dataUnconstrainingByExpectationMaximization
- (lConstrainedDataHolder, lUnconstrainedDataHolder, lStoppingCriterion);
-
- // Verify if the test returned expected values
- oDebugStr << "Test Case 0: EM unconstraining method for a given example\n"
- << "Before the test, the flag is " << passedTests << "\n";
- if ( lConstrainedDataHolder.at(0) > 5.142 &&
- lConstrainedDataHolder.at(0) < 5.143) {
- passedTests = 1;
- }
- // for (unsigned int k = 0; k < lConstrainedDataHolder.size(); k++) {
- // std::vector<double> demandParametersOfAClass =
- // lForecastedDemandParameterList.at(k);
- // if (k == 1 && demandParametersOfAClass.at(0) == 10.8125) {passedTests = 1;};
- // }
- oDebugStr << "After the test, the flag is " << passedTests << "\n";
- break;
- }
- case 1 :
- {
- oDebugStr << "Test Case 1: "
- << "Before the test, the flag is " << passedTests << "\n";
- //
- oDebugStr << "After the test, the flag is " << passedTests << "\n";
- break;
- }
-
-
- default :
- {
- }
- }
- logOutputFile << oDebugStr.str() << "\n";
- logOutputFile.close();
-
- } catch (const std::exception& stde) {
- std::cerr << "Standard exception: " << stde.what() << std::endl;
-
- } catch (...) {
- std::cerr << "Unknown exception" << std::endl;
- }
-
- return passedTests;
-}
-
-// //////////////////////////////////////////////////////////////////////
-void UnconstrainerTestSuite::testUnconstrainingByEM() {
- const int lTestSuccessFlag = testUnconstrainerHelper(0);
- CPPUNIT_ASSERT (lTestSuccessFlag == 1);
-}
-
-// //////////////////////////////////////////////////////////////////////
-UnconstrainerTestSuite::UnconstrainerTestSuite () {
- _describeKey << "Running tests on RMOL data unconstraining methods";
-}
-
-// /////////////// M A I N /////////////////
-CPPUNIT_MAIN()
-
Deleted: trunk/rmol/test/UnconstrainerTestSuite.hpp
===================================================================
--- trunk/rmol/test/UnconstrainerTestSuite.hpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/UnconstrainerTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,22 +0,0 @@
-// STL
-#include <sstream>
-// CPPUNIT
-#include <cppunit/extensions/HelperMacros.h>
-
-class UnconstrainerTestSuite : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE (UnconstrainerTestSuite);
- CPPUNIT_TEST (testUnconstrainingByEM);
- CPPUNIT_TEST_SUITE_END ();
-public:
-
- /** Test data unconstraining by Expectation Maximization. */
- void testUnconstrainingByEM();
-
- /** Constructor. */
- UnconstrainerTestSuite ();
-
-protected:
- std::stringstream _describeKey;
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION (UnconstrainerTestSuite);
Deleted: trunk/rmol/test/bomsforforecaster.cpp
===================================================================
--- trunk/rmol/test/bomsforforecaster.cpp 2009-12-23 14:52:54 UTC (rev 277)
+++ trunk/rmol/test/bomsforforecaster.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -1,237 +0,0 @@
-// //////////////////////////////////////////////////////////////////////
-// Import section
-// //////////////////////////////////////////////////////////////////////
-// STL
-#include <cassert>
-#include <sstream>
-#include <fstream>
-#include <string>
-#include <limits>
-// #include <iostream>
-// RMOL
-#include <RMOL_Service.hpp>
-#include <rmol/service/Logger.hpp>
-
-namespace RMOL {
-
- /**-------------- BOM: Booking class/bucket data ----------------------- */
- struct BookingClassData {
-
- // Attributes
- double _bookingCount;
- double _fare;
- double _sellupFactor;
- bool _censorshipFlag;
-
- // Constructer
- BookingClassData (const double iBookingCount, const double iFare,
- const double iSellupFactor, const bool iCensorshipFlag)
- : _bookingCount(iBookingCount), _fare(iFare),
- _sellupFactor(iSellupFactor), _censorshipFlag(iCensorshipFlag) {
- }
-
- // Getters
- double getFare () const {
- return _fare;
- }
-
- bool getCensorshipFlag () const {
- return _censorshipFlag;
- }
-
- // Display
- std::string toString() const {
- std::ostringstream oStr;
- oStr << std::endl
- << "[Booking class data information]" << std::endl
- << "Booking counter: " << _bookingCount << std::endl
- << "Fare: " << _fare << std::endl
- << "Sell-up Factor: " << _sellupFactor << std::endl
- << "censorshipFlag: " << _censorshipFlag << std::endl;
- return oStr.str();
- }
-
- };
-
- /**-------------- BOM: Set of BookingClassData ----------------------- */
- struct BookingClassDataSet {
-
- typedef std::vector<BookingClassData*> BookingClassDataList_T;
-
- // Attributes
- int _numberOfClass;
- double _minimumFare;
- bool _censorshipFlag; // true if any of the classes is censored
- BookingClassDataList_T _bookingClassDataList;
-
- // Constructor
- BookingClassDataSet ()
- : _numberOfClass(0), _minimumFare(0),
- _censorshipFlag(false), _bookingClassDataList(NULL) {
- }
-
- // Add BookingClassData
- void addBookingClassData (BookingClassData& ioBookingClassData) {
- _bookingClassDataList.push_back (&ioBookingClassData);
- }
-
- // Getters
- unsigned int getNumberOfClass () const {
- return _bookingClassDataList.size();
- }
-
- double getMinimumFare () const {
- return _minimumFare;
- }
-
- bool getCensorshipFlag () const {
- return _censorshipFlag;
- }
-
- // Setters
- void setMinimumFare (const double iMinFare) {
- _minimumFare = iMinFare;
- }
-
- void setCensorshipFlag (const bool iCensorshipFlag) {
- _censorshipFlag = iCensorshipFlag;
- }
-
- // compute minimum fare
- void updateMinimumFare() {
- double minFare = std::numeric_limits<double>::max();
- BookingClassDataList_T::iterator itBookingClassDataList;
- for (itBookingClassDataList = _bookingClassDataList.begin();
- itBookingClassDataList != _bookingClassDataList.end();
- ++itBookingClassDataList) {
- BookingClassData* lBookingClassData = *itBookingClassDataList;
- assert (lBookingClassData != NULL);
-
- const double lFare = lBookingClassData->getFare();
- if (lFare < minFare) {
- minFare = lFare;
- }
- }
- //
- setMinimumFare(minFare);
- }
-
- // compute censorship flag for the data set
- void updateCensorshipFlag () {
- bool censorshipFlag = false;
- BookingClassDataList_T::iterator itBookingClassDataList;
- for (itBookingClassDataList = _bookingClassDataList.begin();
- itBookingClassDataList != _bookingClassDataList.end();
- ++itBookingClassDataList) {
- BookingClassData* lBookingClassData = *itBookingClassDataList;
- assert (lBookingClassData != NULL);
-
- const bool lCensorshipFlagOfAClass =
- lBookingClassData->getCensorshipFlag();
- if (lCensorshipFlagOfAClass) {
- censorshipFlag = true;
- break;
- }
- }
- //
- setCensorshipFlag(censorshipFlag);
- }
-
- // Display
- std::string toString() const {
- std::ostringstream oStr;
- oStr << std::endl
- << "[Booking class data set information]" << std::endl
- << "Number of classes: " << _numberOfClass << std::endl
- << "Minimum fare: " << _minimumFare << std::endl
- << "The data of the class set are sensored: " << _censorshipFlag
- << std::endl;
- return oStr.str();
- }
-
- };
-
- // /**-------------- BOM : Q-Forecaster ----------------------- */
- // struct QForecaster {
-
- // // Function focused BOM
-
- // // 1. calculate sell up probability for Q-eq
-
- // // 2. calculate Q-Equivalent Booking
- // double calculateQEqBooking (BookingClassDataSet& iBookingClassDataSet) {
- // double lQEqBooking = 0.0;
- // double lMinFare = iBookingClassDataSet.getMinimumFare();
-
-
- // return lQEqBooking;
- // }
-
- // /* Calculate Q-equivalent demand
- // [<- performed by unconstrainer if necessary (Using ExpMax BOM)]
- // */
-
-
- // // 3. Partition to each class
-
- // //
-
- // };
-
-}
-
-// ////////////// M A I N ///////////////
-int main (int argc, char* argv[]) {
-
- // Output log File
- std::string lLogFilename ("./bomsforforecaster.log");
- std::ofstream logOutputFile;
-
- // Open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
- RMOL::RMOL_Service lRmolService(logOutputFile);
-
- // Register BCDataSet
- RMOL::BookingClassDataSet lBookingClassDataSet;
-
- // Register BookingClassData
- RMOL::BookingClassData QClassData (10, 100, 1, false );
- RMOL::BookingClassData MClassData (5, 150, 0.8, true);
- RMOL::BookingClassData BClassData (0, 200, 0.6, false);
- RMOL::BookingClassData YClassData (0, 300, 0.3, false);
-
- // Display
- RMOL_LOG_DEBUG(QClassData.toString());
- RMOL_LOG_DEBUG(MClassData.toString());
- RMOL_LOG_DEBUG(BClassData.toString());
- RMOL_LOG_DEBUG(YClassData.toString());
-
- // Add BookingClassData into the BCDataSet
- lBookingClassDataSet.addBookingClassData (QClassData );
- lBookingClassDataSet.addBookingClassData( MClassData );
- lBookingClassDataSet.addBookingClassData( BClassData );
- lBookingClassDataSet.addBookingClassData( YClassData );
-
- //Display
- RMOL_LOG_DEBUG( lBookingClassDataSet.toString() );
-
- // Number of classes
- const unsigned int lNoOfClass = lBookingClassDataSet.getNumberOfClass();
- RMOL_LOG_DEBUG( "Number of Classes: " << lNoOfClass );
-
- // Minimum fare
- lBookingClassDataSet.updateMinimumFare();
- const double lMinFare = lBookingClassDataSet.getMinimumFare();
- RMOL_LOG_DEBUG( "Minimum fare: " << lMinFare );
-
- // Censorship flag
- lBookingClassDataSet.updateCensorshipFlag();
- const bool lCensorshipFlag = lBookingClassDataSet.getCensorshipFlag();
- RMOL_LOG_DEBUG( "Censorship Flag: " << lCensorshipFlag );
-
- // Close the log output file
- logOutputFile.close();
- return 0;
-
-}
Property changes on: trunk/rmol/test/rmol
___________________________________________________________________
Added: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
optimise
simulate
sim.gnumeric
OptimiseTestSuite
OptimiseTestSuite.log
OptimiseTestSuite_results.xml
SimulateTestSuite
SimulateTestSuite_results.xml
rmol.log
ForecasterTestSuite
ForecasterTestSuite.log
ForecasterTestSuite_results.xml
UnconstrainerTestSuite
UnconstrainerTestSuite.log
UnconstrainerTestSuite_results.xml
bomsforforecaster
bomsforforecaster.log
Copied: trunk/rmol/test/rmol/ForecasterTestSuite.cpp (from rev 277, trunk/rmol/test/ForecasterTestSuite.cpp)
===================================================================
--- trunk/rmol/test/rmol/ForecasterTestSuite.cpp (rev 0)
+++ trunk/rmol/test/rmol/ForecasterTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,158 @@
+// STL
+#include <sstream>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+#include <cmath>
+// CPPUNIT
+#include <test/com/CppUnitCore.hpp>
+// RMOL
+#include <rmol/RMOL_Service.hpp>
+#include <rmol/RMOL_Types.hpp>
+#include <rmol/RMOL_FORECASTER_Types.hpp>
+// RMOL Test Suite
+#include <test/rmol/ForecasterTestSuite.hpp>
+
+// //////////////////////////////////////////////////////////////////////
+int testForecasterHelper (const unsigned short forecastingMethodFlag) {
+ int passedTests = 0;
+ try {
+
+ // Output log File
+ std::string lLogFilename ("ForecasterTestSuite.log");
+
+ // Methods of forecasting (0 = Q-Forecasting)
+ const unsigned short METHOD_FLAG = forecastingMethodFlag;
+
+ // Set the log parameters
+ std::ofstream logOutputFile;
+ // Open and clean the log outputfile
+ logOutputFile.open (lLogFilename.c_str());
+ logOutputFile.clear();
+ std::ostringstream oDebugStr;
+
+ // Initialise the RMOL service
+ RMOL::RMOL_Service rmolService (logOutputFile);
+
+ // A sample historical demand data to be processed by forecaster
+ // Class | Q | M | B | Y |
+ // Price | 100 | 200 | 300 | 400 |
+ // Historical uncensored demand data at a DCP
+ // | 10 | 5 | 0 | 0 | <- 2008/01/01
+ // | 0 | 10 | 0 | 0 | <- 2008/01/08
+ // | 0 | 12 | 0 | 0 | <- 2008/01/15
+ // | 0 | 0 | 5 | 2 | <- 2008/01/22
+ // The order of the vectors: M, Q, Y, B
+
+ // Sample historical data vector
+ RMOL::HistoricalDataHolderHolder_T lHistoricalDataHolderHolder;
+ std::vector<double> azeroVector(3,0); // 3 copies of 0 element
+ std::vector<double> sampleHistoricalDataHolder;
+ // Historical data of M class
+ sampleHistoricalDataHolder.push_back(5);
+ sampleHistoricalDataHolder.push_back(10);
+ sampleHistoricalDataHolder.push_back(12);
+ sampleHistoricalDataHolder.push_back(0);
+ lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
+ // Historical data of Q class
+ sampleHistoricalDataHolder = azeroVector;
+ sampleHistoricalDataHolder.insert
+ (sampleHistoricalDataHolder.begin(), 1, 10);
+ lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
+ // Historical data of Y class
+ sampleHistoricalDataHolder = azeroVector;
+ sampleHistoricalDataHolder.insert
+ (sampleHistoricalDataHolder.end(), 1, 2);
+ lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
+ // Historical data of B class
+ sampleHistoricalDataHolder = azeroVector;
+ sampleHistoricalDataHolder.insert
+ (sampleHistoricalDataHolder.end(), 1, 5);
+ lHistoricalDataHolderHolder.push_back(sampleHistoricalDataHolder);
+
+ // Sample price vector
+ RMOL::PriceHolder_T lPriceVector;
+ lPriceVector.push_back(200);
+ lPriceVector.push_back(100);
+ lPriceVector.push_back(400);
+ lPriceVector.push_back(300);
+
+ // Sample Sellup Factor Vector
+ // that makes sell up probability of [Q,M,B,Y] = [1, 0.5, 0.4, 0.2]
+ RMOL::SellupFactorHolder_T lSellupFactorHolder;
+ lSellupFactorHolder.push_back(log(2));
+ lSellupFactorHolder.push_back(1);
+ lSellupFactorHolder.push_back(log(5)/3);
+ lSellupFactorHolder.push_back(log(2.5)/2);
+
+ // Forecaster output container
+ RMOL::ForecastedDemandParameterList_T lForecastedDemandParameterList;
+ switch (METHOD_FLAG) {
+
+ case 0 : // Calculate Q-equivalent demand
+ {
+ rmolService.demandForecastByQForecasting (lForecastedDemandParameterList,
+ lHistoricalDataHolderHolder,
+ lPriceVector,
+ lSellupFactorHolder);
+ // Verify the known mean is returned
+ oDebugStr << "Case 0: Tested Q-Forecasting algorithm for the given example\n"
+ << "Before the test, the flag is " << passedTests << "\n";
+ std::vector<double> demandParametersOfAClass =
+ lForecastedDemandParameterList.at(1);
+ if (demandParametersOfAClass.at(0) == 10.8125) {passedTests = 1;};
+ oDebugStr << "After the test, the flag is " << passedTests << "\n";
+ break;
+ }
+ case 1 :
+ {
+ oDebugStr << "Case 1: Tested "
+ << "Before the test, the flag is " << passedTests << "\n";
+ //
+ oDebugStr << "After the test, the flag is " << passedTests << "\n";
+ break;
+ }
+
+
+ default :
+ {
+ rmolService.demandForecastByQForecasting (lForecastedDemandParameterList,
+ lHistoricalDataHolderHolder,
+ lPriceVector,
+ lSellupFactorHolder);
+ oDebugStr << "Default case Tested Q-Forecasting algorithm for the given example\n"
+ << "Before the test, the flag is " << passedTests << "\n";
+ std::vector<double> demandParametersOfAClass =
+ lForecastedDemandParameterList.at(1);
+ if (demandParametersOfAClass.at(0) == 10.8125) {passedTests = 1;};
+ oDebugStr << "After the test, the flag is " << passedTests << "\n";
+ }
+ }
+ logOutputFile << oDebugStr.str() << "\n";
+ logOutputFile.close();
+
+ } catch (const std::exception& stde) {
+ std::cerr << "Standard exception: " << stde.what() << std::endl;
+
+ } catch (...) {
+ std::cerr << "Unknown exception" << std::endl;
+ }
+
+ return passedTests;
+}
+
+// //////////////////////////////////////////////////////////////////////
+void ForecasterTestSuite::testQForecaster() {
+ const int lTestSuccessFlag = testForecasterHelper(0);
+ CPPUNIT_ASSERT (lTestSuccessFlag == 1);
+}
+
+// //////////////////////////////////////////////////////////////////////
+ForecasterTestSuite::ForecasterTestSuite () {
+ _describeKey << "Running test on RMOL Forecast function";
+}
+
+// /////////////// M A I N /////////////////
+CPPUNIT_MAIN()
+
Copied: trunk/rmol/test/rmol/ForecasterTestSuite.hpp (from rev 277, trunk/rmol/test/ForecasterTestSuite.hpp)
===================================================================
--- trunk/rmol/test/rmol/ForecasterTestSuite.hpp (rev 0)
+++ trunk/rmol/test/rmol/ForecasterTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,22 @@
+// STL
+#include <sstream>
+// CPPUNIT
+#include <cppunit/extensions/HelperMacros.h>
+
+class ForecasterTestSuite : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE (ForecasterTestSuite);
+ CPPUNIT_TEST (testQForecaster);
+ CPPUNIT_TEST_SUITE_END ();
+public:
+
+ /** Test Q-forecaster. */
+ void testQForecaster();
+
+ /** Constructor. */
+ ForecasterTestSuite ();
+
+protected:
+ std::stringstream _describeKey;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ForecasterTestSuite);
Copied: trunk/rmol/test/rmol/Makefile.am (from rev 277, trunk/rmol/test/Makefile.am)
===================================================================
--- trunk/rmol/test/rmol/Makefile.am (rev 0)
+++ trunk/rmol/test/rmol/Makefile.am 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,54 @@
+## test sub-directory
+include $(top_srcdir)/Makefile.common
+
+MAINTAINERCLEANFILES = Makefile.in
+
+##
+SUBDIRS =
+
+EXTRA_DIST = testLib.sh
+##
+
+EXTRA_TESTS = bomsforforecaster
+
+STD_CHECKS = OptimiseTestSuite SimulateTestSuite \
+ ForecasterTestSuite UnconstrainerTestSuite
+check_PROGRAMS = $(STD_CHECKS) $(EXTRA_TESTS)
+TESTS = $(STD_CHECKS)
+XFAIL_TESTS = #OptimiseTestSuite
+
+OptimiseTestSuite_SOURCES = OptimiseTestSuite.hpp OptimiseTestSuite.cpp
+OptimiseTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
+OptimiseTestSuite_LDADD =
+OptimiseTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
+ $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/rmol/core/librmol.la
+
+SimulateTestSuite_SOURCES = SimulateTestSuite.hpp SimulateTestSuite.cpp
+SimulateTestSuite_CXXFLAGS = $(BOOST_CFLAGS) $(GSL_CFLAGS) $(CPPUNIT_CFLAGS)
+SimulateTestSuite_LDADD =
+SimulateTestSuite_LDFLAGS = $(BOOST_LIBS) $(GSL_LIBS) $(CPPUNIT_LIBS) \
+ $(top_builddir)/test/com/libcppunitcore.la
+
+ForecasterTestSuite_SOURCES = ForecasterTestSuite.hpp ForecasterTestSuite.cpp
+ForecasterTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
+ForecasterTestSuite_LDADD =
+ForecasterTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) \
+ $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/rmol/core/librmol.la
+
+UnconstrainerTestSuite_SOURCES = UnconstrainerTestSuite.hpp \
+ UnconstrainerTestSuite.cpp
+UnconstrainerTestSuite_CXXFLAGS= $(CPPUNIT_CFLAGS)
+UnconstrainerTestSuite_LDADD =
+UnconstrainerTestSuite_LDFLAGS = $(CPPUNIT_LIBS) \
+ $(top_builddir)/test/com/libcppunitcore.la \
+ $(top_builddir)/rmol/core/librmol.la
+
+bomsforforecaster_SOURCES = bomsforforecaster.cpp
+bomsforforecaster_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS)
+bomsforforecaster_LDADD =
+bomsforforecaster_LDFLAGS = $(BOOST_LIBS) \
+ $(top_builddir)/rmol/core/librmol.la \
+ $(top_builddir)/rmol/service/libsvc.la
+
Copied: trunk/rmol/test/rmol/OptimiseTestSuite.cpp (from rev 277, trunk/rmol/test/OptimiseTestSuite.cpp)
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.cpp (rev 0)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,203 @@
+// STL
+#include <fstream>
+#include <string>
+// CPPUNIT
+#include <test/com/CppUnitCore.hpp>
+// RMOL
+#include <rmol/RMOL_Service.hpp>
+#include <rmol/RMOL_Types.hpp>
+// RMOL Test Suite
+#include <test/rmol/OptimiseTestSuite.hpp>
+
+// //////////////////////////////////////////////////////////////////////
+int testOptimiseHelper (const unsigned short optimisationMethodFlag) {
+
+ // Return value
+ int oExpectedBookingLimit = 0;
+
+ try {
+
+ // Output log File
+ std::string lLogFilename ("OptimiseTestSuite.log");
+
+ // Number of random draws to be generated (best if greater than 100)
+ const int K = 100000;
+
+ // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming,
+ // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sellup prob.)
+ const unsigned short METHOD_FLAG = optimisationMethodFlag;
+
+ // Cabin Capacity (it must be greater then 100 here)
+ const double cabinCapacity = 100.0;
+
+ // Input file name
+ const std::string inputFileName ("sample2.csv");
+ const bool hasInputFile = true;
+
+ // Set the log parameters
+ std::ofstream logOutputFile;
+ // Open and clean the log outputfile
+ logOutputFile.open (lLogFilename.c_str());
+ logOutputFile.clear();
+
+ // Initialise the RMOL service
+ RMOL::RMOL_Service rmolService (logOutputFile, cabinCapacity);
+
+ // Define bid price and booking Limit vectors
+ RMOL::BidPriceVector_T lBidPriceVector;
+ RMOL::ProtectionLevelVector_T lProtectionLevelVector;
+ RMOL::BookingLimitVector_T lBookingLimitVector;
+
+ if (hasInputFile) {
+ // Read the input file
+ rmolService.readFromInputFile (inputFileName);
+
+ } else {
+ // No input file has been provided. So, process a sample.
+
+ // STEP 0.
+ // List of demand distribution parameters (mean and standard deviation)
+
+ // Class/bucket 1: N (20, 9), p1 = 100
+ rmolService.addBucket (100.0, 20, 9);
+
+ // Class/bucket 2: N (45, 12), p2 = 70
+ rmolService.addBucket (70.0, 45, 12);
+
+ // Class/bucket 3: no need to define a demand distribution, p3 = 42
+ rmolService.addBucket (42.0, 0, 0);
+ }
+
+ switch (METHOD_FLAG) {
+
+ case 0 : // Calculate the optimal protections by the Monte Carlo
+ // Integration approach
+ {
+ rmolService.optimalOptimisationByMCIntegration (K);
+ break;
+ }
+ case 1 : // Calculate the optimal protections by DP.
+ {
+ rmolService.optimalOptimisationByDP ();
+ break;
+ }
+ case 2 : // Calculate the Bid-Price Vector by EMSR
+ {
+ rmolService.heuristicOptimisationByEmsr ();
+ break;
+ }
+ case 3 : // Calculate the protections by EMSR-a
+ {
+ // Test the EMSR-a algorithm implementation
+ rmolService.heuristicOptimisationByEmsrA (lBidPriceVector,
+ lProtectionLevelVector,
+ lBookingLimitVector);
+
+ // Return a cumulated booking limit value to test
+ oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
+ break;
+ }
+ case 4 : // Calculate the protections by EMSR-b
+ {
+ rmolService.heuristicOptimisationByEmsrB ();
+ break;
+ }
+ case 5 : // Calculate the protection by EMSR-a with sellup
+ {
+ // Create an empty sell-up probability vector
+ std::vector<double> sellupProbabilityVector;
+
+ // Define the sell-up probability to be 20%
+ const double sampleProbability = 0.2;
+
+ // NOTE: size of sellup vector should be equal to no of buckets - 1
+ // TODO: check that with an assertion
+ const short nbOfSampleBucket = 4;
+ for (short i = 1; i <= nbOfSampleBucket - 1; i++) {
+ sellupProbabilityVector.push_back (sampleProbability);
+ }
+
+ // Test the algorithm with the sample sell-up vector
+ rmolService.heuristicOptimisationByEmsrAwithSellup
+ (sellupProbabilityVector, lProtectionLevelVector,
+ lBidPriceVector, lBookingLimitVector);
+
+ // Return a cumulated booking limit value to test
+ oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2));
+
+ break;
+ }
+
+ default : rmolService.optimalOptimisationByMCIntegration (K);
+ }
+
+ } catch (const std::exception& stde) {
+ std::cerr << "Standard exception: " << stde.what() << std::endl;
+
+ } catch (...) {
+ std::cerr << "Unknown exception" << std::endl;
+ }
+
+ return oExpectedBookingLimit;
+}
+
+
+// //////////////////////////////////////////////////////////////////////
+// Test is based on the following inputs values
+// price; mean; standard deviation;
+// 1050; 17.3; 5.8;
+// 567; 45.1; 15.0;
+// 534; 39.6; 13.2;
+// 520; 34.0; 11.3;
+// //////////////////////////////////////////////////////////////////////
+
+// Monte-Carlo (MC)
+void OptimiseTestSuite::testOptimiseMC() {
+ CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(0););
+}
+
+// //////////////////////////////////////////////////////////////////////
+// Dynamic Programming (DP)
+void OptimiseTestSuite::testOptimiseDP() {
+ CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(1););
+}
+
+// //////////////////////////////////////////////////////////////////////
+// EMSR
+void OptimiseTestSuite::testOptimiseEMSR() {
+ CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(2););
+}
+
+// //////////////////////////////////////////////////////////////////////
+// EMSR-a
+void OptimiseTestSuite::testOptimiseEMSRa() {
+ const int lExpectedBookingLimit = testOptimiseHelper(3);
+ CPPUNIT_ASSERT(lExpectedBookingLimit == 61);
+}
+
+// //////////////////////////////////////////////////////////////////////
+// EMSR-b
+void OptimiseTestSuite::testOptimiseEMSRb() {
+ CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(4););
+}
+
+// //////////////////////////////////////////////////////////////////////
+// EMSR-a with sell-up
+void OptimiseTestSuite::testOptimiseEMSRaWithSU() {
+ const int lExpectedBookingLimit = testOptimiseHelper(5);
+ CPPUNIT_ASSERT(lExpectedBookingLimit == 59);
+}
+
+// //////////////////////////////////////////////////////////////////////
+// void OptimiseTestSuite::errorCase () {
+// CPPUNIT_ASSERT (false);
+// }
+
+// //////////////////////////////////////////////////////////////////////
+OptimiseTestSuite::OptimiseTestSuite () {
+ _describeKey << "Running test on RMOL Optimisation function";
+}
+
+// /////////////// M A I N /////////////////
+CPPUNIT_MAIN()
+
Copied: trunk/rmol/test/rmol/OptimiseTestSuite.hpp (from rev 277, trunk/rmol/test/OptimiseTestSuite.hpp)
===================================================================
--- trunk/rmol/test/rmol/OptimiseTestSuite.hpp (rev 0)
+++ trunk/rmol/test/rmol/OptimiseTestSuite.hpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,50 @@
+// STL
+#include <sstream>
+// CPPUNIT
+#include <cppunit/extensions/HelperMacros.h>
+
+class OptimiseTestSuite : public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE (OptimiseTestSuite);
+ CPPUNIT_TEST (testOptimiseMC);
+ CPPUNIT_TEST (testOptimiseDP);
+ CPPUNIT_TEST (testOptimiseEMSR);
+ CPPUNIT_TEST (testOptimiseEMSRa);
+ CPPUNIT_TEST (testOptimiseEMSRb);
+ CPPUNIT_TEST (testOptimiseEMSRaWithSU);
+ // CPPUNIT_TEST (errorCase);
+ CPPUNIT_TEST_SUITE_END ();
+public:
+
+ /** Test the Monte-Carlo (MC) Optimisation functionality. */
+ void testOptimiseMC();
+
+ /** Test the Dynamic Programming (DP) Optimisation functionality. */
+ void testOptimiseDP();
+
+ /** Test the Expected Marginal Seat Revenue (EMSR) Optimisation
+ functionality. */
+ void testOptimiseEMSR();
+
+ /** Test the Expected Marginal Seat Revenue, variant a (EMSR-a),
+ Optimisation functionality. */
+ void testOptimiseEMSRa();
+
+ /** Test the Expected Marginal Seat Revenue, variant b (EMSR-b),
+ Optimisation functionality. */
+ void testOptimiseEMSRb();
+
+ /** Test the Expected Marginal Seat Revenue, variant a (EMSR-a) with
+ sell-up (fare/yield adjustment), Optimisation functionality. */
+ void testOptimiseEMSRaWithSU();
+
+ /** Test some error detection functionalities. */
+ // void errorCase ();
+
+ /** Constructor. */
+ OptimiseTestSuite ();
+
+protected:
+ std::stringstream _describeKey;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION (OptimiseTestSuite);
Copied: trunk/rmol/test/rmol/SimulateTestSuite.cpp (from rev 277, trunk/rmol/test/SimulateTestSuite.cpp)
===================================================================
--- trunk/rmol/test/rmol/SimulateTestSuite.cpp (rev 0)
+++ trunk/rmol/test/rmol/SimulateTestSuite.cpp 2009-12-28 14:24:38 UTC (rev 278)
@@ -0,0 +1,138 @@
+// STL
+#include <iostream>
+#include <sstream>
+// Boost (Extended STL)
+#include <boost/date_time/posix_time/posix_time.hpp>
+// GSL Random Number Generation (GSL Reference Manual, version 1.7, Chapter 17)
+#include <gsl/gsl_rng.h>
+// GSL Random Number Distributions (GSL Reference Manual, version 1.7,
+// Chapter 19)
+#include <gsl/gsl_randist.h>
+// CPPUNIT
+#include <test/com/CppUnitCore.hpp>
+// RMOL Test Suite
+#include <test/rmol/SimulateTestSuite.hpp>
+
+// Random Generator Type
+const gsl_rng_type* _rngTypePtr = NULL;
+
+// Random Generator
+gsl_rng* _rngExponentialPtr = NULL;
+gsl_rng* _rngPoissonPtr = NULL;
+
+// ///////////////////////////////////////////////////
+void init () {
+ // Random Generator type
+ _rngTypePtr = gsl_rng_default;
+
+ // Initialise the Random Generator
+ gsl_rng_env_setup ();
+
+ // Allocate the memory for the random generator
+ _rngExponentialPtr = gsl_rng_alloc (_rngTypePtr);
+ _rngPoissonPtr = gsl_rng_alloc (_rngTypePtr);
+}
+
+// ///////////////////////////////////////////////////
+double generateExponentialVariate (const double iLambda) {
+ const double lMu = 1/iLambda;
+ double result = gsl_ran_exponential (_rngExponentialPtr, lMu);
+ return result;
+}
+
+// ///////////////////////////////////////////////////
+double generatePoissonVariate (const double iMu) {
+ double result = gsl_ran_poisson (_rngPoissonPtr, iMu);
+ return result;
+}
+
+// ///////////////////////////////////////////////////
+void finalise () {
+ gsl_rng_free (_rngExponentialPtr);
+ gsl_rng_free (_rngPoissonPtr);
+}
+
+// //////////////////////////////////////////////////////////////////////
+void testSimulateHelper() {
+ try {
+
+ // Output log File
+ std::string lLogFilename ("SimulateTestSuite.log");
+
+ // Time duration representing a full day
+ // (i.e., 24h or 1,440 minutes or 86,400 seconds)
+ const boost::posix_time::time_duration kDay (24, 0, 0, 0);
+
+ // Length of the Simulation (time-length)
+ const int kSimulationLength = 365;
+
+ // Rate, expressed as a number of events per day
+ // (lambda => mu = 1/ lambda)
+ const double lambda = 10.0;
+ // mu = 0.1 (= 2.4h, i.e., in average, an event occurs every 2.4h)
+
+ // Initialisation of random generators
+ init();
+
+ // Generate k draws
+ // std::cout << "Event#; Time; " << std::endl;
+ for (int i=1; i != kSimulationLength; i++) {
+
+ // Current time
+ boost::posix_time::time_duration lCurrentTime (0, 0, 0, 0);
+
+ // Current number of events
+ int lEventNumber = 0;
+
+ ...
[truncated message content] |
|
From: <den...@us...> - 2009-12-23 14:53:06
|
Revision: 277
http://rmol.svn.sourceforge.net/rmol/?rev=277&view=rev
Author: denis_arnaud
Date: 2009-12-23 14:52:54 +0000 (Wed, 23 Dec 2009)
Log Message:
-----------
[Build] Explicitly set the package name to 'rmol', in order to allow embedded building of the rmol library.
Modified Paths:
--------------
trunk/rmol/rmol/batches/Makefile.am
trunk/rmol/rmol/config/Makefile.am
trunk/rmol/rmol/core/Makefile.am
Modified: trunk/rmol/rmol/batches/Makefile.am
===================================================================
--- trunk/rmol/rmol/batches/Makefile.am 2009-10-09 09:30:33 UTC (rev 276)
+++ trunk/rmol/rmol/batches/Makefile.am 2009-12-23 14:52:54 UTC (rev 277)
@@ -13,4 +13,4 @@
rmol_CXXFLAGS = $(BOOST_CFLAGS)
#rmol_LDADD =
rmol_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) \
- $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la
+ $(top_builddir)/rmol/core/librmol.la
Modified: trunk/rmol/rmol/config/Makefile.am
===================================================================
--- trunk/rmol/rmol/config/Makefile.am 2009-10-09 09:30:33 UTC (rev 276)
+++ trunk/rmol/rmol/config/Makefile.am 2009-12-23 14:52:54 UTC (rev 277)
@@ -1,3 +1,4 @@
+# rmol/config
include $(top_srcdir)/Makefile.common
## Source directory
@@ -2,16 +3,16 @@
-DISTCLEANFILES = @PA...@-p...
+DISTCLEANFILES = rmol-paths.hpp
MAINTAINERCLEANFILES = Makefile.in
-EXTRA_DIST = @PA...@-p...
+EXTRA_DIST = rmol-paths.hpp
# Targets
-all-local: @PA...@-p...
+all-local: rmol-paths.hpp
-@PA...@-p...: Makefile
- @echo '#ifndef __@PACKAGE_NAME@_PATHS_HPP' > $@
- @echo '#define __@PACKAGE_NAME@_PATHS_HPP' >> $@
- @echo '#define PACKAGE "@PACKAGE@"' >> $@
- @echo '#define PACKAGE_NAME "@PACKAGE_NAME@"' >> $@
+rmol-paths.hpp: Makefile
+ @echo '#ifndef __RMOL_PATHS_HPP' > $@
+ @echo '#define __RMOL_PATHS_HPP' >> $@
+ @echo '#define PACKAGE "rmol"' >> $@
+ @echo '#define PACKAGE_NAME "RMOL"' >> $@
@echo '#define PACKAGE_VERSION "@VERSION@"' >> $@
@@ -22,4 +23,4 @@
@echo '#define LIBEXECDIR "$(libexecdir)"' >> $@
@echo '#define DATADIR "$(datadir)"' >> $@
@echo '#define DOCDIR "$(docdir)"' >> $@
- @echo '#endif // __@PACKAGE_NAME@_PATHS_HPP' >> $@
+ @echo '#endif // __RMOL_PATHS_HPP' >> $@
Modified: trunk/rmol/rmol/core/Makefile.am
===================================================================
--- trunk/rmol/rmol/core/Makefile.am 2009-10-09 09:30:33 UTC (rev 276)
+++ trunk/rmol/rmol/core/Makefile.am 2009-12-23 14:52:54 UTC (rev 277)
@@ -9,16 +9,16 @@
# Library
-lib_LTLIBRARIES = lib@PACKAGE@.la
+lib_LTLIBRARIES = librmol.la
-lib@PACKAGE@_la_SOURCES = $(service_h_sources) $(service_cc_sources)
-lib@PACKAGE@_la_LIBADD = \
- $(top_builddir)/@PACKAGE@/basic/libbas.la \
- $(top_builddir)/@PACKAGE@/field/libfld.la \
- $(top_builddir)/@PACKAGE@/bom/libbom.la \
- $(top_builddir)/@PACKAGE@/factory/libfac.la \
- $(top_builddir)/@PACKAGE@/command/libcmd.la \
- $(top_builddir)/@PACKAGE@/service/libsvc.la
-lib@PACKAGE@_la_LDFLAGS = \
+librmol_la_SOURCES = $(service_h_sources) $(service_cc_sources)
+librmol_la_LIBADD = \
+ $(top_builddir)/rmol/basic/libbas.la \
+ $(top_builddir)/rmol/field/libfld.la \
+ $(top_builddir)/rmol/bom/libbom.la \
+ $(top_builddir)/rmol/factory/libfac.la \
+ $(top_builddir)/rmol/command/libcmd.la \
+ $(top_builddir)/rmol/service/libsvc.la
+librmol_la_LDFLAGS = \
$(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \
$(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2009-10-09 09:30:39
|
Revision: 276
http://rmol.svn.sourceforge.net/rmol/?rev=276&view=rev
Author: denis_arnaud
Date: 2009-10-09 09:30:33 +0000 (Fri, 09 Oct 2009)
Log Message:
-----------
[Dev] Added BOM SegmentDate object. Note that it is not activated yet, as stdair needs first to be completed.
Modified Paths:
--------------
trunk/rmol/rmol/bom/SegmentDate.cpp
trunk/rmol/rmol/bom/SegmentDate.hpp
Modified: trunk/rmol/rmol/bom/SegmentDate.cpp
===================================================================
--- trunk/rmol/rmol/bom/SegmentDate.cpp 2009-10-09 09:27:14 UTC (rev 275)
+++ trunk/rmol/rmol/bom/SegmentDate.cpp 2009-10-09 09:30:33 UTC (rev 276)
@@ -10,38 +10,11 @@
// //////////////////////////////////////////////////////////////////////
void SegmentDate::updateCensorshipFlag () {
-
- // //////////// BEGIN: TO BE COPIED AND REMOVED WHEN STDAIR IS READY ///////
- bool censorshipFlag = false;
-
- /*
- const BookingClassDateList_T& lBookingClassDateList =
- ioSegmentDate.getBookingClassList();
- for (BookingClassDateList_T::const_iterator itBookingClassDateList =
- lBookingClassDateList.begin();
- itBookingClassDateList != lBookingClassDateList.end();
- ++itBookingClassDateList) {
- BookingClassDate* lBookingClassDate = *itBookingClassDateList;
- assert (lBookingClassDate != NULL);
-
- const bool lCensorshipFlagOfAClass= lBookingClassDate->getCensorshipFlag();
- if (lCensorshipFlagOfAClass == true) {
- censorshipFlag = true;
- break;
- }
- }
- */
-
- // Store the result within the object
- setCensorshipFlag (censorshipFlag);
- // //////////// END: TO BE COPIED AND REMOVED WHEN STDAIR IS READY ///////
-
- // updateCensorshipFlag (*self);
+ updateCensorshipFlag (*self);
}
// //////////////////////////////////////////////////////////////////////
- /*
- void SegmentDate::updateCensorshipFlag (stdair::SegmentDate& ioSegmentDate) {
+ void SegmentDate::updateCensorshipFlag (SegmentDate& ioSegmentDate) {
bool censorshipFlag = false;
const BookingClassDateList_T& lBookingClassDateList =
@@ -50,7 +23,7 @@
lBookingClassDateList.begin();
itBookingClassDateList != lBookingClassDateList.end();
++itBookingClassDateList) {
- stdair::BookingClassDate& lBookingClassDate = *itBookingClassDateList;
+ BookingClassDate& lBookingClassDate = *itBookingClassDateList;
const bool lCensorshipFlagOfAClass= lBookingClassDate.getCensorshipFlag();
if (lCensorshipFlagOfAClass == true) {
@@ -62,6 +35,5 @@
// Store the result within the object
ioSegmentDate.setCensorshipFlag (censorshipFlag);
}
- */
}
Modified: trunk/rmol/rmol/bom/SegmentDate.hpp
===================================================================
--- trunk/rmol/rmol/bom/SegmentDate.hpp 2009-10-09 09:27:14 UTC (rev 275)
+++ trunk/rmol/rmol/bom/SegmentDate.hpp 2009-10-09 09:30:33 UTC (rev 276)
@@ -10,8 +10,9 @@
namespace RMOL {
/** Class modelling an airline-related SegmentDate. */
- class SegmentDate
- //: public stdair::SegmentDate {
+ class SegmentDate
+ //: public stdair::SegmentDate
+ {
public:
/** Compute and update the censorship flag for all the booking classes
@@ -20,7 +21,8 @@
/** Same method, but on an object provided by a third party (e.g.,
an external library). */
- // static void updateCensorshipFlag (stdair::SegmentDate& ioSegmentDate);
+ // WHEN STDAIR IS ENABLED, PLEASE ADD stdair:: to BOM types
+ static void updateCensorshipFlag (SegmentDate& ioSegmentDate);
private:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|