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...> - 2009-06-05 19:17:26
|
Revision: 225 http://rmol.svn.sourceforge.net/rmol/?rev=225&view=rev Author: denis_arnaud Date: 2009-06-05 19:17:18 +0000 (Fri, 05 Jun 2009) Log Message: ----------- [Release] New working version. Modified Paths: -------------- trunk/rmol/configure.ac Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-06-05 19:15:58 UTC (rev 224) +++ trunk/rmol/configure.ac 2009-06-05 19:17:18 UTC (rev 225) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2009 Denis Arnaud <den...@us...>]) -AC_INIT([RMOL],[0.22.0],[den...@us...],[rmol]) +AC_INIT([RMOL],[0.23.0],[den...@us...],[rmol]) AC_CONFIG_HEADER([rmol/config.h]) AC_CONFIG_SRCDIR([rmol/basic/BasConst.cpp]) AC_CONFIG_AUX_DIR([config]) @@ -15,7 +15,7 @@ AC_SUBST(RPM_RELEASE) # Shared library versioning -GENERIC_LIBRARY_VERSION="0:22:0" +GENERIC_LIBRARY_VERSION="0:23:0" # | | | # +------+ | +---+ # | | | This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-06-05 19:16:03
|
Revision: 224 http://rmol.svn.sourceforge.net/rmol/?rev=224&view=rev Author: denis_arnaud Date: 2009-06-05 19:15:58 +0000 (Fri, 05 Jun 2009) Log Message: ----------- [Realease 0.22.0] Modified Paths: -------------- trunk/rmol/ChangeLog Modified: trunk/rmol/ChangeLog =================================================================== --- trunk/rmol/ChangeLog 2009-06-04 07:41:35 UTC (rev 223) +++ trunk/rmol/ChangeLog 2009-06-05 19:15:58 UTC (rev 224) @@ -1,12 +1,3 @@ -0.3.0: - -2002-12-03 Murray Cumming <mu...@us...> +* Fri Jun 5 2009 Anh Quan Nguyen <qua...@us...> 0.22.0 +- Iterative DAVN implementation. - * Renamed configure.in to configure.ac - * Added autogen.sh, for convenience. - * configure.ac: Changed AC_PROG_RANLIB to AC_PROG_LIBTOOL - -Murray Cumming <mu...@us...> 27th April 2000 -* Version 0.2 -* Changed name in AM_INIT_AUTOMAKE in configure.in to helloworld_cc from hello. -* Checked with latest gcc (Redhat 6.2 + gcc 2.95): No need for 'automake -i' anymore. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <qua...@us...> - 2009-06-04 07:41:40
|
Revision: 223 http://rmol.svn.sourceforge.net/rmol/?rev=223&view=rev Author: quannaus Date: 2009-06-04 07:41:35 +0000 (Thu, 04 Jun 2009) Log Message: ----------- Added method for Iterative DAVN use. Moved to version 0.21.0. Modified Paths: -------------- trunk/rmol/rmol/RMOL_Service.hpp trunk/rmol/rmol/RMOL_Types.hpp trunk/rmol/rmol/basic/BasConst.cpp trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp trunk/rmol/rmol/batches/rmol.cpp trunk/rmol/rmol/bom/Bucket.cpp trunk/rmol/rmol/bom/Bucket.hpp trunk/rmol/rmol/bom/BucketList.hpp trunk/rmol/rmol/bom/EmsrUtils.hpp trunk/rmol/rmol/bom/MCOptimiser.cpp trunk/rmol/rmol/bom/MCOptimiser.hpp trunk/rmol/rmol/command/Optimiser.cpp trunk/rmol/rmol/command/Optimiser.hpp trunk/rmol/rmol/field/FldYieldRange.cpp trunk/rmol/rmol/service/RMOL_Service.cpp trunk/rmol/rmol/service/RMOL_ServiceContext.cpp trunk/rmol/rmol/service/RMOL_ServiceContext.hpp Property Changed: ---------------- trunk/rmol/ trunk/rmol/rmol/batches/ Property changes on: trunk/rmol ___________________________________________________________________ Modified: svn:ignore - autom4te.cache INSTALL Makefile Makefile.in aclocal.m4 config.log config.status configure libtool rmol-config rmol-doc-0.*.0.tar.bz2 rmol-doc-0.*.0.tar.gz rmol.pc rmol.m4 rmol.spec config.guess config.h config.h.in config.sub configure.log rmol-0.*.0.tar.bz2 rmol-0.*.0.tar.gz stamp-h1 mytest + autom4te.cache INSTALL Makefile Makefile.in aclocal.m4 config.log config.status configure libtool rmol-config rmol-doc-0.*.0.tar.bz2 rmol-doc-0.*.0.tar.gz rmol.pc rmol.m4 rmol.spec config.guess config.h config.h.in config.sub configure.log rmol-0.*.0.tar.bz2 rmol-0.*.0.tar.gz stamp-h1 autogen-quan.sh Modified: trunk/rmol/rmol/RMOL_Service.hpp =================================================================== --- trunk/rmol/rmol/RMOL_Service.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/RMOL_Service.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -26,13 +26,37 @@ /** 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 (); + /** Single resource optimization using the Monte Carlo algorithm. */ void optimalOptimisationByMCIntegration (const int K); @@ -79,6 +103,14 @@ returns a vector of cumulated booking limits. */ void heuristicOptimisationByEmsrB (BidPriceVector_T&, BookingLimitVector_T&); + /** Leg optimisation using Monte-Carlo Integration as a step in + network optimisation. */ + void legOptimisationByMC (); + + /** Leg optimisation using Monte-Carlo Integration as a step in + network optimisation. */ + void legOptimisationByMC (BidPriceVector_T&, BookingLimitVector_T&); + private: /** Default Constructors. */ RMOL_Service (); Modified: trunk/rmol/rmol/RMOL_Types.hpp =================================================================== --- trunk/rmol/rmol/RMOL_Types.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/RMOL_Types.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -64,6 +64,13 @@ <br> It is a vector of double. */ typedef std::vector<double> BookingLimitVector_T; + /** Define the vector of generated demand (for MC integration use). + <br> It is a vector of double. */ + typedef std::vector<double> GeneratedDemandVector_T; + + /** Define the holder of the generated demand vectors. */ + typedef std::vector<GeneratedDemandVector_T> GeneratedDemandVectorHolder_T; + /** Define the sellup probability vector applicable to EMSR*/ typedef std::vector<double> SellupProbabilityVector_T; } Modified: trunk/rmol/rmol/basic/BasConst.cpp =================================================================== --- trunk/rmol/rmol/basic/BasConst.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/basic/BasConst.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -38,4 +38,10 @@ calculation. */ const double DEFAULT_OVERBOOKING_STANDARD_DEVIATION = 1.0; + /** Default generated demand vector. */ + const GeneratedDemandVector_T DEFAULT_GENERATED_DEMAND_VECTOR = std::vector<double>(); + + /** Default generated demand vector holder. */ + const GeneratedDemandVectorHolder_T DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER = std::vector<GeneratedDemandVector_T>(); + } Modified: trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp =================================================================== --- trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/basic/BasConst_RMOL_Service.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -4,11 +4,21 @@ // ////////////////////////////////////////////////////////////////////// // Import section // ////////////////////////////////////////////////////////////////////// +// STL +#include <vector> +// RMOL +#include <rmol/RMOL_Types.hpp> namespace RMOL { /** Default capacity for the RMOL_Service. */ extern const double DEFAULT_RMOL_SERVICE_CAPACITY; + + /** Default generated demand vector. */ + extern const GeneratedDemandVector_T DEFAULT_GENERATED_DEMAND_VECTOR; + + /** Default generated demand vector holder. */ + extern const GeneratedDemandVectorHolder_T DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER; } #endif // __RMOL_BAS_BASCONST_RMOL_SERVICE_HPP Property changes on: trunk/rmol/rmol/batches ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile.in Makefile rmol rmol.log + .deps .libs Makefile.in Makefile rmol *.log Modified: trunk/rmol/rmol/batches/rmol.cpp =================================================================== --- trunk/rmol/rmol/batches/rmol.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/batches/rmol.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -280,6 +280,13 @@ (lSellupProbabilityVector); break; } + case 6: { + // Calculate the optimal protections by the Monte Carlo + // Integration approach + rmolService.buildContextForMC (lRandomDraws); + rmolService.legOptimisationByMC (); + break; + } default: { rmolService.optimalOptimisationByMCIntegration (lRandomDraws); } Modified: trunk/rmol/rmol/bom/Bucket.cpp =================================================================== --- trunk/rmol/rmol/bom/Bucket.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/Bucket.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -16,7 +16,8 @@ Bucket::Bucket () : _demand (NULL), _yieldRange (), _protection (0.0), _cumulatedProtection (0.0), - _bookingLimit (0.0), _cumulatedBookingLimit (0.0) { + _bookingLimit (0.0), _cumulatedBookingLimit (0.0), + _generatedDemandVector (NULL) { } // ////////////////////////////////////////////////////////////////////// @@ -26,14 +27,16 @@ _protection (iBucket.getProtection()), _cumulatedProtection (iBucket.getCumulatedProtection()), _bookingLimit (iBucket.getBookingLimit()), - _cumulatedBookingLimit (iBucket.getCumulatedBookingLimit()) { + _cumulatedBookingLimit (iBucket.getCumulatedBookingLimit()), + _generatedDemandVector (NULL) { } // ////////////////////////////////////////////////////////////////////// Bucket::Bucket (const FldYieldRange& iYieldRange) : _demand (NULL), _yieldRange (iYieldRange), _protection (0.0), _cumulatedProtection (0.0), - _bookingLimit (0.0), _cumulatedBookingLimit (0.0) { + _bookingLimit (0.0), _cumulatedBookingLimit (0.0), + _generatedDemandVector (NULL) { } // ////////////////////////////////////////////////////////////////////// @@ -164,4 +167,10 @@ return _yieldRange.getLowerYield(); } + // ////////////////////////////////////////////////////////////////////// + void Bucket:: + setGeneratedDemandVector (GeneratedDemandVector_T* iVector) { + _generatedDemandVector = iVector; + } + } Modified: trunk/rmol/rmol/bom/Bucket.hpp =================================================================== --- trunk/rmol/rmol/bom/Bucket.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/Bucket.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -5,6 +5,7 @@ // Import section // ////////////////////////////////////////////////////////////////////// // RMOL +#include <rmol/RMOL_Types.hpp> #include <rmol/field/FldYieldRange.hpp> #include <rmol/field/FldDistributionParameters.hpp> #include <rmol/bom/BomAbstract.hpp> @@ -92,7 +93,12 @@ /** Getter for the lower yield. */ const double getLowerYield() const; + /** Getter for the genrated demand vector. */ + const GeneratedDemandVector_T& getGeneratedDemandVector () const { + return *_generatedDemandVector; + } + // ///////// Setters //////// /** Setter for the protection. */ void setProtection (const double iProtection) { @@ -123,6 +129,9 @@ /** Set the demand mean and standard deviation. */ void setDemandParameters (const double, const double); + /** Set the generated demand vector. */ + void setGeneratedDemandVector (GeneratedDemandVector_T*); + public: // ///////// Display methods //////// /** Dump a Business Object into an output stream. @@ -181,6 +190,9 @@ /** Cumulated Booking limit. */ double _cumulatedBookingLimit; + + /** Generated demand vector. */ + GeneratedDemandVector_T* _generatedDemandVector; }; } #endif // __RMOL_BOM_BUCKET_HPP Modified: trunk/rmol/rmol/bom/BucketList.hpp =================================================================== --- trunk/rmol/rmol/bom/BucketList.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/BucketList.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -14,6 +14,5 @@ /** Define a vector (ordered list) of N buckets/classes. */ typedef std::list<Bucket*> BucketList_T; - } #endif // __RMOL_BUCKETLIST_HPP Modified: trunk/rmol/rmol/bom/EmsrUtils.hpp =================================================================== --- trunk/rmol/rmol/bom/EmsrUtils.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/EmsrUtils.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -27,4 +27,4 @@ static const double computeEmsrValue (double, Bucket&); }; } -#endif //__RMOL_EMSRUTILS_HPP +#endif // __RMOL_EMSRUTILS_HPP Modified: trunk/rmol/rmol/bom/MCOptimiser.cpp =================================================================== --- trunk/rmol/rmol/bom/MCOptimiser.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/MCOptimiser.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -293,6 +293,9 @@ const int cabinCapacityInt = static_cast<int> (iCabinCapacity); for (short j = 1 ; j <= nbOfClasses - 1; ++j, ioBucketHolder.iterate(), ioPSHolderHolder.iterate()) { + // DEBUG + std::cout << "K" << j << " = " << Kj << std::endl; + /** Retrieve Bucket(j) (current) and Bucket(j+1) (next). */ Bucket& currentBucket = ioBucketHolder.getCurrentBucket(); Bucket& nextBucket = ioBucketHolder.getNextBucket(); @@ -375,6 +378,9 @@ */ const double ljdouble = std::floor (Kj * (pj - pj1) / pj); lj = static_cast<int> (ljdouble); + + // DEBUG + std::cout << "l" << j << " = " << lj << std::endl; /** DEBUG RMOL_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj @@ -501,4 +507,105 @@ ioBucketHolder.recalculate (); } + // //////////////////////////////////////////////////////////////////////// + void MCOptimiser:: + legOptimisationByMC (const ResourceCapacity_T iCabinCapacity, + BucketHolder& ioBucketHolder, + BidPriceVector_T& ioBidPriceVector) { + + ioBucketHolder.begin(); + + // Get the first bucket (the one with the highest average yield). + Bucket& lFirstBucket = ioBucketHolder.getCurrentBucket(); + + GeneratedDemandVector_T lPartialSumVector = + lFirstBucket.getGeneratedDemandVector (); + + // Sort the vector from high to low. + std::sort (lPartialSumVector.begin(), lPartialSumVector.end(), + std::greater<double>()); + + // Get the number of draws (K). + const unsigned int K = lPartialSumVector.size(); + + // Number of classes/buckets: n + const short nbOfClasses = ioBucketHolder.getSize(); + + /** + Iterate on the classes/buckets, from 1 to n-1. + Note that n-1 corresponds to the size of the parameter list, + i.e., n corresponds to the number of classes/buckets. + */ + unsigned int Kj = K; + const int cabinCapacityInt = static_cast<int> (iCabinCapacity); + for (short j = 1 ; j <= nbOfClasses - 1; ++j, ioBucketHolder.iterate()) { + // DEBUG + std::cout << "K" << j << " = " << Kj << std::endl; + + /** Retrieve Bucket(j) (current) and Bucket(j+1) (next). */ + Bucket& currentBucket = ioBucketHolder.getCurrentBucket(); + Bucket& nextBucket = ioBucketHolder.getNextBucket(); + + /** Retrieve the prices for Bucket(j) and Bucket(j+1). */ + const double pj = currentBucket.getAverageYield(); + const double pj1 = nextBucket.getAverageYield(); + + /** + The optimal index is defined as: + lj = floor {[p(j+1)/p(j)] . K} + */ + const unsigned int lj = Kj - std::floor (Kj * (pj - pj1) / pj); + + // DEBUG + std::cout << "l" << j << " = " << lj << std::endl; + + /* + std::cout << "p(j+1) = " << pj1 << std::endl + << "p(j) = " << pj << std::endl + << "Kj = " << Kj << std::endl; + */ + + /** Consistency check. */ + assert (lj >= 1 && lj < Kj); + + /** + The optimal protection is defined as: + y(j) = 1/2 [S(j,lj) + S(j, lj+1)] + */ + const double sjl = lPartialSumVector.at (lj - 1); + const double sjlp1 = lPartialSumVector.at (lj + 1 - 1); + const double yj = (sjl + sjlp1) / 2; + + // Set the cumulated protection for Bucket(j) (j ranging from 1 to n-1) + currentBucket.setCumulatedProtection (yj); + + /** Update Kj for the next loop. */ + Kj = lj; + lPartialSumVector.resize (Kj); + + // Generated demand of the (j+1)th bucket for the next iteration. + const GeneratedDemandVector_T& lNextGeneratedDemandVector = + nextBucket.getGeneratedDemandVector (); + + for (unsigned int i = 0; i < Kj; ++i) { + const double lGeneratedDemand = lNextGeneratedDemandVector.at(i); + lPartialSumVector.at(i) += lGeneratedDemand; + } + + // Sort the vector from high to low. + std::sort (lPartialSumVector.begin(), lPartialSumVector.end(), + std::greater<double>()); + } + + // Set the protection of Bucket(n) to be equal to the capacity + Bucket& currentBucket = ioBucketHolder.getCurrentBucket(); + currentBucket.setCumulatedProtection (iCabinCapacity); + + /** + Re-calculate the values (protections, bkg limits and cumulated + booking limits, the optimal revenue. + */ + ioBucketHolder.recalculate (); + } + } Modified: trunk/rmol/rmol/bom/MCOptimiser.hpp =================================================================== --- trunk/rmol/rmol/bom/MCOptimiser.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/bom/MCOptimiser.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -45,6 +45,13 @@ PartialSumHolderHolder&, BidPriceVector_T&, StudyStatManager&); + /** + Leg optimisation using Monte-Carlo Integration as a step in + network optimisation. + */ + static void legOptimisationByMC (const ResourceCapacity_T, + BucketHolder&, BidPriceVector_T&); + }; } #endif // __RMOL_BOM_MCUTILS_HPP Modified: trunk/rmol/rmol/command/Optimiser.cpp =================================================================== --- trunk/rmol/rmol/command/Optimiser.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/command/Optimiser.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -196,4 +196,14 @@ ioBucketHolder, aBucket); } + + // ////////////////////////////////////////////////////////////////////// + void Optimiser:: + legOptimisationByMC (const ResourceCapacity_T iCabinCapacity, + BucketHolder& ioBucketHolder, + BidPriceVector_T& ioBidPriceVector) { + MCOptimiser::legOptimisationByMC (iCabinCapacity, ioBucketHolder, + ioBidPriceVector); + } + } Modified: trunk/rmol/rmol/command/Optimiser.hpp =================================================================== --- trunk/rmol/rmol/command/Optimiser.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/command/Optimiser.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -94,6 +94,12 @@ */ static void heuristicOptimisationByEmsrB (const ResourceCapacity_T, BucketHolder&); + + /** Leg optimisation using Monte-Carlo Integration as a step in + network optimisation. */ + static void legOptimisationByMC (const ResourceCapacity_T, + BucketHolder&, BidPriceVector_T&); + }; } #endif // __RMOL_COMMAND_OPTIMISER_HPP Modified: trunk/rmol/rmol/field/FldYieldRange.cpp =================================================================== --- trunk/rmol/rmol/field/FldYieldRange.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/field/FldYieldRange.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -38,7 +38,7 @@ // ////////////////////////////////////////////////////////////////////// FldYieldRange::FldYieldRange (const double iUpperYield, const double iAverageYield, - const double iLowerYield) : + const double iLowerYield) : _upperYield (iUpperYield), _averageYield (iAverageYield), _lowerYield (iLowerYield) { } Modified: trunk/rmol/rmol/service/RMOL_Service.cpp =================================================================== --- trunk/rmol/rmol/service/RMOL_Service.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/service/RMOL_Service.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -69,6 +69,13 @@ } // ////////////////////////////////////////////////////////////////////// + void RMOL_Service:: + setResourceCapacity (const ResourceCapacity_T iResourceCapacity) { + assert (_rmolServiceContext != NULL); + _rmolServiceContext->setResourceCapacity (iResourceCapacity); + } + + // ////////////////////////////////////////////////////////////////////// void RMOL_Service::addBucket (const double iYieldRange, const double iDemandMean, const double iDemandStandardDev) { @@ -78,19 +85,54 @@ } // ////////////////////////////////////////////////////////////////////// + void RMOL_Service::addBucket(const double iYieldRange, + const double iDemandMean, + const double iDemandStandardDev, + GeneratedDemandVector_T* ioGeneratedDemandVector){ + assert (_rmolServiceContext != NULL); + _rmolServiceContext->addBucket (iYieldRange, iDemandMean, + iDemandStandardDev, ioGeneratedDemandVector); + } + + // ////////////////////////////////////////////////////////////////////// + GeneratedDemandVector_T* RMOL_Service:: + generateDemand (const int K, const double& iMean, const double& iDeviation) { + return _rmolServiceContext->generateDemand (K, iMean, iDeviation); + } + + // ////////////////////////////////////////////////////////////////////// + GeneratedDemandVector_T* RMOL_Service:: + generateDemand (GeneratedDemandVector_T* ioFirstVector, + GeneratedDemandVector_T* ioSecondVector) { + return _rmolServiceContext->generateDemand (ioFirstVector, ioSecondVector); + } + + // ////////////////////////////////////////////////////////////////////// void RMOL_Service::readFromInputFile (const std::string& iInputFileName) { assert (_rmolServiceContext != NULL); _rmolServiceContext->readFromInputFile (iInputFileName); } // ////////////////////////////////////////////////////////////////////// + void RMOL_Service::buildContextForMC (const int K) { + assert (_rmolServiceContext != NULL); + _rmolServiceContext->buildContextForMC (K); + } + + // ////////////////////////////////////////////////////////////////////// + void RMOL_Service::reset () { + assert (_rmolServiceContext != NULL); + _rmolServiceContext->reset (); + } + + // ////////////////////////////////////////////////////////////////////// void RMOL_Service:: optimalOptimisationByMCIntegration (const int K) { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); BidPriceVector_T lBidPriceVector; StudyStatManager* lStudyStatManager_ptr = @@ -98,16 +140,16 @@ if (lStudyStatManager_ptr == NULL) { Optimiser::optimalOptimisationByMCIntegration (K, iCapacity, - *ioBucketHolder_ptr, + *oBucketHolder_ptr, lBidPriceVector); } else { Optimiser::optimalOptimisationByMCIntegration (K, iCapacity, - *ioBucketHolder_ptr, + *oBucketHolder_ptr, lBidPriceVector, *lStudyStatManager_ptr); } // DEBUG - RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); std::ostringstream logStream; logStream << "Bid-Price Vector (BPV): "; @@ -132,15 +174,15 @@ assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); Optimiser::optimalOptimisationByMCIntegration (K, iCapacity, - *ioBucketHolder_ptr, + *oBucketHolder_ptr, ioBidPriceVector); // Fill up booking vector - ioBucketHolder_ptr->fillup (ioBookingLimitVector); + oBucketHolder_ptr->fillup (ioBookingLimitVector); } // ////////////////////////////////////////////////////////////////////// @@ -149,13 +191,13 @@ assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::optimalOptimisationByDP (iCapacity, *ioBucketHolder_ptr); + Optimiser::optimalOptimisationByDP (iCapacity, *oBucketHolder_ptr); // DEBUG - RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); } // ////////////////////////////////////////////////////////////////////// @@ -164,37 +206,37 @@ assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::optimalOptimisationByDP (iCapacity, *ioBucketHolder_ptr); + Optimiser::optimalOptimisationByDP (iCapacity, *oBucketHolder_ptr); // Fill up booking vector - ioBucketHolder_ptr->fillup (ioBookingLimitVector); + oBucketHolder_ptr->fillup (ioBookingLimitVector); } // ////////////////////////////////////////////////////////////////////// void RMOL_Service::heuristicOptimisationByEmsr () { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); BidPriceVector_T lBidPriceVector; StudyStatManager* lStudyStatManager_ptr = _rmolServiceContext->getStudyStatManager(); if (lStudyStatManager_ptr == NULL) { - Optimiser::heuristicOptimisationByEmsr (iCapacity, *ioBucketHolder_ptr, + Optimiser::heuristicOptimisationByEmsr (iCapacity, *oBucketHolder_ptr, lBidPriceVector); } else { - Optimiser::heuristicOptimisationByEmsr (iCapacity, *ioBucketHolder_ptr, + Optimiser::heuristicOptimisationByEmsr (iCapacity, *oBucketHolder_ptr, lBidPriceVector, *lStudyStatManager_ptr); } // DEBUG - RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); std::ostringstream logStream; logStream << "Bid-Price Vector (BPV): "; unsigned int size = lBidPriceVector.size(); @@ -216,16 +258,16 @@ BookingLimitVector_T& ioBookingLimitVector) { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::heuristicOptimisationByEmsr (iCapacity, *ioBucketHolder_ptr, + Optimiser::heuristicOptimisationByEmsr (iCapacity, *oBucketHolder_ptr, ioBidPriceVector); // Update the booking limit vector. - for (ioBucketHolder_ptr->begin(); ioBucketHolder_ptr->hasNotReachedEnd(); - ioBucketHolder_ptr->iterate()) { - Bucket& currentBucket = ioBucketHolder_ptr->getCurrentBucket(); + for (oBucketHolder_ptr->begin(); oBucketHolder_ptr->hasNotReachedEnd(); + oBucketHolder_ptr->iterate()) { + Bucket& currentBucket = oBucketHolder_ptr->getCurrentBucket(); const double lBookingLimit = currentBucket.getCumulatedBookingLimit(); ioBookingLimitVector.push_back (lBookingLimit); } @@ -236,13 +278,13 @@ void RMOL_Service::heuristicOptimisationByEmsrA () { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::heuristicOptimisationByEmsrA (iCapacity, *ioBucketHolder_ptr); + Optimiser::heuristicOptimisationByEmsrA (iCapacity, *oBucketHolder_ptr); // DEBUG - RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); } // ////////////////////////////////////////////////////////////////////// @@ -251,13 +293,13 @@ BookingLimitVector_T& ioBookingLimitVector) { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::heuristicOptimisationByEmsrA (iCapacity, *ioBucketHolder_ptr); + Optimiser::heuristicOptimisationByEmsrA (iCapacity, *oBucketHolder_ptr); // Fill up booking vector - ioBucketHolder_ptr->fillup (ioBookingLimitVector); + oBucketHolder_ptr->fillup (ioBookingLimitVector); } // ////////////////////////////////////////////////////////////////////// @@ -304,13 +346,13 @@ void RMOL_Service::heuristicOptimisationByEmsrB () { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::heuristicOptimisationByEmsrB (iCapacity, *ioBucketHolder_ptr); + Optimiser::heuristicOptimisationByEmsrB (iCapacity, *oBucketHolder_ptr); // DEBUG - RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); } // ////////////////////////////////////////////////////////////////////// @@ -319,13 +361,53 @@ BookingLimitVector_T& ioBookingLimitVector) { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); - BucketHolder* ioBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); - assert (ioBucketHolder_ptr != NULL); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); - Optimiser::heuristicOptimisationByEmsrB (iCapacity, *ioBucketHolder_ptr); + Optimiser::heuristicOptimisationByEmsrB (iCapacity, *oBucketHolder_ptr); // Fill up booking vector - ioBucketHolder_ptr->fillup (ioBookingLimitVector); + oBucketHolder_ptr->fillup (ioBookingLimitVector); } + + // /////////////////////////////////////////////////////////////////////// + void RMOL_Service:: legOptimisationByMC () { + assert (_rmolServiceContext != NULL); + const ResourceCapacity_T iCapacity = _rmolServiceContext->getCapacity(); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); + + BidPriceVector_T lBidPriceVector; + Optimiser::legOptimisationByMC (iCapacity, *oBucketHolder_ptr, + lBidPriceVector); + + // DEBUG + RMOL_LOG_DEBUG (oBucketHolder_ptr->display()); + std::ostringstream logStream; + logStream << "Bid-Price Vector (BPV): "; + unsigned int size = lBidPriceVector.size(); + + for (unsigned int i = 0; i < size; ++i) { + const double bidPrice = lBidPriceVector.at(i); + logStream << std::fixed << std::setprecision (2) << bidPrice << " "; + } + RMOL_LOG_DEBUG (logStream.str()); + } + + // /////////////////////////////////////////////////////////////////////// + void RMOL_Service:: + legOptimisationByMC (BidPriceVector_T& ioBidPriceVector, + BookingLimitVector_T& ioBookingLimitVector) { + assert (_rmolServiceContext != NULL); + const ResourceCapacity_T iCapacity = _rmolServiceContext->getCapacity(); + BucketHolder* oBucketHolder_ptr = _rmolServiceContext->getBucketHolder(); + assert (oBucketHolder_ptr != NULL); + + Optimiser::legOptimisationByMC (iCapacity, *oBucketHolder_ptr, + ioBidPriceVector); + + // Fill up booking vector + oBucketHolder_ptr->fillup (ioBookingLimitVector); + } } Modified: trunk/rmol/rmol/service/RMOL_ServiceContext.cpp =================================================================== --- trunk/rmol/rmol/service/RMOL_ServiceContext.cpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/service/RMOL_ServiceContext.cpp 2009-06-04 07:41:35 UTC (rev 223) @@ -11,6 +11,7 @@ #include <rmol/bom/Bucket.hpp> #include <rmol/bom/BucketHolder.hpp> #include <rmol/bom/StudyStatManager.hpp> +#include <rmol/bom/Gaussian.hpp> #include <rmol/factory/FacSupervisor.hpp> #include <rmol/factory/FacDemand.hpp> #include <rmol/factory/FacBucket.hpp> @@ -25,21 +26,24 @@ RMOL_ServiceContext:: RMOL_ServiceContext (const ResourceCapacity_T iResourceCapacity) : _bucketHolder (NULL), _capacity (iResourceCapacity), - _studyStatManager (NULL) { + _studyStatManager (NULL), + _generatedDemandVectorHolder (DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER) { init (iResourceCapacity); } // ////////////////////////////////////////////////////////////////////// RMOL_ServiceContext::RMOL_ServiceContext () : _bucketHolder (NULL), _capacity (DEFAULT_RMOL_SERVICE_CAPACITY), - _studyStatManager (NULL) { + _studyStatManager (NULL), + _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) { + _studyStatManager (NULL), + _generatedDemandVectorHolder (DEFAULT_GENERATED_DEMAND_VECTOR_HOLDER) { init (DEFAULT_RMOL_SERVICE_CAPACITY); } @@ -58,6 +62,13 @@ } // ////////////////////////////////////////////////////////////////////// + void RMOL_ServiceContext:: + setResourceCapacity (const ResourceCapacity_T iResourceCapacity) { + _capacity = iResourceCapacity; + init (iResourceCapacity); + } + + // ////////////////////////////////////////////////////////////////////// void RMOL_ServiceContext::addBucket (const double iYieldRange, const double iDemandMean, const double iDemandStandardDev) { @@ -74,9 +85,95 @@ // ////////////////////////////////////////////////////////////////////// void RMOL_ServiceContext:: + addBucket (const double iYieldRange, + const double iDemandMean, + const double iDemandStandardDev, + GeneratedDemandVector_T* ioGeneratedDemandVector) { + const FldYieldRange aYieldRange (iYieldRange); + const FldDistributionParameters aDistribParams (iDemandMean, + iDemandStandardDev); + Demand& aDemand = + FacDemand::instance().create (aDistribParams, aYieldRange); + Bucket& aBucket = FacBucket::instance().create (aYieldRange, aDemand); + aBucket.setGeneratedDemandVector (ioGeneratedDemandVector); + + assert (_bucketHolder != NULL); + FacBucketHolder::instance().addBucket (*_bucketHolder, aBucket); + } + + // ////////////////////////////////////////////////////////////////////// + GeneratedDemandVector_T* RMOL_ServiceContext:: + generateDemand (const int K, const double& iMean, const double& iDeviation) { + // Build a vector of K generated numbers from the given distribution + // N(iMean, iDeviation) and add this vector to the + // GeneratedDemandVector holder. + _generatedDemandVectorHolder.push_back (DEFAULT_GENERATED_DEMAND_VECTOR); + GeneratedDemandVectorHolder_T::reverse_iterator itLastVector = + _generatedDemandVectorHolder.rbegin(); + GeneratedDemandVector_T& lDemandVector = *itLastVector; + lDemandVector.reserve (K); + const FldDistributionParameters aDistributionParam = + FldDistributionParameters::FldDistributionParameters (iMean, iDeviation); + const Gaussian gaussianDemandGenerator (aDistributionParam); + + // Generate K numbers + for (int i = 0; i < K; ++i) { + const double lGeneratedDemand = gaussianDemandGenerator.generateVariate (); + lDemandVector.push_back (lGeneratedDemand); + } + + return &lDemandVector; + } + + // ////////////////////////////////////////////////////////////////////// + GeneratedDemandVector_T* RMOL_ServiceContext:: + generateDemand (GeneratedDemandVector_T* ioFirstVector, + GeneratedDemandVector_T* ioSecondVector) { + if (ioFirstVector == NULL || ioSecondVector == NULL) { + return NULL; + } else { + const unsigned int K = ioFirstVector->size(); + assert (K == ioSecondVector->size()); + _generatedDemandVectorHolder.push_back (DEFAULT_GENERATED_DEMAND_VECTOR); + GeneratedDemandVectorHolder_T::reverse_iterator itLastVector = + _generatedDemandVectorHolder.rbegin(); + GeneratedDemandVector_T& lDemandVector = *itLastVector; + lDemandVector.reserve (K); + for (unsigned int i = 0; i < K; ++i) { + const double lGeneratedDemand = + ioFirstVector->at(i) + ioSecondVector->at(i); + lDemandVector.push_back (lGeneratedDemand); + } + + return &lDemandVector; + } + } + + // ////////////////////////////////////////////////////////////////////// + void RMOL_ServiceContext:: readFromInputFile (const std::string& iInputFileName) { assert (_bucketHolder != NULL); FileMgr::readAndProcessInputFile (iInputFileName, *_bucketHolder); } + // ////////////////////////////////////////////////////////////////////// + void RMOL_ServiceContext::buildContextForMC (const int K) { + assert (_bucketHolder != NULL); + for (_bucketHolder->begin(); _bucketHolder->hasNotReachedEnd(); + _bucketHolder->iterate()) { + Bucket& currentBucket = _bucketHolder->getCurrentBucket(); + const double mean = currentBucket.getMean(); + const double standardDeviation = currentBucket.getStandardDeviation(); + GeneratedDemandVector_T* lGeneratedDemandVector = + generateDemand (K, mean, standardDeviation); + currentBucket.setGeneratedDemandVector (lGeneratedDemandVector); + } + } + + // ////////////////////////////////////////////////////////////////////// + void RMOL_ServiceContext::reset () { + _capacity = DEFAULT_RMOL_SERVICE_CAPACITY; + _bucketHolder = NULL; + } + } Modified: trunk/rmol/rmol/service/RMOL_ServiceContext.hpp =================================================================== --- trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2009-05-31 01:12:16 UTC (rev 222) +++ trunk/rmol/rmol/service/RMOL_ServiceContext.hpp 2009-06-04 07:41:35 UTC (rev 223) @@ -35,6 +35,9 @@ /** Destructor. */ ~RMOL_ServiceContext(); + /** Set the cabin availability. */ + void setResourceCapacity (const ResourceCapacity_T iResourceCapacity); + /** Set the BucketHolder. */ void setBucketHolder (BucketHolder* ioBucketHolderPtr) { _bucketHolder = ioBucketHolderPtr; @@ -44,8 +47,29 @@ 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 (); /** Get the internal BucketHolder. */ BucketHolder* getBucketHolder() const { @@ -75,6 +99,9 @@ /** 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...> - 2009-05-31 01:12:24
|
Revision: 222 http://rmol.svn.sourceforge.net/rmol/?rev=222&view=rev Author: denis_arnaud Date: 2009-05-31 01:12:16 +0000 (Sun, 31 May 2009) Log Message: ----------- [RPM] Suppressed the dependency on texlive-dvips, as texlive-latex already gets a dependency on it. Modified Paths: -------------- trunk/rmol/rmol.spec.in Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-29 14:28:58 UTC (rev 221) +++ trunk/rmol/rmol.spec.in 2009-05-31 01:12:16 UTC (rev 222) @@ -51,11 +51,12 @@ Group: Documentation %if 0%{?fedora} >= 10 BuildArch: noarch -BuildRequires: texlive-latex, texlive-dvips +BuildRequires: texlive-latex %endif %if 0%{?fedora} < 10 -BuildRequires: tetex-latex, tetex-dvips +BuildRequires: tetex-latex %endif +%{?el5:BuildRequires: tetex-latex} BuildRequires: doxygen, ghostscript %description doc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-29 14:29:01
|
Revision: 221 http://rmol.svn.sourceforge.net/rmol/?rev=221&view=rev Author: denis_arnaud Date: 2009-05-29 14:28:58 +0000 (Fri, 29 May 2009) Log Message: ----------- In the batch, added a function for initialising the sell-up probability vector. Modified Paths: -------------- trunk/rmol/rmol/batches/rmol.cpp Modified: trunk/rmol/rmol/batches/rmol.cpp =================================================================== --- trunk/rmol/rmol/batches/rmol.cpp 2009-05-28 15:16:47 UTC (rev 220) +++ trunk/rmol/rmol/batches/rmol.cpp 2009-05-29 14:28:58 UTC (rev 221) @@ -39,11 +39,19 @@ <li>2 = EMSR</li> <li>3 = EMSR-a</li> <li>4 = EMSR-b</li> - <li>5 = EMSR-a with sell up + <li>5 = EMSR-a with sell up</li> </ul> */ const short K_RMOL_DEFAULT_METHOD = 0; +/** Fill a vector of default sell-up probability values. */ +void initDefaultValuesForSellupProbabilityVector (RMOL::SellupProbabilityVector_T& ioSellUpProbabilityVector) { + // Add default values only when the given vector is empty + if (ioSellUpProbabilityVector.empty() == true) { + ioSellUpProbabilityVector.push_back (0.2); + } +} + // ///////// Parsing of Options & Configuration ///////// // A helper function to simplify the main part. template<class T> std::ostream& operator<< (std::ostream& os, @@ -56,13 +64,14 @@ const int K_RMOL_EARLY_RETURN_STATUS = 99; /** Read and parse the command line options. */ -int readConfiguration (int argc, char* argv[], - int& lRandomDraws, double& lCapacity, - std::vector<double>& lSellupProbabilityVector, - short& lMethod, - std::string& lInputFilename, - std::string& lLogFilename) { - +int readConfiguration(int argc, char* argv[], + int& ioRandomDraws, double& ioCapacity, + RMOL::SellupProbabilityVector_T& ioSellupProbabilityVector, + short& ioMethod, std::string& ioInputFilename, + std::string& ioLogFilename) { + + // Initialise the sell-up probability vector with default values + initDefaultValuesForSellupProbabilityVector (ioSellupProbabilityVector); // Declare a group of options that will be allowed only on command line boost::program_options::options_description generic ("Generic options"); @@ -76,22 +85,22 @@ boost::program_options::options_description config ("Configuration"); config.add_options() ("draws,d", - boost::program_options::value<int>(&lRandomDraws)->default_value(K_RMOL_DEFAULT_RANDOM_DRAWS), + boost::program_options::value<int>(&ioRandomDraws)->default_value(K_RMOL_DEFAULT_RANDOM_DRAWS), "Number of to-be-generated random draws") ("capacity,c", - boost::program_options::value<double>(&lCapacity)->default_value(K_RMOL_DEFAULT_CAPACITY), + boost::program_options::value<double>(&ioCapacity)->default_value(K_RMOL_DEFAULT_CAPACITY), "Resource capacity (e.g., for a flight leg)") ("sellup,s", - boost::program_options::value< std::vector<double> >(&lSellupProbabilityVector)->multitoken(), + boost::program_options::value< std::vector<double> >(&ioSellupProbabilityVector)->multitoken(), "Sell-up proability vector (e.g. j-th element implies the sell up probability of class j+1 to class j where class 1 yields the highest value") ("method,m", - boost::program_options::value<short>(&lMethod)->default_value(K_RMOL_DEFAULT_METHOD), + boost::program_options::value<short>(&ioMethod)->default_value(K_RMOL_DEFAULT_METHOD), "Revenue Management method to be used (0 = Monte-Carlo, 1 = Dynamic Programming, 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sell up probability)") ("input,i", - boost::program_options::value< std::string >(&lInputFilename)->default_value(K_RMOL_DEFAULT_INPUT_FILENAME), + boost::program_options::value< std::string >(&ioInputFilename)->default_value(K_RMOL_DEFAULT_INPUT_FILENAME), "(CVS) input file for the demand distributions") ("log,l", - boost::program_options::value< std::string >(&lLogFilename)->default_value(K_RMOL_DEFAULT_LOG_FILENAME), + boost::program_options::value< std::string >(&ioLogFilename)->default_value(K_RMOL_DEFAULT_LOG_FILENAME), "Filename for the logs") ; @@ -141,18 +150,26 @@ } if (vm.count ("input")) { - lInputFilename = vm["input"].as< std::string >(); - std::cout << "Input filename is: " << lInputFilename << std::endl; + ioInputFilename = vm["input"].as< std::string >(); + std::cout << "Input filename is: " << ioInputFilename << std::endl; } if (vm.count ("log")) { - lLogFilename = vm["log"].as< std::string >(); - std::cout << "Log filename is: " << lLogFilename << std::endl; + ioLogFilename = vm["log"].as< std::string >(); + std::cout << "Log filename is: " << ioLogFilename << std::endl; } - std::cout << "The number of random draws is: " << lRandomDraws << std::endl; - std::cout << "The resource capacity is: " << lCapacity << std::endl; - std::cout << "The Revenue Management method is: " << lMethod << std::endl; + std::cout << "The number of random draws is: " << ioRandomDraws << std::endl; + std::cout << "The resource capacity is: " << ioCapacity << std::endl; + std::cout << "The Revenue Management method is: " << ioMethod << std::endl; + std::cout << "The sell-up probability vector is: " << std::endl; + unsigned short idx = 0; + for (RMOL::SellupProbabilityVector_T::const_iterator itValue = + ioSellupProbabilityVector.begin(); + itValue != ioSellupProbabilityVector.end(); ++itValue, ++idx) { + std::cout << "[" << idx << "] " << *itValue << "; "; + } + std::cout << std::endl; return 0; } @@ -168,10 +185,11 @@ // Cabin Capacity (it must be greater then 100 here) double lCapacity = 0.0; - /** Default probability that a demand group buys the next higher fare products - when the products which they came for are not available. */ - std::vector<double> lSellupProbabilityVector; - lSellupProbabilityVector.push_back(0.2); + /** Default probability that a demand group buys the next higher + fare products when the products which they came for are not + available. */ + RMOL::SellupProbabilityVector_T lSellupProbabilityVector; + // lSellupProbabilityVector.push_back (0.2); // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sell up probability) @@ -185,8 +203,9 @@ // Call the command-line option parser const int lOptionParserStatus = - readConfiguration (argc, argv, lRandomDraws, lCapacity, lSellupProbabilityVector, - lMethod, lInputFilename, lLogFilename); + readConfiguration (argc, argv, lRandomDraws, lCapacity, + lSellupProbabilityVector, lMethod, lInputFilename, + lLogFilename); if (lOptionParserStatus == K_RMOL_EARLY_RETURN_STATUS) { return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dk...@us...> - 2009-05-28 15:16:55
|
Revision: 220 http://rmol.svn.sourceforge.net/rmol/?rev=220&view=rev Author: dkchoe Date: 2009-05-28 15:16:47 +0000 (Thu, 28 May 2009) Log Message: ----------- EMSR-a with sell up algorithm can be run through command line; A command line option for sell up probability vector has been added Modified Paths: -------------- trunk/rmol/rmol/batches/rmol.cpp Modified: trunk/rmol/rmol/batches/rmol.cpp =================================================================== --- trunk/rmol/rmol/batches/rmol.cpp 2009-05-28 14:51:35 UTC (rev 219) +++ trunk/rmol/rmol/batches/rmol.cpp 2009-05-28 15:16:47 UTC (rev 220) @@ -27,6 +27,10 @@ /** Default value for the capacity of the resource (e.g., a flight cabin). */ const double K_RMOL_DEFAULT_CAPACITY = 500.0; +/** Default probability that a demand group buys the next higher fare products +when the products which they came for are not available. */ +// const std::vector<double> K_RMOL_DEFAULT_SELLUP_PROBABILITY; + /** Default name and location for the Revenue Management method to be used. <br> <ul> @@ -35,6 +39,7 @@ <li>2 = EMSR</li> <li>3 = EMSR-a</li> <li>4 = EMSR-b</li> + <li>5 = EMSR-a with sell up </ul> */ const short K_RMOL_DEFAULT_METHOD = 0; @@ -51,9 +56,12 @@ const int K_RMOL_EARLY_RETURN_STATUS = 99; /** Read and parse the command line options. */ -int readConfiguration (int argc, char* argv[], int& lRandomDraws, - double& lCapacity, short& lMethod, - std::string& lInputFilename, std::string& lLogFilename) { +int readConfiguration (int argc, char* argv[], + int& lRandomDraws, double& lCapacity, + std::vector<double>& lSellupProbabilityVector, + short& lMethod, + std::string& lInputFilename, + std::string& lLogFilename) { // Declare a group of options that will be allowed only on command line @@ -73,9 +81,12 @@ ("capacity,c", boost::program_options::value<double>(&lCapacity)->default_value(K_RMOL_DEFAULT_CAPACITY), "Resource capacity (e.g., for a flight leg)") + ("sellup,s", + boost::program_options::value< std::vector<double> >(&lSellupProbabilityVector)->multitoken(), + "Sell-up proability vector (e.g. j-th element implies the sell up probability of class j+1 to class j where class 1 yields the highest value") ("method,m", boost::program_options::value<short>(&lMethod)->default_value(K_RMOL_DEFAULT_METHOD), - "Revenue Management method to be used (0 = Monte-Carlo, 1 = Dynamic Programming, 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b)") + "Revenue Management method to be used (0 = Monte-Carlo, 1 = Dynamic Programming, 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sell up probability)") ("input,i", boost::program_options::value< std::string >(&lInputFilename)->default_value(K_RMOL_DEFAULT_INPUT_FILENAME), "(CVS) input file for the demand distributions") @@ -154,12 +165,17 @@ // Number of random draws to be generated (best if greater than 100) int lRandomDraws = 0; - // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, - // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b) - short lMethod = 0; - // Cabin Capacity (it must be greater then 100 here) double lCapacity = 0.0; + + /** Default probability that a demand group buys the next higher fare products + when the products which they came for are not available. */ + std::vector<double> lSellupProbabilityVector; + lSellupProbabilityVector.push_back(0.2); + + // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, + // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b, 5 = EMSR-a with sell up probability) + short lMethod = 0; // Input file name std::string lInputFilename; @@ -169,8 +185,8 @@ // Call the command-line option parser const int lOptionParserStatus = - readConfiguration (argc, argv, lRandomDraws, lCapacity, lMethod, - lInputFilename, lLogFilename); + readConfiguration (argc, argv, lRandomDraws, lCapacity, lSellupProbabilityVector, + lMethod, lInputFilename, lLogFilename); if (lOptionParserStatus == K_RMOL_EARLY_RETURN_STATUS) { return 0; @@ -239,6 +255,12 @@ rmolService.heuristicOptimisationByEmsrB (); break; } + case 5: { + // Calculate the protections by EMSR-a with sell up probability + rmolService.heuristicOptimisationByEmsrAwithSellup + (lSellupProbabilityVector); + break; + } default: { rmolService.optimalOptimisationByMCIntegration (lRandomDraws); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-28 14:51:37
|
Revision: 219 http://rmol.svn.sourceforge.net/rmol/?rev=219&view=rev Author: denis_arnaud Date: 2009-05-28 14:51:35 +0000 (Thu, 28 May 2009) Log Message: ----------- [Tests] Improved (a little bit) the robustness of the tests. Modified Paths: -------------- trunk/rmol/test/OptimiseTestSuite.cpp Modified: trunk/rmol/test/OptimiseTestSuite.cpp =================================================================== --- trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-27 15:39:44 UTC (rev 218) +++ trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-28 14:51:35 UTC (rev 219) @@ -10,12 +10,13 @@ #include <test/OptimiseTestSuite.hpp> // ////////////////////////////////////////////////////////////////////// -int testOptimiseHelper(const unsigned short optimisationMethodFlag) { +int testOptimiseHelper (const unsigned short optimisationMethodFlag) { // Return value - int valueToBeTested = 0; + int oExpectedBookingLimit = 0; try { + // Output log File std::string lLogFilename ("OptimiseTestSuite.log"); @@ -35,7 +36,7 @@ // Set the log parameters std::ofstream logOutputFile; - // open and clean the log outputfile + // Open and clean the log outputfile logOutputFile.open (lLogFilename.c_str()); logOutputFile.clear(); @@ -70,45 +71,57 @@ case 0 : // Calculate the optimal protections by the Monte Carlo // Integration approach - rmolService.optimalOptimisationByMCIntegration (K); - break; - + { + rmolService.optimalOptimisationByMCIntegration (K); + break; + } case 1 : // Calculate the optimal protections by DP. - rmolService.optimalOptimisationByDP (); - break; - + { + rmolService.optimalOptimisationByDP (); + break; + } case 2 : // Calculate the Bid-Price Vector by EMSR - rmolService.heuristicOptimisationByEmsr (); - break; + { + rmolService.heuristicOptimisationByEmsr (); + break; + } + case 3 : // Calculate the protections by EMSR-a + { + // Test the EMSR-a algorithm implementation + rmolService.heuristicOptimisationByEmsrA (lBidPriceVector, + lBookingLimitVector); - case 3 : // Calculate the protections by EMSR-a - // Test the algorithm - rmolService.heuristicOptimisationByEmsrA - (lBidPriceVector, lBookingLimitVector); - // Return a cumulated booking limit value to test - valueToBeTested = static_cast<int>(lBookingLimitVector[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; - + { + rmolService.heuristicOptimisationByEmsrB (); + break; + } case 5 : // Calculate the protection by EMSR-a with sellup { - // Create a sell-up probability vector - std::vector<double> sampleSellupProbabilityVector; - double sampleProbability = 0.2; + // 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 - short nbOfSampleBucket = 4; - for (short i = 1; i <= nbOfSampleBucket - 1; i++) - sampleSellupProbabilityVector.push_back(sampleProbability); - RMOL::SellupProbabilityVector_T& sellupProbabilityVector - = sampleSellupProbabilityVector; + // 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, lBidPriceVector, lBookingLimitVector); + // Return a cumulated booking limit value to test - valueToBeTested = static_cast<int>(lBookingLimitVector[2]); + oExpectedBookingLimit = static_cast<int> (lBookingLimitVector.at(2)); + break; } @@ -122,7 +135,7 @@ std::cerr << "Unknown exception" << std::endl; } - return valueToBeTested; + return oExpectedBookingLimit; } @@ -155,8 +168,8 @@ // ////////////////////////////////////////////////////////////////////// // EMSR-a void OptimiseTestSuite::testOptimiseEMSRa() { - int valueInTest = testOptimiseHelper(3); - CPPUNIT_ASSERT(valueInTest==61); + const int lExpectedBookingLimit = testOptimiseHelper(3); + CPPUNIT_ASSERT(lExpectedBookingLimit == 61); } // ////////////////////////////////////////////////////////////////////// @@ -168,8 +181,8 @@ // ////////////////////////////////////////////////////////////////////// // EMSR-a with sell-up void OptimiseTestSuite::testOptimiseEMSRaWithSU() { - int valueInTest = testOptimiseHelper(5); - CPPUNIT_ASSERT(valueInTest==59); + const int lExpectedBookingLimit = testOptimiseHelper(5); + CPPUNIT_ASSERT(lExpectedBookingLimit == 59); } // ////////////////////////////////////////////////////////////////////// @@ -184,3 +197,4 @@ // /////////////// M A I N ///////////////// CPPUNIT_MAIN() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dk...@us...> - 2009-05-27 15:39:51
|
Revision: 218 http://rmol.svn.sourceforge.net/rmol/?rev=218&view=rev Author: dkchoe Date: 2009-05-27 15:39:44 +0000 (Wed, 27 May 2009) Log Message: ----------- Modified CPPUNIT test to assert to a specific value Modified Paths: -------------- trunk/rmol/rmol/bom/Emsr.cpp trunk/rmol/test/OptimiseTestSuite.cpp Modified: trunk/rmol/rmol/bom/Emsr.cpp =================================================================== --- trunk/rmol/rmol/bom/Emsr.cpp 2009-05-26 18:09:13 UTC (rev 217) +++ trunk/rmol/rmol/bom/Emsr.cpp 2009-05-27 15:39:44 UTC (rev 218) @@ -160,7 +160,8 @@ (higherBucket, nextBucket, sellupProbability); } else { lPRotectionLevelAgainstAHigherBucket = - EmsrUtils::computeProtectionLevel (higherBucket, nextBucket); + EmsrUtils::computeProtectionLevelwithSellup + (higherBucket, nextBucket, 0); ioBucketHolder.iterate(); } Modified: trunk/rmol/test/OptimiseTestSuite.cpp =================================================================== --- trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-26 18:09:13 UTC (rev 217) +++ trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-27 15:39:44 UTC (rev 218) @@ -10,10 +10,12 @@ #include <test/OptimiseTestSuite.hpp> // ////////////////////////////////////////////////////////////////////// -void testOptimiseHelper(const unsigned short optimisationMethodFlag) { +int testOptimiseHelper(const unsigned short optimisationMethodFlag) { + // Return value + int valueToBeTested = 0; + try { - // Output log File std::string lLogFilename ("OptimiseTestSuite.log"); @@ -37,9 +39,13 @@ logOutputFile.open (lLogFilename.c_str()); logOutputFile.clear(); - // Initialise the list of classes/buckets + // Initialise the RMOL service RMOL::RMOL_Service rmolService (logOutputFile, cabinCapacity); + // Define bid price and booking Limit vectors + RMOL::BidPriceVector_T lBidPriceVector; + RMOL::BookingLimitVector_T lBookingLimitVector; + if (hasInputFile) { // Read the input file rmolService.readFromInputFile (inputFileName); @@ -76,7 +82,11 @@ break; case 3 : // Calculate the protections by EMSR-a - rmolService.heuristicOptimisationByEmsrA (); + // Test the algorithm + rmolService.heuristicOptimisationByEmsrA + (lBidPriceVector, lBookingLimitVector); + // Return a cumulated booking limit value to test + valueToBeTested = static_cast<int>(lBookingLimitVector[2]); break; case 4 : // Calculate the protections by EMSR-b @@ -85,31 +95,46 @@ case 5 : // Calculate the protection by EMSR-a with sellup { - std::vector<double> sampleVector; + // Create a sell-up probability vector + std::vector<double> sampleSellupProbabilityVector; double sampleProbability = 0.2; - // NOTE: size of sellup vector should be equal to no of buckets + // NOTE: size of sellup vector should be equal to no of buckets - 1 short nbOfSampleBucket = 4; for (short i = 1; i <= nbOfSampleBucket - 1; i++) - sampleVector.push_back(sampleProbability); + sampleSellupProbabilityVector.push_back(sampleProbability); RMOL::SellupProbabilityVector_T& sellupProbabilityVector - = sampleVector; - rmolService.heuristicOptimisationByEmsrAwithSellup (sellupProbabilityVector); + = sampleSellupProbabilityVector; + // Test the algorithm with the sample sell-up vector + rmolService.heuristicOptimisationByEmsrAwithSellup + (sellupProbabilityVector, lBidPriceVector, lBookingLimitVector); + // Return a cumulated booking limit value to test + valueToBeTested = static_cast<int>(lBookingLimitVector[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 valueToBeTested; } // ////////////////////////////////////////////////////////////////////// +// 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);); @@ -130,7 +155,8 @@ // ////////////////////////////////////////////////////////////////////// // EMSR-a void OptimiseTestSuite::testOptimiseEMSRa() { - CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(3);); + int valueInTest = testOptimiseHelper(3); + CPPUNIT_ASSERT(valueInTest==61); } // ////////////////////////////////////////////////////////////////////// @@ -142,7 +168,8 @@ // ////////////////////////////////////////////////////////////////////// // EMSR-a with sell-up void OptimiseTestSuite::testOptimiseEMSRaWithSU() { - CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(5);); + int valueInTest = testOptimiseHelper(5); + CPPUNIT_ASSERT(valueInTest==59); } // ////////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dk...@us...> - 2009-05-26 18:10:17
|
Revision: 217 http://rmol.svn.sourceforge.net/rmol/?rev=217&view=rev Author: dkchoe Date: 2009-05-26 18:09:13 +0000 (Tue, 26 May 2009) Log Message: ----------- Fixed bugs in EMSR-a with Sell-up algorithm; Unit test completed Modified Paths: -------------- trunk/rmol/rmol/bom/Emsr.cpp trunk/rmol/rmol/bom/EmsrUtils.cpp Property Changed: ---------------- trunk/rmol/test/ Modified: trunk/rmol/rmol/bom/Emsr.cpp =================================================================== --- trunk/rmol/rmol/bom/Emsr.cpp 2009-05-25 11:42:09 UTC (rev 216) +++ trunk/rmol/rmol/bom/Emsr.cpp 2009-05-26 18:09:13 UTC (rev 217) @@ -142,7 +142,7 @@ Bucket& nextBucket = ioBucketHolder.getNextBucket(); // Get the probability of sell-up from nextBucket to the next higher - double sellupProbability = iSellupProbabilityVector[j]; + double sellupProbability = iSellupProbabilityVector[j-1]; // Initialize protection level for the current class j double lProtectionLevel = 0.0; Modified: trunk/rmol/rmol/bom/EmsrUtils.cpp =================================================================== --- trunk/rmol/rmol/bom/EmsrUtils.cpp 2009-05-25 11:42:09 UTC (rev 216) +++ trunk/rmol/rmol/bom/EmsrUtils.cpp 2009-05-26 18:09:13 UTC (rev 217) @@ -78,7 +78,7 @@ const double lProtectionLevel = lMean + gsl_cdf_gaussian_Pinv((lHigherBucketYield-lBucketYield)/ - lHigherBucketYield*(1-iSellupFactor),lSD); + (lHigherBucketYield*(1-iSellupFactor)),lSD); return lProtectionLevel; } Property changes on: trunk/rmol/test ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile Makefile.in optimise simulate sim.gnumeric OptimiseTestSuite OptimiseTestSuite.log OptimiseTestSuite_results.xml SimulateTestSuite SimulateTestSuite_results.xml + .deps .libs Makefile Makefile.in optimise simulate sim.gnumeric OptimiseTestSuite OptimiseTestSuite.log OptimiseTestSuite_results.xml SimulateTestSuite SimulateTestSuite_results.xml rmol.log This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-25 11:42:15
|
Revision: 216 http://rmol.svn.sourceforge.net/rmol/?rev=216&view=rev Author: denis_arnaud Date: 2009-05-25 11:42:09 +0000 (Mon, 25 May 2009) Log Message: ----------- 1. Replaced the std::cout-based logs by RMOL_LOG_DEBUG()-based ones. 2. Split the tests. 3. Updated the source files for the generation of documentation. Modified Paths: -------------- trunk/rmol/Makefile.am trunk/rmol/doc/Makefile.am trunk/rmol/po/POTFILES.in trunk/rmol/rmol/bom/DPOptimiser.cpp trunk/rmol/rmol/bom/MCOptimiser.cpp trunk/rmol/rmol/bom/StatAggregatorStruct.cpp trunk/rmol/rmol/bom/StatAggregatorStruct.hpp trunk/rmol/rmol/bom/StudyStatManager.cpp trunk/rmol/rmol/command/Optimiser.cpp trunk/rmol/rmol/service/Logger.cpp trunk/rmol/rmol/service/Logger.hpp trunk/rmol/test/OptimiseTestSuite.cpp trunk/rmol/test/OptimiseTestSuite.hpp Property Changed: ---------------- trunk/rmol/ Property changes on: trunk/rmol ___________________________________________________________________ Modified: svn:ignore - autom4te.cache INSTALL Makefile Makefile.in aclocal.m4 config.log config.status configure libtool rmol-config rmol-html-doc-0.*.0.tar.bz2 rmol-html-doc-0.*.0.tar.gz rmol.pc rmol.m4 rmol.spec config.guess config.h config.h.in config.sub configure.log rmol-0.*.0.tar.bz2 rmol-0.*.0.tar.gz stamp-h1 mytest + autom4te.cache INSTALL Makefile Makefile.in aclocal.m4 config.log config.status configure libtool rmol-config rmol-doc-0.*.0.tar.bz2 rmol-doc-0.*.0.tar.gz rmol.pc rmol.m4 rmol.spec config.guess config.h config.h.in config.sub configure.log rmol-0.*.0.tar.bz2 rmol-0.*.0.tar.gz stamp-h1 mytest Modified: trunk/rmol/Makefile.am =================================================================== --- trunk/rmol/Makefile.am 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/Makefile.am 2009-05-25 11:42:09 UTC (rev 216) @@ -52,7 +52,7 @@ $(MAKE) dist distdir=@PACKAGE_TARNAME@-`date +"%Y%m%d"` snapshot-html: - $(MAKE) -C doc dist-html html_tarname=@PACKAGE_TARNAME@-html-doc-`date +"%Y%m%d"` + $(MAKE) -C doc dist-html html_tarname=@PACKAGE_TARNAME@-doc-`date +"%Y%m%d"` upload: upload-src upload-html @@ -61,6 +61,6 @@ @PACKAGE_TARNAME@-@VERSION@.tar.bz2 upload-html: dist-html - @UPLOAD_COMMAND@ @PACKAGE_TARNAME@-html-doc-@VERSION@.tar.gz \ - @PACKAGE_TARNAME@-html-doc-@VERSION@.tar.bz2 + @UPLOAD_COMMAND@ @PACKAGE_TARNAME@-doc-@VERSION@.tar.gz \ + @PACKAGE_TARNAME@-doc-@VERSION@.tar.bz2 Modified: trunk/rmol/doc/Makefile.am =================================================================== --- trunk/rmol/doc/Makefile.am 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/doc/Makefile.am 2009-05-25 11:42:09 UTC (rev 216) @@ -14,7 +14,7 @@ docdir = @docdir@ -html_tarname = @PACKAGE_TARNAME@-html-doc-@PACKAGE_VERSION@ +html_tarname = @PACKAGE_TARNAME@-doc-@PACKAGE_VERSION@ noinst_DATA = sourceforge/howto_release_rmol.html.in EXTRA_DIST = $(noinst_DATA) @@ -28,6 +28,7 @@ $(doc_local_sources) $(html_local_sources) \ $(doc_tutorial_sources) $(cpp_tutorial_sources) \ $(service_h_sources) $(service_cc_sources) \ + $(batches_h_sources) $(batches_cc_sources) \ $(bas_h_sources) $(bas_cc_sources) \ $(fld_h_sources) $(fld_cc_sources) \ $(bom_h_sources) $(bom_cc_sources) \ Modified: trunk/rmol/po/POTFILES.in =================================================================== --- trunk/rmol/po/POTFILES.in 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/po/POTFILES.in 2009-05-25 11:42:09 UTC (rev 216) @@ -1,82 +1,91 @@ # List of files which contain translatable strings. +rmol/field/FldAbstract.hpp +rmol/field/FldOverbookingPolicy.cpp +rmol/field/FldOverbookingPolicy.hpp +rmol/field/FldDistributionParameters.cpp +rmol/field/FldDistributionParameters.hpp +rmol/field/FldYieldRange.hpp +rmol/field/FldYieldRange.cpp +rmol/field/FldAbstract.cpp +rmol/config/rmol-paths.hpp +rmol/RMOL_Service.hpp +rmol/batches/rmol.cpp +rmol/service/Logger.hpp +rmol/service/RMOL_ServiceContext.hpp +rmol/service/ServiceAbstract.cpp rmol/service/RMOL_Service.cpp +rmol/service/ServiceAbstract.hpp rmol/service/RMOL_ServiceContext.cpp rmol/service/Logger.cpp -rmol/service/ServiceAbstract.hpp -rmol/service/ServiceAbstract.cpp -rmol/service/RMOL_ServiceContext.hpp -rmol/service/Logger.hpp -rmol/RMOL_Types.hpp -rmol/RMOL_Service.hpp -rmol/field/FldYieldRange.hpp -rmol/field/FldOverbookingPolicy.hpp -rmol/field/FldAbstract.cpp -rmol/field/FldYieldRange.cpp -rmol/field/FldAbstract.hpp -rmol/field/FldDistributionParameters.hpp -rmol/field/FldOverbookingPolicy.cpp -rmol/field/FldDistributionParameters.cpp -rmol/factory/FacBucket.hpp -rmol/factory/FacOverbooking.cpp -rmol/factory/FacPartialSumHolder.hpp -rmol/factory/FacServiceAbstract.hpp -rmol/factory/FacOverbooking.hpp -rmol/factory/FacSupervisor.cpp -rmol/factory/FacDemand.hpp -rmol/factory/FacPartialSumHolderHolder.cpp -rmol/factory/FacBucketHolder.cpp -rmol/factory/FacBomAbstract.hpp -rmol/factory/FacRmolServiceContext.hpp -rmol/factory/FacServiceAbstract.cpp -rmol/factory/FacDemand.cpp -rmol/factory/FacBucketHolder.hpp -rmol/factory/FacRmolServiceContext.cpp -rmol/factory/FacBomAbstract.cpp -rmol/factory/FacPartialSumHolderHolder.hpp -rmol/factory/FacPartialSumHolder.cpp -rmol/factory/FacSupervisor.hpp -rmol/factory/FacBucket.cpp -rmol/basic/BasConst_RMOL_Service.hpp -rmol/basic/BasConst.cpp -rmol/basic/BasConst_Overbooking.hpp -rmol/basic/BasConst_General.hpp -rmol/bom/Resource.hpp -rmol/bom/BucketList.hpp rmol/bom/PartialSumHolder.cpp -rmol/bom/PartialSumHolderList.hpp -rmol/bom/Demand.hpp -rmol/bom/VariateList.hpp -rmol/bom/EmsrUtils.hpp -rmol/bom/BomAbstract.hpp +rmol/bom/MAForecast.cpp rmol/bom/MCOptimiser.cpp -rmol/bom/Demand.cpp -rmol/bom/Emsr.cpp -rmol/bom/Bucket.hpp -rmol/bom/Gaussian.cpp -rmol/bom/Bucket.cpp +rmol/bom/StatAggregatorStruct.cpp +rmol/bom/MAForecast.hpp rmol/bom/EmsrUtils.cpp -rmol/bom/DPOptimiser.hpp -rmol/bom/Emsr.hpp rmol/bom/BomAbstract.cpp -rmol/bom/MAForecast.cpp +rmol/bom/StudyStatManager.hpp +rmol/bom/Bucket.cpp +rmol/bom/old/DemandGeneratorList.cpp rmol/bom/old/DemandGeneratorList.hpp -rmol/bom/old/DemandGeneratorList.cpp -rmol/bom/MCOptimiser.hpp -rmol/bom/PartialSumHolder.hpp -rmol/bom/MAForecast.hpp -rmol/bom/PartialSumHolderHolder.hpp +rmol/bom/Emsr.hpp +rmol/bom/BucketList.hpp +rmol/bom/StatAggregatorStructList.hpp +rmol/bom/Bucket.hpp +rmol/bom/DPOptimiser.hpp +rmol/bom/BomAbstract.hpp +rmol/bom/Overbooking.hpp +rmol/bom/StudyStatManager.cpp +rmol/bom/PartialSumHolderList.hpp rmol/bom/PartialSumList.hpp -rmol/bom/DPOptimiser.cpp -rmol/bom/Overbooking.hpp -rmol/bom/BucketHolder.hpp rmol/bom/Overbooking.cpp +rmol/bom/EmsrUtils.hpp +rmol/bom/Demand.hpp +rmol/bom/Demand.cpp +rmol/bom/BucketHolder.cpp rmol/bom/PartialSumHolderHolder.cpp -rmol/bom/BucketHolder.cpp +rmol/bom/Gaussian.cpp rmol/bom/DistributionParameterList.hpp +rmol/bom/DPOptimiser.cpp +rmol/bom/Emsr.cpp +rmol/bom/PartialSumHolder.hpp +rmol/bom/Resource.hpp +rmol/bom/BucketHolder.hpp +rmol/bom/VariateList.hpp rmol/bom/Gaussian.hpp -rmol/config/rmol-paths.hpp -rmol/batches/rmol.cpp +rmol/bom/PartialSumHolderHolder.hpp +rmol/bom/StatAggregatorStruct.hpp +rmol/bom/MCOptimiser.hpp rmol/command/Optimiser.hpp rmol/command/Optimiser.cpp +rmol/command/FileMgr.cpp rmol/command/FileMgr.hpp -rmol/command/FileMgr.cpp +rmol/factory/FacSupervisor.hpp +rmol/factory/FacStudyStatManager.cpp +rmol/factory/FacBomAbstract.cpp +rmol/factory/FacPartialSumHolder.hpp +rmol/factory/FacPartialSumHolderHolder.cpp +rmol/factory/FacBucket.hpp +rmol/factory/FacSupervisor.cpp +rmol/factory/FacPartialSumHolderHolder.hpp +rmol/factory/FacBucketHolder.cpp +rmol/factory/FacBucket.cpp +rmol/factory/FacOverbooking.hpp +rmol/factory/FacBomAbstract.hpp +rmol/factory/FacDemand.hpp +rmol/factory/FacOverbooking.cpp +rmol/factory/FacDemand.cpp +rmol/factory/FacStudyStatManager.hpp +rmol/factory/FacRmolServiceContext.hpp +rmol/factory/FacServiceAbstract.cpp +rmol/factory/FacServiceAbstract.hpp +rmol/factory/FacBucketHolder.hpp +rmol/factory/FacPartialSumHolder.cpp +rmol/factory/FacRmolServiceContext.cpp +rmol/basic/BasChronometer.hpp +rmol/basic/BasConst_RMOL_Service.hpp +rmol/basic/BasConst_Overbooking.hpp +rmol/basic/BasConst.cpp +rmol/basic/BasChronometer.cpp +rmol/basic/BasConst_General.hpp +rmol/RMOL_Types.hpp Modified: trunk/rmol/rmol/bom/DPOptimiser.cpp =================================================================== --- trunk/rmol/rmol/bom/DPOptimiser.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/bom/DPOptimiser.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -7,14 +7,15 @@ // C #include <assert.h> // STL -#include <iostream> +#include <sstream> +#include <vector> #include <cmath> -#include <vector> // 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 { @@ -89,7 +90,7 @@ // the memo of Jerome Contant). const double power1 = - 0.5 * meanDemand * meanDemand / (SDDemand * SDDemand); - const double e1 = exp (power1); + const double e1 = std::exp (power1); const double power2 = - 0.5 * (lowerBound / DEFAULT_PRECISION - meanDemand) * (lowerBound / DEFAULT_PRECISION - meanDemand) / @@ -141,7 +142,7 @@ currentYield * lowerBound / DEFAULT_PRECISION + MERVectorHolder.at(currentBucketIndex-1).at(currentProtection); const double secondElement = constCoefOfSecondElement * - //gsl_cdf_gaussian_Q(lowerBound / DEFAULT_PRECISION - meanDemand, SDDemand); + //gsl_cdf_gaussian_Q(lowerBound / DEFAULT_PRECISION - meanDemand, SDDemand); cdfGaussianQ (lowerBound / DEFAULT_PRECISION - meanDemand, SDDemand); const double MERValue = (firstElement + secondElement) / errorFactor; @@ -154,31 +155,35 @@ //assert (currentGradient >= 0); if (currentGradient < -0) { - std::cout << currentGradient << std::endl - << "x = " << x << std::endl - << "class: " << currentBucketIndex << std::endl; + std::ostringstream ostr; + ostr << currentGradient << std::endl + << "x = " << x << std::endl + << "class: " << currentBucketIndex << std::endl; + RMOL_LOG_DEBUG (ostr.str()); } /* assert (currentGradient <= testGradient); testGradient = currentGradient; */ - if (!protectionChanged && currentGradient <= nextYield) { + if (protectionChanged == false && currentGradient <= nextYield) { nextProtection = x - 1; protectionChanged = true; } - if (protectionChanged && currentGradient > nextYield) { + if (protectionChanged == true && currentGradient > nextYield) { protectionChanged = false; } - if (!protectionChanged && x == maxValue) { + if (protectionChanged == false && x == maxValue) { nextProtection = maxValue; } currentMERVector.push_back (MERValue); } - std::cout << "Vmaxindex = " << currentMERVector.back() << std::endl; + + // DEBUG + RMOL_LOG_DEBUG ("Vmaxindex = " << currentMERVector.back()); MERVectorHolder.push_back (currentMERVector); @@ -193,20 +198,21 @@ ioBucketHolder.iterate(); ++currentBucketIndex; } - } // //////////////////////////////////////////////////////////////////// double DPOptimiser::cdfGaussianQ (const double c, const double sd) { const double power = - c * c * 0.625 / (sd * sd); - const double e = sqrt (1-exp(power)); - double result; + const double e = std::sqrt (1 - std::exp (power)); + double result = 0.0; + if (c >= 0) { result = 0.5 * (1 - e); - } - else { + + } else { result = 0.5 * (1 + e); } + return result; } Modified: trunk/rmol/rmol/bom/MCOptimiser.cpp =================================================================== --- trunk/rmol/rmol/bom/MCOptimiser.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/bom/MCOptimiser.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -6,7 +6,7 @@ // STL #include <string> #include <fstream> -#include <iostream> +#include <sstream> #include <cmath> // RMOL #include <rmol/basic/BasChronometer.hpp> @@ -19,6 +19,7 @@ #include <rmol/bom/PartialSumHolderHolder.hpp> //#include <rmol/bom/Resource.hpp> #include <rmol/bom/MCOptimiser.hpp> +#include <rmol/service/Logger.hpp> namespace RMOL { @@ -77,9 +78,9 @@ const Gaussian gaussianDemandGenerator (aDistribParams); /** DEBUG - std::cout << "[" << j << "]: " << Kj << " values with N ( " + RMOL_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( " << aDistribParams.getMean() << ", " - << aDistribParams.getStandardDeviation() << ")." << std::endl; + << aDistribParams.getStandardDeviation() << ")."); */ /** @@ -112,9 +113,9 @@ currentPartialSumList.addPartialSum (sjk); /* DEBUG - std::cout << "d(" << j << ", " << k << "); " << djk + RMOL_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk << "; S'(" << j-1 << ", " << lj+k << "); " << spjm1lpk - << "; S(" << j << ", " << k << "); " << sjk << std::endl; + << "; S(" << j << ", " << k << "); " << sjk); */ } @@ -140,9 +141,8 @@ lj = static_cast<int> (ljdouble); /** DEBUG - std::cout << "p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj - << ", Kj = " << Kj << " => " << Kj - lj << " points above y(j)" - << std::endl; + RMOL_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj + << ", Kj = " << Kj << " => " << Kj - lj << " points above y(j)"); */ /** Consistency check. */ @@ -157,8 +157,8 @@ const double yj = (sjl + sjlp1) / 2; /** DEBUG - std::cout << "S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1 - << ", y(j) = " << yj << std::endl; + RMOL_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1 + << ", y(j) = " << yj); */ // Set the cumulated protection for Bucket(j) (j ranging from 1 to n-1) @@ -307,9 +307,9 @@ const Gaussian gaussianDemandGenerator (aDistribParams); /** DEBUG - std::cout << "[" << j << "]: " << Kj << " values with N ( " + RMOL_LOG_DEBUG ("[" << j << "]: " << Kj << " values with N ( " << aDistribParams.getMean() << ", " - << aDistribParams.getStandardDeviation() << ")." << std::endl; + << aDistribParams.getStandardDeviation() << ")."); */ /** @@ -343,9 +343,9 @@ currentPartialSumList.addPartialSum (sjk); /* DEBUG - std::cout << "d(" << j << ", " << k << "); " << djk + RMOL_LOG_DEBUG ("d(" << j << ", " << k << "); " << djk << "; S'(" << j-1 << ", " << lj+k << "); " << spjm1lpk - << "; S(" << j << ", " << k << "); " << sjk << std::endl; + << "; S(" << j << ", " << k << "); " << sjk); */ } @@ -377,9 +377,8 @@ lj = static_cast<int> (ljdouble); /** DEBUG - std::cout << "p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj - << ", Kj = " << Kj << " => " << Kj - lj << " points above y(j)" - << std::endl; + RMOL_LOG_DEBUG ("p(j+1)/p(j) = " << pj1 / pj << ", lj = " << lj + << ", Kj = " << Kj << " => " << Kj - lj << " points above y(j)"); */ /** Consistency check. */ @@ -394,8 +393,8 @@ const double yj = (sjl + sjlp1) / 2; /** DEBUG - std::cout << "S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1 - << ", y(j) = " << yj << std::endl; + RMOL_LOG_DEBUG ("S(j,l) = " << sjl << ", S(j,l+1) = " << sjlp1 + << ", y(j) = " << yj); */ // Set the cumulated protection for Bucket(j) (j ranging from 1 to n-1) Modified: trunk/rmol/rmol/bom/StatAggregatorStruct.cpp =================================================================== --- trunk/rmol/rmol/bom/StatAggregatorStruct.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/bom/StatAggregatorStruct.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -4,11 +4,12 @@ // C #include <assert.h> // STL +#include <sstream> #include <limits> #include <stdexcept> // RMOL +#include <rmol/bom/StatAggregatorStruct.hpp> #include <rmol/service/Logger.hpp> -#include <rmol/bom/StatAggregatorStruct.hpp> namespace RMOL { @@ -61,11 +62,11 @@ // ////////////////////////////////////////////////////////////////////// void StatAggregatorStruct_T::display() const { - std::cout << describe() << std::endl; + RMOL_LOG_DEBUG (describe()); } // ////////////////////////////////////////////////////////////////////// - void StatAggregatorStruct_T::addMeasure(const double iMeasure) { + void StatAggregatorStruct_T::addMeasure (const double iMeasure) { // Set a new minimal value if the measure is lower than the minimum if (iMeasure < _minimal) { _minimal = iMeasure; Modified: trunk/rmol/rmol/bom/StatAggregatorStruct.hpp =================================================================== --- trunk/rmol/rmol/bom/StatAggregatorStruct.hpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/bom/StatAggregatorStruct.hpp 2009-05-25 11:42:09 UTC (rev 216) @@ -5,7 +5,6 @@ // Import section // ////////////////////////////////////////////////////////////////////// // STL -#include <iostream> #include <string> namespace RMOL { Modified: trunk/rmol/rmol/bom/StudyStatManager.cpp =================================================================== --- trunk/rmol/rmol/bom/StudyStatManager.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/bom/StudyStatManager.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -4,6 +4,7 @@ // C #include <assert.h> // STL +#include <sstream> #include <limits> // RMOL Common #include <rmol/service/Logger.hpp> @@ -40,8 +41,10 @@ // ////////////////////////////////////////////////////////////////////// void StudyStatManager::display() const { - // Store current formatting flags of std::cout - std::ios::fmtflags oldFlags = std::cout.flags(); + // DEBUG + std::ostringstream ostr; + // Store current formatting flags of the stream + std::ios::fmtflags oldFlags = ostr.flags(); for (StatAggregatorStructList_T::const_iterator itStatAggregatorStruct = _statAggregatorStructList.begin(); @@ -50,11 +53,13 @@ const StatAggregatorStruct_T& lStatAggregatorStruct = itStatAggregatorStruct->second; - std::cout << lStatAggregatorStruct.describeCurrentSimu() << std::endl; + ostr << lStatAggregatorStruct.describeCurrentSimu() << std::endl; } - // Reset formatting flags of std::cout - std::cout.flags (oldFlags); + // Reset formatting flags of stream + ostr.flags (oldFlags); + + RMOL_LOG_DEBUG (ostr.str()); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/rmol/rmol/command/Optimiser.cpp =================================================================== --- trunk/rmol/rmol/command/Optimiser.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/command/Optimiser.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -4,24 +4,25 @@ // C #include <assert.h> // STL -#include <iostream> -#include <cmath> +//#include <cmath> +#include <sstream> #include <iomanip> // RMOL #include <rmol/basic/BasChronometer.hpp> +#include <rmol/field/FldYieldRange.hpp> +#include <rmol/field/FldDistributionParameters.hpp> #include <rmol/bom/StudyStatManager.hpp> #include <rmol/bom/BucketHolder.hpp> //#include <rmol/bom/Resource.hpp> #include <rmol/bom/MCOptimiser.hpp> #include <rmol/bom/Emsr.hpp> #include <rmol/bom/DPOptimiser.hpp> -#include <rmol/field/FldYieldRange.hpp> -#include <rmol/field/FldDistributionParameters.hpp> #include <rmol/factory/FacPartialSumHolder.hpp> #include <rmol/factory/FacPartialSumHolderHolder.hpp> #include <rmol/factory/FacDemand.hpp> #include <rmol/factory/FacBucket.hpp> #include <rmol/command/Optimiser.hpp> +#include <rmol/service/Logger.hpp> namespace RMOL { @@ -114,14 +115,26 @@ DPOptimiser::optimalOptimisationByDP (iCabinCapacity, ioBucketHolder, lBidPriceVector); - std::cout << "BVP: "; - unsigned int size = lBidPriceVector.size(); - for (unsigned int i = 0; i < size; ++i) { - const double bidPrice = lBidPriceVector.at(i); - std::cout << std::fixed << std::setprecision (2) << bidPrice << " "; + // DEBUG + std::ostringstream ostr; + // Store current formatting flags of the stream + std::ios::fmtflags oldFlags = ostr.flags(); + + ostr << "BPV: " << std::fixed << std::setprecision (2); + + unsigned int i = 0; + + for (BidPriceVector_T::const_iterator itBP = lBidPriceVector.begin(); + itBP != lBidPriceVector.end(); ++itBP, ++i) { + const double bidPrice = *itBP; + ostr << "[" << i << "]: " << bidPrice << ", "; } - std::cout << std::endl; + + // Reset formatting flags of stream + ostr.flags (oldFlags); + + RMOL_LOG_DEBUG (ostr.str()); } // ////////////////////////////////////////////////////////////////////// Modified: trunk/rmol/rmol/service/Logger.cpp =================================================================== --- trunk/rmol/rmol/service/Logger.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/service/Logger.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -3,6 +3,8 @@ // ////////////////////////////////////////////////////////////////////// // C #include <assert.h> +// STL +#include <iostream> // Rmol Logger #include <rmol/factory/FacSupervisor.hpp> #include <rmol/service/Logger.hpp> Modified: trunk/rmol/rmol/service/Logger.hpp =================================================================== --- trunk/rmol/rmol/service/Logger.hpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/rmol/service/Logger.hpp 2009-05-25 11:42:09 UTC (rev 216) @@ -7,7 +7,6 @@ // C #include <assert.h> // STL -#include <iostream> #include <sstream> #include <string> // RMOL Modified: trunk/rmol/test/OptimiseTestSuite.cpp =================================================================== --- trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-25 11:42:09 UTC (rev 216) @@ -1,5 +1,5 @@ // STL -#include <iostream> +#include <fstream> #include <string> // CPPUNIT #include <test/com/CppUnitCore.hpp> @@ -108,13 +108,40 @@ } } + // ////////////////////////////////////////////////////////////////////// -void OptimiseTestSuite::testOptimise() { +// 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() { CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(3);); +} + +// ////////////////////////////////////////////////////////////////////// +// EMSR-b +void OptimiseTestSuite::testOptimiseEMSRb() { CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(4);); +} + +// ////////////////////////////////////////////////////////////////////// +// EMSR-a with sell-up +void OptimiseTestSuite::testOptimiseEMSRaWithSU() { CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(5);); } Modified: trunk/rmol/test/OptimiseTestSuite.hpp =================================================================== --- trunk/rmol/test/OptimiseTestSuite.hpp 2009-05-22 15:39:07 UTC (rev 215) +++ trunk/rmol/test/OptimiseTestSuite.hpp 2009-05-25 11:42:09 UTC (rev 216) @@ -5,14 +5,38 @@ class OptimiseTestSuite : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE (OptimiseTestSuite); - CPPUNIT_TEST (testOptimise); + 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 Optimisation functionality. */ - void testOptimise (); + /** 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 (); @@ -22,4 +46,5 @@ protected: std::stringstream _describeKey; }; + CPPUNIT_TEST_SUITE_REGISTRATION (OptimiseTestSuite); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dk...@us...> - 2009-05-22 15:39:18
|
Revision: 215 http://rmol.svn.sourceforge.net/rmol/?rev=215&view=rev Author: dkchoe Date: 2009-05-22 15:39:07 +0000 (Fri, 22 May 2009) Log Message: ----------- 1. Prepared a unit test for EMSR-a with sell up probability algorithm, the flow of the algorithm still to be tested against a number 2. TestSuite is updated so that all implemented optimization algorithms are sequentially tested Modified Paths: -------------- trunk/rmol/test/OptimiseTestSuite.cpp Modified: trunk/rmol/test/OptimiseTestSuite.cpp =================================================================== --- trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-11 06:28:02 UTC (rev 214) +++ trunk/rmol/test/OptimiseTestSuite.cpp 2009-05-22 15:39:07 UTC (rev 215) @@ -5,11 +5,12 @@ #include <test/com/CppUnitCore.hpp> // RMOL #include <rmol/RMOL_Service.hpp> +#include <rmol/RMOL_Types.hpp> // RMOL Test Suite #include <test/OptimiseTestSuite.hpp> // ////////////////////////////////////////////////////////////////////// -void testOptimiseHelper() { +void testOptimiseHelper(const unsigned short optimisationMethodFlag) { try { @@ -20,14 +21,14 @@ const int K = 100000; // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, - // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b) - const short METHOD_FLAG = 0; + // 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 std::string inputFileName ("../samples/sample2.csv"); const bool hasInputFile = true; // Set the log parameters @@ -82,6 +83,20 @@ rmolService.heuristicOptimisationByEmsrB (); break; + case 5 : // Calculate the protection by EMSR-a with sellup + { + std::vector<double> sampleVector; + double sampleProbability = 0.2; + // NOTE: size of sellup vector should be equal to no of buckets + short nbOfSampleBucket = 4; + for (short i = 1; i <= nbOfSampleBucket - 1; i++) + sampleVector.push_back(sampleProbability); + RMOL::SellupProbabilityVector_T& sellupProbabilityVector + = sampleVector; + rmolService.heuristicOptimisationByEmsrAwithSellup (sellupProbabilityVector); + break; + } + default : rmolService.optimalOptimisationByMCIntegration (K); } @@ -95,7 +110,12 @@ // ////////////////////////////////////////////////////////////////////// void OptimiseTestSuite::testOptimise() { - CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper();); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(0);); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(1);); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(2);); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(3);); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(4);); + CPPUNIT_ASSERT_NO_THROW (testOptimiseHelper(5);); } // ////////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-11 06:28:12
|
Revision: 214 http://rmol.svn.sourceforge.net/rmol/?rev=214&view=rev Author: denis_arnaud Date: 2009-05-11 06:28:02 +0000 (Mon, 11 May 2009) Log Message: ----------- [Packaging] New working version. Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/rmol.spec.in Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-10 01:28:56 UTC (rev 213) +++ trunk/rmol/configure.ac 2009-05-11 06:28:02 UTC (rev 214) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2009 Denis Arnaud <den...@us...>]) -AC_INIT([RMOL],[0.21.0],[den...@us...],[rmol]) +AC_INIT([RMOL],[0.22.0],[den...@us...],[rmol]) AC_CONFIG_HEADER([rmol/config.h]) AC_CONFIG_SRCDIR([rmol/basic/BasConst.cpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,11 +11,11 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # RPM release number -RPM_RELEASE="3" +RPM_RELEASE="1" AC_SUBST(RPM_RELEASE) # Shared library versioning -GENERIC_LIBRARY_VERSION="0:21:0" +GENERIC_LIBRARY_VERSION="0:22:0" # | | | # +------+ | +---+ # | | | Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-10 01:28:56 UTC (rev 213) +++ trunk/rmol/rmol.spec.in 2009-05-11 06:28:02 UTC (rev 214) @@ -129,6 +129,9 @@ %changelog +* Mon May 11 2009 Denis Arnaud <den...@m4...> 0.22.0-1 +- Upstream integration + * Sun May 10 2009 Denis Arnaud <den...@m4...> 0.21.0-3 - Removed dependencies on specific versions (for EL 5) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-10 01:28:57
|
Revision: 213 http://rmol.svn.sourceforge.net/rmol/?rev=213&view=rev Author: denis_arnaud Date: 2009-05-10 01:28:56 +0000 (Sun, 10 May 2009) Log Message: ----------- [Packaging] Removed dependencies on explicit versions of Boost (for EL 5). Now works on all distributions. Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/rmol.spec.in Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-06 16:46:02 UTC (rev 212) +++ trunk/rmol/configure.ac 2009-05-10 01:28:56 UTC (rev 213) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # RPM release number -RPM_RELEASE="1" +RPM_RELEASE="3" AC_SUBST(RPM_RELEASE) # Shared library versioning Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-06 16:46:02 UTC (rev 212) +++ trunk/rmol/rmol.spec.in 2009-05-10 01:28:56 UTC (rev 213) @@ -13,10 +13,9 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: gsl-devel >= 1.8 -BuildRequires: boost-devel >= 1.34 -BuildRequires: cppunit-devel >= 1.10 -BuildRequires: libicu +BuildRequires: gsl-devel +BuildRequires: boost-devel +BuildRequires: cppunit-devel #Requires: %description @@ -50,8 +49,14 @@ %package doc Summary: HTML documentation for the @PACKAGE_NAME@ library Group: Documentation +%if 0%{?fedora} >= 10 BuildArch: noarch -BuildRequires: doxygen, texlive-latex, texlive-dvips, ghostscript +BuildRequires: texlive-latex, texlive-dvips +%endif +%if 0%{?fedora} < 10 +BuildRequires: tetex-latex, tetex-dvips +%endif +BuildRequires: doxygen, ghostscript %description doc This package contains the documentation in the HTML format of the @PACKAGE_NAME@ @@ -124,6 +129,12 @@ %changelog +* Sun May 10 2009 Denis Arnaud <den...@m4...> 0.21.0-3 +- Removed dependencies on specific versions (for EL 5) + +* Sat May 09 2009 Denis Arnaud <den...@m4...> 0.21.0-2 +- Removed dependencies on specific versions (for EL 5) + * Mon May 04 2009 Denis Arnaud <den...@m4...> 0.21.0-1 - Upstream integration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dk...@us...> - 2009-05-06 16:46:17
|
Revision: 212 http://rmol.svn.sourceforge.net/rmol/?rev=212&view=rev Author: dkchoe Date: 2009-05-06 16:46:02 +0000 (Wed, 06 May 2009) Log Message: ----------- Implemented EMSR-a with sell-up algorithm (Annie's first contribution to RMOL :) ) Modified Paths: -------------- trunk/rmol/rmol/RMOL_Service.hpp trunk/rmol/rmol/RMOL_Types.hpp trunk/rmol/rmol/basic/BasConst.cpp trunk/rmol/rmol/basic/BasConst_General.hpp trunk/rmol/rmol/bom/Emsr.cpp trunk/rmol/rmol/bom/Emsr.hpp trunk/rmol/rmol/bom/EmsrUtils.cpp trunk/rmol/rmol/bom/EmsrUtils.hpp trunk/rmol/rmol/command/Optimiser.cpp trunk/rmol/rmol/command/Optimiser.hpp trunk/rmol/rmol/service/RMOL_Service.cpp Modified: trunk/rmol/rmol/RMOL_Service.hpp =================================================================== --- trunk/rmol/rmol/RMOL_Service.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/RMOL_Service.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -62,6 +62,15 @@ /** Single resource optimization that uses EMSR-a heuristic and returns a vector of cumulated booking limits. */ void heuristicOptimisationByEmsrA (BidPriceVector_T&, BookingLimitVector_T&); + + /** Single resource optimization with sellup using EMSR-a heuristic. */ + void heuristicOptimisationByEmsrAwithSellup (SellupProbabilityVector_T&); + + /** Single resource optimization with sellup that uses EMSR-a heuristic and + returns a vector of cumulated booking limits. */ + void heuristicOptimisationByEmsrAwithSellup (SellupProbabilityVector_T&, + BidPriceVector_T&, + BookingLimitVector_T&); /** Single resource optimization using EMSR-b heuristic. */ void heuristicOptimisationByEmsrB (); Modified: trunk/rmol/rmol/RMOL_Types.hpp =================================================================== --- trunk/rmol/rmol/RMOL_Types.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/RMOL_Types.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -64,5 +64,7 @@ <br> It is a vector of double. */ typedef std::vector<double> BookingLimitVector_T; + /** Define the sellup probability vector applicable to EMSR*/ + typedef std::vector<double> SellupProbabilityVector_T; } #endif // __RMOL_RMOL_TYPES_HPP Modified: trunk/rmol/rmol/basic/BasConst.cpp =================================================================== --- trunk/rmol/rmol/basic/BasConst.cpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/basic/BasConst.cpp 2009-05-06 16:46:02 UTC (rev 212) @@ -15,6 +15,9 @@ the Dynamic Programming algorithm (100 means that the precision will be 0.01). */ const int DEFAULT_PRECISION = 10; + + /** Default epsilon value to qualify a denominator */ + const double DEFAULT_EPSILON = 0.0001; /** Default value for the load factor used for overbooking calculation. */ const double DEFAULT_OVERBOOKING_LOAD_FACTOR = 0.0; Modified: trunk/rmol/rmol/basic/BasConst_General.hpp =================================================================== --- trunk/rmol/rmol/basic/BasConst_General.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/basic/BasConst_General.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -14,5 +14,8 @@ /** Default value for the precision of the integral computation in the Dynamic Programming algorithm. */ extern const int DEFAULT_PRECISION; + + /** Default epsilon value to qualify a denominator */ + extern const double DEFAULT_EPSILON; } #endif // __RMOL_BAS_BASCONST_GENERAL_HPP Modified: trunk/rmol/rmol/bom/Emsr.cpp =================================================================== --- trunk/rmol/rmol/bom/Emsr.cpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/bom/Emsr.cpp 2009-05-06 16:46:02 UTC (rev 212) @@ -122,6 +122,64 @@ } // ////////////////////////////////////////////////////////////////// + void Emsr::heuristicOptimisationByEmsrAwithSellup + (const ResourceCapacity_T iCabinCapacity, + BucketHolder& ioBucketHolder, + SellupProbabilityVector_T& iSellupProbabilityVector){ + + // Number of classes/Buckets: n + const short nbOfBuckets = ioBucketHolder.getSize(); + + // Set the booking limit of the highest class to the cabin capacity + ioBucketHolder.begin(); + Bucket& highestBucket = ioBucketHolder.getCurrentBucket(); + highestBucket.setCumulatedBookingLimit (iCabinCapacity); + + // Set the booking limit for the rest n-1 classes + // by iterating on the classes/Buckets from 1 to n-1 + for (short j=1; j <= nbOfBuckets-1; j++, ioBucketHolder.iterate()) { + // Get the next class/bucket (the next high fare class) + Bucket& nextBucket = ioBucketHolder.getNextBucket(); + + // Get the probability of sell-up from nextBucket to the next higher + double sellupProbability = iSellupProbabilityVector[j]; + + // Initialize protection level for the current class j + double lProtectionLevel = 0.0; + + // Sum the protection levels for each higher fare class + ioBucketHolder.begin(); + for (short k=1; k<=j; k++) { + Bucket& higherBucket = ioBucketHolder.getCurrentBucket(); + + double lPRotectionLevelAgainstAHigherBucket = 0.0; + + if (k == j) { + lPRotectionLevelAgainstAHigherBucket = + EmsrUtils::computeProtectionLevelwithSellup + (higherBucket, nextBucket, sellupProbability); + } else { + lPRotectionLevelAgainstAHigherBucket = + EmsrUtils::computeProtectionLevel (higherBucket, nextBucket); + ioBucketHolder.iterate(); + } + + lProtectionLevel += lPRotectionLevelAgainstAHigherBucket; + } + + // Set cumulated protection level for class j + Bucket& currentBucket = ioBucketHolder.getCurrentBucket(); + currentBucket.setCumulatedProtection (lProtectionLevel); + + // Compute the booking limit for the class j+1 (can be negative) + const double lBookingLimit = iCabinCapacity - lProtectionLevel; + + // Set the booking limit for class j+1 + nextBucket.setCumulatedBookingLimit (lBookingLimit); + } + } + + // ////////////////////////////////////////////////////////////////// void Emsr:: heuristicOptimisationByEmsrB (const ResourceCapacity_T iCabinCapacity, BucketHolder& ioBucketHolder, Modified: trunk/rmol/rmol/bom/Emsr.hpp =================================================================== --- trunk/rmol/rmol/bom/Emsr.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/bom/Emsr.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -44,6 +44,13 @@ BucketHolder&); /** + Compute the optimal booking limits & protection limits for a set of + buckets/classes + */ + static void heuristicOptimisationByEmsrAwithSellup + (const ResourceCapacity_T, BucketHolder&, SellupProbabilityVector_T&); + + /** Complute the protection levels and booking limites by using the EMSR-b algorithm. Modified: trunk/rmol/rmol/bom/EmsrUtils.cpp =================================================================== --- trunk/rmol/rmol/bom/EmsrUtils.cpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/bom/EmsrUtils.cpp 2009-05-06 16:46:02 UTC (rev 212) @@ -9,6 +9,7 @@ // RMOL #include <rmol/bom/EmsrUtils.hpp> #include <rmol/bom/Bucket.hpp> +#include <rmol/basic/BasConst_General.hpp> namespace RMOL { // //////////////////////////////////////////////////////////////////// @@ -60,6 +61,29 @@ } // //////////////////////////////////////////////////////////////////// + const double EmsrUtils::computeProtectionLevelwithSellup (Bucket& iHigherBucket, + Bucket& iBucket, + double iSellupFactor){ + // Retrieve the mean and the standard deviation of the higher + // class(es)/bucket(s) depending EMSR-a or EMSR-b + // and the average yield of each input classes/buckets + const double lMean = iHigherBucket.getMean(); + const double lSD = iHigherBucket.getStandardDeviation(); + const double lHigherBucketYield = iHigherBucket.getAverageYield(); + const double lBucketYield = iBucket.getAverageYield(); + assert (lHigherBucketYield > DEFAULT_EPSILON); + assert (1-iSellupFactor > DEFAULT_EPSILON); + + // compute the protection level for the higher class/bucket + const double lProtectionLevel = + lMean + + gsl_cdf_gaussian_Pinv((lHigherBucketYield-lBucketYield)/ + lHigherBucketYield*(1-iSellupFactor),lSD); + + return lProtectionLevel; + } + + // //////////////////////////////////////////////////////////////////// const double EmsrUtils::computeEmsrValue (double iCapacity, Bucket& ioBucket) { // Retrive the average yield, mean and standard deviation of the // demand of the class/bucket. Modified: trunk/rmol/rmol/bom/EmsrUtils.hpp =================================================================== --- trunk/rmol/rmol/bom/EmsrUtils.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/bom/EmsrUtils.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -20,6 +20,9 @@ /** Compute the protection level using the Little-Wood formular. */ static const double computeProtectionLevel (Bucket&, Bucket&); + /** Compute the protection level with sell up factor */ + static const double computeProtectionLevelwithSellup (Bucket&, Bucket&, double); + /** Compute the EMSR value of a class/bucket. */ static const double computeEmsrValue (double, Bucket&); }; Modified: trunk/rmol/rmol/command/Optimiser.cpp =================================================================== --- trunk/rmol/rmol/command/Optimiser.cpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/command/Optimiser.cpp 2009-05-06 16:46:02 UTC (rev 212) @@ -157,6 +157,16 @@ } // ////////////////////////////////////////////////////////////////////// + void Optimiser::heuristicOptimisationByEmsrAwithSellup + (const ResourceCapacity_T iCabinCapacity, + BucketHolder& ioBucketHolder, + SellupProbabilityVector_T& iSellupProbabilityVector) { + Emsr::heuristicOptimisationByEmsrAwithSellup (iCabinCapacity, + ioBucketHolder, + iSellupProbabilityVector); + } + + // ////////////////////////////////////////////////////////////////////// void Optimiser:: heuristicOptimisationByEmsrB (const ResourceCapacity_T iCabinCapacity, BucketHolder& ioBucketHolder) { Modified: trunk/rmol/rmol/command/Optimiser.hpp =================================================================== --- trunk/rmol/rmol/command/Optimiser.hpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/command/Optimiser.hpp 2009-05-06 16:46:02 UTC (rev 212) @@ -77,6 +77,16 @@ static void heuristicOptimisationByEmsrA (const ResourceCapacity_T, BucketHolder&); + /** EMSR-a with sellup probability algorithm. + It is an implementation of the algorithm given by + Belobaba & Weatherford in the article + "Comparing decision rules that incorporate customer diversion in + perishable asset revenue management situations", Decision Sciences, + 1996. + */ + static void heuristicOptimisationByEmsrAwithSellup (const ResourceCapacity_T, + BucketHolder&, + SellupProbabilityVector_T&); /** EMRS-b algorithm. <br>The cabin capacity is used to a double to allow for some Modified: trunk/rmol/rmol/service/RMOL_Service.cpp =================================================================== --- trunk/rmol/rmol/service/RMOL_Service.cpp 2009-05-05 11:58:12 UTC (rev 211) +++ trunk/rmol/rmol/service/RMOL_Service.cpp 2009-05-06 16:46:02 UTC (rev 212) @@ -261,6 +261,46 @@ } // ////////////////////////////////////////////////////////////////////// + void RMOL_Service::heuristicOptimisationByEmsrAwithSellup + (SellupProbabilityVector_T& iSellupProbabilityVector) { + + assert (_rmolServiceContext != NULL); + const double iCapacity = _rmolServiceContext->getCapacity(); + BucketHolder* ioBucketHolder_ptr = + _rmolServiceContext->getBucketHolder(); + assert (ioBucketHolder_ptr != NULL); + + Optimiser:: + heuristicOptimisationByEmsrAwithSellup (iCapacity, + *ioBucketHolder_ptr, + iSellupProbabilityVector); + + // DEBUG + RMOL_LOG_DEBUG (ioBucketHolder_ptr->display()); + } + + // ////////////////////////////////////////////////////////////////////// + void RMOL_Service::heuristicOptimisationByEmsrAwithSellup + (SellupProbabilityVector_T& iSellupProbabilityVector, + BidPriceVector_T& ioBidPriceVector, + BookingLimitVector_T& ioBookingLimitVector) { + + assert (_rmolServiceContext != NULL); + const double iCapacity = _rmolServiceContext->getCapacity(); + BucketHolder* ioBucketHolder_ptr = + _rmolServiceContext->getBucketHolder(); + assert (ioBucketHolder_ptr != NULL); + + Optimiser:: + heuristicOptimisationByEmsrAwithSellup (iCapacity, + *ioBucketHolder_ptr, + iSellupProbabilityVector); + + // Fill up booking limit vector + ioBucketHolder_ptr->fillup (ioBookingLimitVector); + } + + // ////////////////////////////////////////////////////////////////////// void RMOL_Service::heuristicOptimisationByEmsrB () { assert (_rmolServiceContext != NULL); const double iCapacity = _rmolServiceContext->getCapacity(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-05 11:58:17
|
Revision: 211 http://rmol.svn.sourceforge.net/rmol/?rev=211&view=rev Author: denis_arnaud Date: 2009-05-05 11:58:12 +0000 (Tue, 05 May 2009) Log Message: ----------- [Conf] Added missing display of CFLAGS in configure script. Modified Paths: -------------- trunk/rmol/configure.ac Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-05 11:35:10 UTC (rev 210) +++ trunk/rmol/configure.ac 2009-05-05 11:58:12 UTC (rev 211) @@ -48,10 +48,14 @@ esac # Checks for programs +save_CFLAGS="$CFLAGS" save_CXXFLAGS="$CXXFLAGS" +save_FFLAGS="$FFLAGS" AC_PROG_CXX AC_PROG_CXXCPP CXXFLAGS="$save_CXXFLAGS" +CFLAGS="$save_CFLAGS" +FFLAGS="$save_FFLAGS" AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_LN_S @@ -97,6 +101,10 @@ # Default compilation flags +if test -z "${CFLAGS}"; then + CFLAGS="-g -Wall" +fi + if test -z "${CXXFLAGS}"; then CXXFLAGS="-g -Wall" fi @@ -340,8 +348,10 @@ Compiler/linker flags/libs/defs: - CXX ............... : ${CXX} + - CFLAGS ............ : ${CFLAGS} - CXXFLAGS .......... : ${CXXFLAGS} - CPPFLAGS .......... : ${CPPFLAGS} + - FFLAGS ............ : ${FFLAGS} - LDFLAGS ........... : ${LDFLAGS} - LIBS .............. : ${LIBS} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-05 11:35:26
|
Revision: 210 http://rmol.svn.sourceforge.net/rmol/?rev=210&view=rev Author: denis_arnaud Date: 2009-05-05 11:35:10 +0000 (Tue, 05 May 2009) Log Message: ----------- [Dev] When the input file cannot be retrieved, the program now exits cleanly. Modified Paths: -------------- trunk/rmol/rmol/command/FileMgr.cpp Modified: trunk/rmol/rmol/command/FileMgr.cpp =================================================================== --- trunk/rmol/rmol/command/FileMgr.cpp 2009-05-05 11:30:29 UTC (rev 209) +++ trunk/rmol/rmol/command/FileMgr.cpp 2009-05-05 11:35:10 UTC (rev 210) @@ -16,6 +16,7 @@ #include <rmol/factory/FacBucket.hpp> #include <rmol/factory/FacBucketHolder.hpp> #include <rmol/command/FileMgr.hpp> +#include <rmol/service/Logger.hpp> namespace RMOL { @@ -26,9 +27,8 @@ // Open the input file std::ifstream inputFile (iInputFileName.c_str()); if (! inputFile) { - std::cerr << "Can not open input file \"" << iInputFileName << "\"" - << std::endl; - return; + RMOL_LOG_ERROR ("Can not open input file \"" << iInputFileName << "\""); + throw new FileNotFoundException(); } char buffer[80]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-05 11:30:42
|
Revision: 209 http://rmol.svn.sourceforge.net/rmol/?rev=209&view=rev Author: denis_arnaud Date: 2009-05-05 11:30:29 +0000 (Tue, 05 May 2009) Log Message: ----------- [Conf] Updated the batch path within test/testLib.sh. Modified Paths: -------------- trunk/rmol/test/testLib.sh Modified: trunk/rmol/test/testLib.sh =================================================================== --- trunk/rmol/test/testLib.sh 2009-05-04 01:10:50 UTC (rev 208) +++ trunk/rmol/test/testLib.sh 2009-05-05 11:30:29 UTC (rev 209) @@ -1,7 +1,7 @@ #!/bin/sh INSTALL_DIR=`grep "^prefix =" ../Makefile | cut -d"=" -d" " -f3` -TST_PROG=../rmol/rmol +TST_PROG=../rmol/batches/rmol RMOL_API_VERSION=`grep "^PACKAGE_VERSION =" ../Makefile | cut -d"=" -d" " -f3` RMOL_LIBRARY_NAME=`grep "^PACKAGE =" ../Makefile | cut -d"=" -d" " -f3` RMOL_LIB=lib${RMOL_LIBRARY_NAME}-${RMOL_API_VERSION}.so This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-04 01:10:55
|
Revision: 208 http://rmol.svn.sourceforge.net/rmol/?rev=208&view=rev Author: denis_arnaud Date: 2009-05-04 01:10:50 +0000 (Mon, 04 May 2009) Log Message: ----------- [Release] New working version (0.21.0). Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/rmol.spec.in Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-04 01:09:01 UTC (rev 207) +++ trunk/rmol/configure.ac 2009-05-04 01:10:50 UTC (rev 208) @@ -2,7 +2,7 @@ #------------------------------------------------------------------- AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (C) 2007-2009 Denis Arnaud <den...@us...>]) -AC_INIT([RMOL],[0.20.0],[den...@us...],[rmol]) +AC_INIT([RMOL],[0.21.0],[den...@us...],[rmol]) AC_CONFIG_HEADER([rmol/config.h]) AC_CONFIG_SRCDIR([rmol/basic/BasConst.cpp]) AC_CONFIG_AUX_DIR([config]) @@ -11,11 +11,11 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # RPM release number -RPM_RELEASE="3" +RPM_RELEASE="1" AC_SUBST(RPM_RELEASE) # Shared library versioning -GENERIC_LIBRARY_VERSION="0:20:0" +GENERIC_LIBRARY_VERSION="0:21:0" # | | | # +------+ | +---+ # | | | Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-04 01:09:01 UTC (rev 207) +++ trunk/rmol/rmol.spec.in 2009-05-04 01:10:50 UTC (rev 208) @@ -124,6 +124,9 @@ %changelog +* Mon May 04 2009 Denis Arnaud <den...@m4...> 0.21.0-1 +- Upstream integration + * Sun May 03 2009 Denis Arnaud <den...@m4...> 0.20.0-3 - Added dependency on libicu for Boost 1.37 (Fedora 11) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-04 01:09:07
|
Revision: 207 http://rmol.svn.sourceforge.net/rmol/?rev=207&view=rev Author: denis_arnaud Date: 2009-05-04 01:09:01 +0000 (Mon, 04 May 2009) Log Message: ----------- [Conf] (Attempted to) fix an issue with Boost-1.37 on Fedora 11 (requiring libicu). Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/rmol/Makefile.am trunk/rmol/rmol/config/Makefile.am trunk/rmol/rmol.spec.in Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-03 23:31:04 UTC (rev 206) +++ trunk/rmol/configure.ac 2009-05-04 01:09:01 UTC (rev 207) @@ -11,7 +11,7 @@ AM_CONDITIONAL([HAVE_CPPUNIT], [test "x$CPPUNIT_LIBS" != x]) # RPM release number -RPM_RELEASE="1" +RPM_RELEASE="3" AC_SUBST(RPM_RELEASE) # Shared library versioning Modified: trunk/rmol/rmol/Makefile.am =================================================================== --- trunk/rmol/rmol/Makefile.am 2009-05-03 23:31:04 UTC (rev 206) +++ trunk/rmol/rmol/Makefile.am 2009-05-04 01:09:01 UTC (rev 207) @@ -12,4 +12,4 @@ # Header files nobase_pkginclude_HEADERS = $(service_h_sources) -nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h +#nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h Modified: trunk/rmol/rmol/config/Makefile.am =================================================================== --- trunk/rmol/rmol/config/Makefile.am 2009-05-03 23:31:04 UTC (rev 206) +++ trunk/rmol/rmol/config/Makefile.am 2009-05-04 01:09:01 UTC (rev 207) @@ -12,8 +12,8 @@ all-local: @PACKAGE@-paths.hpp @PACKAGE@-paths.hpp: Makefile - @echo '#ifndef __OPENTREP_PATHS_HPP' > $@ - @echo '#define __OPENTREP_PATHS_HPP' >> $@ + @echo '#ifndef __@PACKAGE_NAME@_PATHS_HPP' > $@ + @echo '#define __@PACKAGE_NAME@_PATHS_HPP' >> $@ @echo '#define PACKAGE "@PACKAGE@"' >> $@ @echo '#define PACKAGE_NAME "@PACKAGE_NAME@"' >> $@ @echo '#define PACKAGE_VERSION "@VERSION@"' >> $@ @@ -22,4 +22,4 @@ @echo '#define LIBEXECDIR "$(libexecdir)"' >> $@ @echo '#define DATADIR "$(datadir)"' >> $@ @echo '#define DOCDIR "$(docdir)"' >> $@ - @echo '#endif // __OPENTREP_PATHS_HPP' >> $@ + @echo '#endif // __@PACKAGE_NAME@_PATHS_HPP' >> $@ Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-03 23:31:04 UTC (rev 206) +++ trunk/rmol/rmol.spec.in 2009-05-04 01:09:01 UTC (rev 207) @@ -16,6 +16,7 @@ BuildRequires: gsl-devel >= 1.8 BuildRequires: boost-devel >= 1.34 BuildRequires: cppunit-devel >= 1.10 +BuildRequires: libicu #Requires: %description @@ -75,7 +76,7 @@ make install DESTDIR=$RPM_BUILD_ROOT %find_lang %{name} # remove unpackaged files from the buildroot -rm -f $RPM_BUILD_ROOT%{_includedir}/%{name}/config.h +#rm -f $RPM_BUILD_ROOT%{_includedir}/%{name}/config.h rm -f $RPM_BUILD_ROOT%{_infodir}/dir rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{name}.la # chmod 644 doc/html/installdox doc/html/*.png doc/html/*.ico @@ -103,6 +104,8 @@ %{_bindir}/%{name} %{_libdir}/lib*.so.* %{_mandir}/man3/%{name}.3.* +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/samples/*.csv %files devel %defattr(-,root,root,-) @@ -121,6 +124,12 @@ %changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.20.0-3 +- Added dependency on libicu for Boost 1.37 (Fedora 11) + +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.20.0-2 +- Added dependency on libicu-devel for Boost 1.37 (Fedora 11) + * Sun May 03 2009 Denis Arnaud <den...@m4...> 0.20.0-1 - Upstream integration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-03 23:31:09
|
Revision: 206 http://rmol.svn.sourceforge.net/rmol/?rev=206&view=rev Author: denis_arnaud Date: 2009-05-03 23:31:04 +0000 (Sun, 03 May 2009) Log Message: ----------- [R] Fixed the RPM specification files for both R-msm and R-RM2. Modified Paths: -------------- trunk/R/R-RM2.spec trunk/R/R-msm.spec trunk/R/README Modified: trunk/R/R-RM2.spec =================================================================== --- trunk/R/R-RM2.spec 2009-05-03 21:49:12 UTC (rev 205) +++ trunk/R/R-RM2.spec 2009-05-03 23:31:04 UTC (rev 206) @@ -5,11 +5,11 @@ Version: 0.0 Release: 1%{?dist} Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}.tar.gz -License: GPL +License: GPLv3 URL: http://cran.r-project.org/src/contrib Group: Applications/Engineering Summary: Revenue Management and Pricing for R -BuildRequires: R-devel, tetex-latex +BuildRequires: R-devel, tetex-latex, R-msm BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch Requires(post): R @@ -47,19 +47,19 @@ %files %defattr(-, root, root, -) %dir %{_datadir}/R/library/%{packname} -#%%doc %{_datadir}/R/library/%{packname}/latex +%doc %{_datadir}/R/library/%{packname}/latex #%%doc %{_datadir}/R/library/%{packname}/doc -#%%doc %{_datadir}/R/library/%{packname}/html +%doc %{_datadir}/R/library/%{packname}/html %doc %{_datadir}/R/library/%{packname}/man %doc %{_datadir}/R/library/%{packname}/DESCRIPTION #%%doc %{_datadir}/R/library/%{packname}/NEWS -#%%{_datadir}/R/library/%{packname}/CONTENTS -#%%{_datadir}/R/library/%{packname}/INDEX +%{_datadir}/R/library/%{packname}/CONTENTS +%{_datadir}/R/library/%{packname}/INDEX %{_datadir}/R/library/%{packname}/NAMESPACE -#%%{_datadir}/R/library/%{packname}/Meta +%{_datadir}/R/library/%{packname}/Meta %{_datadir}/R/library/%{packname}/R -#%%{_datadir}/R/library/%{packname}/R-ex -#%%{_datadir}/R/library/%{packname}/help +%{_datadir}/R/library/%{packname}/R-ex +%{_datadir}/R/library/%{packname}/help %changelog * Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 Modified: trunk/R/R-msm.spec =================================================================== --- trunk/R/R-msm.spec 2009-05-03 21:49:12 UTC (rev 205) +++ trunk/R/R-msm.spec 2009-05-03 23:31:04 UTC (rev 206) @@ -11,7 +11,6 @@ Summary: Multi-state Markov and hidden Markov models in continuous time BuildRequires: R-devel, tetex-latex, R-mvtnorm BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildArch: noarch Requires(post): R Requires(postun): R Requires: R @@ -26,15 +25,23 @@ %prep %setup -q -c -n %{packname} +# Fix some permissions and formats +# find . -type f -perm 755 -exec chmod 644 {} \; +find . -type f -name '*.[hc]' -exec chmod 644 {} \; +# Fix the encoding of the NEWS file +chmod 644 %{packname}/inst/NEWS +iconv -f ISO88591 -t UTF8 -o NEWS %{packname}/inst/NEWS +mv -f NEWS %{packname}/inst %build %install rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library -%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname} +mkdir -p $RPM_BUILD_ROOT%{_libdir}/R/library +%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_libdir}/R/library %{packname} test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) -rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css +rm -rf $RPM_BUILD_ROOT%{_libdir}/R/library/R.css +# find ./doc -type f -perm 755 -exec chmod 644 {} \; %check %{_bindir}/R CMD check %{packname} @@ -50,21 +57,23 @@ %files %defattr(-, root, root, -) -%dir %{_datadir}/R/library/%{packname} -#%%doc %{_datadir}/R/library/%{packname}/latex -#%%doc %{_datadir}/R/library/%{packname}/doc -#%%doc %{_datadir}/R/library/%{packname}/html -%doc %{_datadir}/R/library/%{packname}/man -%doc %{_datadir}/R/library/%{packname}/DESCRIPTION -#%%doc %{_datadir}/R/library/%{packname}/NEWS -#%%{_datadir}/R/library/%{packname}/CONTENTS -#%%{_datadir}/R/library/%{packname}/INDEX -%{_datadir}/R/library/%{packname}/NAMESPACE -#%%{_datadir}/R/library/%{packname}/Meta -%{_datadir}/R/library/%{packname}/R -#%%{_datadir}/R/library/%{packname}/R-ex -#%%{_datadir}/R/library/%{packname}/help +%dir %{_libdir}/R/library/%{packname} +%doc %{_libdir}/R/library/%{packname}/latex +%doc %{_libdir}/R/library/%{packname}/data +%doc %{_libdir}/R/library/%{packname}/doc +%doc %{_libdir}/R/library/%{packname}/html +%doc %{_libdir}/R/library/%{packname}/man +%doc %{_libdir}/R/library/%{packname}/DESCRIPTION +%doc %{_libdir}/R/library/%{packname}/NEWS +%{_libdir}/R/library/%{packname}/CONTENTS +%{_libdir}/R/library/%{packname}/INDEX +%{_libdir}/R/library/%{packname}/NAMESPACE +%{_libdir}/R/library/%{packname}/Meta +%{_libdir}/R/library/%{packname}/R +%{_libdir}/R/library/%{packname}/R-ex +%{_libdir}/R/library/%{packname}/help +%{_libdir}/R/library/%{packname}/libs/%{packname}.so %changelog -* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.8.2-1 - Initial package creation Modified: trunk/R/README =================================================================== --- trunk/R/README 2009-05-03 21:49:12 UTC (rev 205) +++ trunk/R/README 2009-05-03 23:31:04 UTC (rev 206) @@ -1,9 +1,15 @@ -This directory contains the contribution, for the R platform -(http://www.r-project.org), from Tudor Bodea (tud...@ih...), -Dev Koushik (dev...@ih...) and Mark -Ferguson (mar...@mg...). +This directory contains contributions, for the R platform +(http://www.r-project.org): + 1. msm, from Christopher Jackson <chr...@mr...>. + Web site: http://cran.r-project.org/web/packages/msm/ + Fedora review request: https://bugzilla.redhat.com/show_bug.cgi?id=498845 + 2. RM2, from Tudor Bodea (tud...@ih...), + Dev Koushik (dev...@ih...) and Mark Ferguson + (mar...@mg...). + Web site: http://cran.r-project.org/web/packages/RM2/ + Fedora review request: https://bugzilla.redhat.com/show_bug.cgi?id=498846 -The original documentation and source tar-ball can be retrieved on +The original documentations and source tar-balls can be retrieved on the CRAN-R dedicated site: http://cran.r-project.org/src/contrib. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-03 21:49:20
|
Revision: 205 http://rmol.svn.sourceforge.net/rmol/?rev=205&view=rev Author: denis_arnaud Date: 2009-05-03 21:49:12 +0000 (Sun, 03 May 2009) Log Message: ----------- Moved the R packages into a dedicated project in parallel of RMOL. Added Paths: ----------- trunk/R/ Removed Paths: ------------- trunk/rmol/R/ Property changes on: trunk/R ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-03 21:46:37
|
Revision: 204 http://rmol.svn.sourceforge.net/rmol/?rev=204&view=rev Author: denis_arnaud Date: 2009-05-03 21:46:25 +0000 (Sun, 03 May 2009) Log Message: ----------- 1. Moved the samples directory in a dedicated, installable, directory. 2. Added the R-msm package. Modified Paths: -------------- trunk/rmol/Makefile.am trunk/rmol/configure.ac trunk/rmol/samples/Makefile.am trunk/rmol/samples/sources.mk trunk/rmol/test/Makefile.am Added Paths: ----------- trunk/rmol/R/R-RM2.spec trunk/rmol/R/R-msm.spec trunk/rmol/R/msm/ trunk/rmol/R/msm/ChangeLog trunk/rmol/R/msm/DESCRIPTION trunk/rmol/R/msm/NAMESPACE trunk/rmol/R/msm/R/ trunk/rmol/R/msm/R/boot.R trunk/rmol/R/msm/R/constants.R trunk/rmol/R/msm/R/hmm-dists.R trunk/rmol/R/msm/R/hmm.R trunk/rmol/R/msm/R/msm.R trunk/rmol/R/msm/R/outputs.R trunk/rmol/R/msm/R/pearson.R trunk/rmol/R/msm/R/simul.R trunk/rmol/R/msm/R/utils.R trunk/rmol/R/msm/data/ trunk/rmol/R/msm/data/aneur.txt trunk/rmol/R/msm/data/bos.txt trunk/rmol/R/msm/data/cav.txt trunk/rmol/R/msm/data/fev.txt trunk/rmol/R/msm/data/psor.txt trunk/rmol/R/msm/inst/ trunk/rmol/R/msm/inst/NEWS trunk/rmol/R/msm/inst/doc/ trunk/rmol/R/msm/inst/doc/Rplots.pdf trunk/rmol/R/msm/inst/doc/msm-manual.pdf trunk/rmol/R/msm/man/ trunk/rmol/R/msm/man/MatrixExp.Rd trunk/rmol/R/msm/man/aneur.Rd trunk/rmol/R/msm/man/boot.msm.Rd trunk/rmol/R/msm/man/bos.Rd trunk/rmol/R/msm/man/cav.Rd trunk/rmol/R/msm/man/coef.msm.Rd trunk/rmol/R/msm/man/crudeinits.msm.Rd trunk/rmol/R/msm/man/deltamethod.Rd trunk/rmol/R/msm/man/ematrix.msm.Rd trunk/rmol/R/msm/man/fev.Rd trunk/rmol/R/msm/man/hazard.msm.Rd trunk/rmol/R/msm/man/hmm-dists.Rd trunk/rmol/R/msm/man/logLik.msm.Rd trunk/rmol/R/msm/man/lrtest.msm.Rd trunk/rmol/R/msm/man/medists.Rd trunk/rmol/R/msm/man/msm.Rd trunk/rmol/R/msm/man/odds.msm.Rd trunk/rmol/R/msm/man/pearson.msm.Rd trunk/rmol/R/msm/man/pexp.Rd trunk/rmol/R/msm/man/plot.msm.Rd trunk/rmol/R/msm/man/plot.prevalence.msm.Rd trunk/rmol/R/msm/man/plot.survfit.msm.Rd trunk/rmol/R/msm/man/plotprog.msm.Rd trunk/rmol/R/msm/man/pmatrix.msm.Rd trunk/rmol/R/msm/man/pmatrix.piecewise.msm.Rd trunk/rmol/R/msm/man/prevalence.msm.Rd trunk/rmol/R/msm/man/psor.Rd trunk/rmol/R/msm/man/qmatrix.msm.Rd trunk/rmol/R/msm/man/qratio.msm.Rd trunk/rmol/R/msm/man/scoreresid.msm.Rd trunk/rmol/R/msm/man/sim.msm.Rd trunk/rmol/R/msm/man/simmulti.msm.Rd trunk/rmol/R/msm/man/sojourn.msm.Rd trunk/rmol/R/msm/man/statetable.msm.Rd trunk/rmol/R/msm/man/summary.msm.Rd trunk/rmol/R/msm/man/surface.msm.Rd trunk/rmol/R/msm/man/tnorm.Rd trunk/rmol/R/msm/man/totlos.msm.Rd trunk/rmol/R/msm/man/transient.msm.Rd trunk/rmol/R/msm/man/viterbi.msm.Rd trunk/rmol/R/msm/src/ trunk/rmol/R/msm/src/Makevars trunk/rmol/R/msm/src/analyticp.c trunk/rmol/R/msm/src/doc/ trunk/rmol/R/msm/src/doc/Makefile trunk/rmol/R/msm/src/doc/Sweave-local.sty trunk/rmol/R/msm/src/doc/figures/ trunk/rmol/R/msm/src/doc/figures/general.pdf trunk/rmol/R/msm/src/doc/figures/hidden.pdf trunk/rmol/R/msm/src/doc/figures/illdeath.pdf trunk/rmol/R/msm/src/doc/figures/multistate.pdf trunk/rmol/R/msm/src/doc/figures/p2q1.pdf trunk/rmol/R/msm/src/doc/figures/p2q12.pdf trunk/rmol/R/msm/src/doc/figures/p3q12.pdf trunk/rmol/R/msm/src/doc/figures/p3q124.pdf trunk/rmol/R/msm/src/doc/figures/p3q1246.pdf trunk/rmol/R/msm/src/doc/figures/p3q135.pdf trunk/rmol/R/msm/src/doc/figures/p3q14.pdf trunk/rmol/R/msm/src/doc/figures/p3q16.pdf trunk/rmol/R/msm/src/doc/figures/p4q13569.pdf trunk/rmol/R/msm/src/doc/figures/p4q159.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_4_6_8_11_12_16.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_6_11_16.pdf trunk/rmol/R/msm/src/doc/figures/p5q1_6_7_11_12.pdf trunk/rmol/R/msm/src/doc/figures/sampling.pdf trunk/rmol/R/msm/src/doc/msm-manual.Rnw trunk/rmol/R/msm/src/doc/msm.bib trunk/rmol/R/msm/src/hmm.c trunk/rmol/R/msm/src/hmm.h trunk/rmol/R/msm/src/lik.c trunk/rmol/R/msm/src/msm.h trunk/rmol/R/msm/src/pijt.c trunk/rmol/R/msm/tests/ trunk/rmol/R/msm/tests/analyticp.R trunk/rmol/R/msm/tests/boot.R trunk/rmol/R/msm/tests/debug.dat trunk/rmol/R/msm/tests/deriv-test.R trunk/rmol/R/msm/tests/deriv.R trunk/rmol/R/msm/tests/errors.R trunk/rmol/R/msm/tests/fev.R trunk/rmol/R/msm/tests/herrors.R trunk/rmol/R/msm/tests/hsim.R trunk/rmol/R/msm/tests/local.R trunk/rmol/R/msm/tests/misc.R trunk/rmol/R/msm/tests/miscnew.R trunk/rmol/R/msm/tests/pci.R trunk/rmol/R/msm/tests/pearson.R trunk/rmol/R/msm/tests/sim.R trunk/rmol/R/msm/tests/simple.R trunk/rmol/R/msm/tests/utils.R trunk/rmol/samples/ trunk/rmol/samples/sample1.csv trunk/rmol/samples/sample2.csv trunk/rmol/samples/sample3.csv trunk/rmol/samples/sample4.csv Removed Paths: ------------- trunk/rmol/samples/sample1.csv trunk/rmol/samples/sample2.csv trunk/rmol/samples/sample3.csv trunk/rmol/samples/sample4.csv trunk/rmol/test/samples/ Modified: trunk/rmol/Makefile.am =================================================================== --- trunk/rmol/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) +++ trunk/rmol/Makefile.am 2009-05-03 21:46:25 UTC (rev 204) @@ -25,7 +25,7 @@ EXTRA_DIST = # Build in these directories: -SUBDIRS = rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) $(TEST_DIR) +SUBDIRS = rmol win32 po man $(INFO_DOC_DIR) $(HTML_DOC_DIR) samples $(TEST_DIR) # Configuration helpers Added: trunk/rmol/R/R-RM2.spec =================================================================== --- trunk/rmol/R/R-RM2.spec (rev 0) +++ trunk/rmol/R/R-RM2.spec 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,66 @@ +%global packname RM2 +%global packrel 1 + +Name: R-%{packname} +Version: 0.0 +Release: 1%{?dist} +Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}.tar.gz +License: GPL +URL: http://cran.r-project.org/src/contrib +Group: Applications/Engineering +Summary: Revenue Management and Pricing for R +BuildRequires: R-devel, tetex-latex +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +Requires(post): R +Requires(postun): R +Requires: R + +%description +RM2 is a simple package that implements functions +used in revenue management and pricing environments. + +%prep +%setup -q -c -n %{packname} + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library +%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname} +test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) +rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css + +%check +%{_bindir}/R CMD check %{packname} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%{_R_make_search_index} + +%postun +%{_R_make_search_index} + +%files +%defattr(-, root, root, -) +%dir %{_datadir}/R/library/%{packname} +#%%doc %{_datadir}/R/library/%{packname}/latex +#%%doc %{_datadir}/R/library/%{packname}/doc +#%%doc %{_datadir}/R/library/%{packname}/html +%doc %{_datadir}/R/library/%{packname}/man +%doc %{_datadir}/R/library/%{packname}/DESCRIPTION +#%%doc %{_datadir}/R/library/%{packname}/NEWS +#%%{_datadir}/R/library/%{packname}/CONTENTS +#%%{_datadir}/R/library/%{packname}/INDEX +%{_datadir}/R/library/%{packname}/NAMESPACE +#%%{_datadir}/R/library/%{packname}/Meta +%{_datadir}/R/library/%{packname}/R +#%%{_datadir}/R/library/%{packname}/R-ex +#%%{_datadir}/R/library/%{packname}/help + +%changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 +- Initial package creation Added: trunk/rmol/R/R-msm.spec =================================================================== --- trunk/rmol/R/R-msm.spec (rev 0) +++ trunk/rmol/R/R-msm.spec 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,70 @@ +%global packname msm +%global packrel 1 + +Name: R-%{packname} +Version: 0.8.2 +Release: 1%{?dist} +Source0: ftp://cran.r-project.org/pub/R/contrib/main/%{packname}_%{version}.tar.gz +License: GPLv2 +URL: http://cran.r-project.org/src/contrib +Group: Applications/Engineering +Summary: Multi-state Markov and hidden Markov models in continuous time +BuildRequires: R-devel, tetex-latex, R-mvtnorm +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +Requires(post): R +Requires(postun): R +Requires: R + +%description +Functions for fitting general continuous-time Markov and hidden Markov +multi-state models to longitudinal data. Both Markov transition rates +and the hidden Markov output process can be modelled in terms of +covariates. A variety of observation schemes are supported, including +processes observed at arbitrary times, completely-observed processes, +and censored states. + +%prep +%setup -q -c -n %{packname} + +%build + +%install +rm -rf $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT%{_datadir}/R/library +%{_bindir}/R CMD INSTALL -l $RPM_BUILD_ROOT%{_datadir}/R/library %{packname} +test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so) +rm -rf $RPM_BUILD_ROOT%{_datadir}/R/library/R.css + +%check +%{_bindir}/R CMD check %{packname} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%{_R_make_search_index} + +%postun +%{_R_make_search_index} + +%files +%defattr(-, root, root, -) +%dir %{_datadir}/R/library/%{packname} +#%%doc %{_datadir}/R/library/%{packname}/latex +#%%doc %{_datadir}/R/library/%{packname}/doc +#%%doc %{_datadir}/R/library/%{packname}/html +%doc %{_datadir}/R/library/%{packname}/man +%doc %{_datadir}/R/library/%{packname}/DESCRIPTION +#%%doc %{_datadir}/R/library/%{packname}/NEWS +#%%{_datadir}/R/library/%{packname}/CONTENTS +#%%{_datadir}/R/library/%{packname}/INDEX +%{_datadir}/R/library/%{packname}/NAMESPACE +#%%{_datadir}/R/library/%{packname}/Meta +%{_datadir}/R/library/%{packname}/R +#%%{_datadir}/R/library/%{packname}/R-ex +#%%{_datadir}/R/library/%{packname}/help + +%changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.0-1 +- Initial package creation Added: trunk/rmol/R/msm/ChangeLog =================================================================== --- trunk/rmol/R/msm/ChangeLog (rev 0) +++ trunk/rmol/R/msm/ChangeLog 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,1095 @@ +2009-04-08 Chris Jackson <chr...@mr...> + + * man/msm.Rd: Documentation for qconstraint clarified. + + * R/outputs.R: Bug fix - interactions now expanded properly when + calling extractor functions for models with interactions between + covariates. + + * R/msm.R: Bug fix which affected bootstrap refitting in + pearson.msm, giving "Error in `$<-.data.frame`(`*tmp*`, + "pci.imp"..." + + * DESCRIPTION: Version 0.8.2 released. + +2009-04-03 Chris Jackson <chr...@mr...> + + * LaTeX sources for PDF manual included in src/doc to enable + msm to be approved as a Debian package. + +2008-07-25 Chris Jackson <chr...@mr...> + + * R/pearson.R: Bug fix, maxtimes was producing negative censoring + times. + + * DESCRIPTION: Version 0.8.1 released. + +2008-07-23 Chris Jackson <chr...@mr...> + + * R/msm.R: New option "pci" to msm, which automatically constructs + a model with piecewise-constant transition intensities which + change at the supplied times. + + * R/boot.R: Give an informative error in normal theory CIs when + SEs not available from fitted model. + +2008-07-22 Chris Jackson <chr...@mr...> + + * src/lik.c (GetOutcomeProb): HMM now applies to censored + outcomes, unless obstrue = 1. Thanks to Norm Good for the + suggestion. + +2008-04-15 Chris Jackson <chr...@mr...> + + * R/msm.R: deriv.test argument to msm removed. + + * src/lik.c: Bug fix in liksimple/derivsimple - the P matrix was + not being recalculated when the obstype changed between 1 and 2. + Thanks to Peter Jepsen for uncovering this. + +2008-03-31 Chris Jackson <chr...@mr...> + + * R/outputs.R: totlos.msm now computes total length of stay for + all states, not just transient states. New argument "end" added. + + * R/outputs.R: xlim argument added to plotprog.msm. + + * R/outputs.R: legend added to plot.prevalence.msm. + +2008-03-28 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.8 released. + +2008-03-18 Chris Jackson <chr...@mr...> + + * R/pearson.R: New file for the Pearson-type goodness-of-fit test. + + * data/heart.txt: Data "heart" renamed to "cav". + + * R/simul.R: any() bugs in simmisc.msm for simulating + misclassification models fixed + +2008-03-11 Chris Jackson <chr...@mr...> + + * R/outputs.R: logLik.msm degrees of freedom corrected for models + with parameter constraints. + + * R/outputs.R: New function "plot.survfit.msm" to plot + Kaplan-Meier estimate of survival probabilty compared with the + fitted survival probability from a model. + + * R/outputs.R: Allow customisable axis titles and line widths in + all plot functions. + +2008-03-03 Chris Jackson <chr...@mr...> + + * R/outputs.R: New function "plotprog.msm" to plot Kaplan-Meier + estimates of time to first occurrence of each state. Added + "survfit" and "Surv" imports from the "survival" package. + + * R/outputs.R: New likelihood ratio test function + "lrtest.msm". + +2008-03-03 Chris Jackson <chr...@mr...> + + * R/outputs.R: logLik method returns the log-likelihood, not the + minus log-likelihood. Thanks to Jay Rotella for the report. + +2008-02-27 Chris Jackson <chr...@mr...> + + * R/utils.R: Transformation bug fixed which caused rtnorm to hang + for extreme means. Thanks to Bj\xF6rn Bornkamp. + +2008-02-18 Chris Jackson <chr...@mr...> + + * R/boot.R: Simulate normal CIs using unreplicated parameters, so + that they work with the new release of mvtnorm. Thanks to Peter + Jepsen for the report. + +2007-12-12 Chris Jackson <chr...@mr...> + + * R/msm.R,src/lik.c: Score residuals implemented. + +2007-12-10 Chris Jackson <chr...@mr...> + + * R/utils.R: Quantile functions: uniroot() convergence tolerance + tightened to solve problems with obtaining quantiles for small + arguments. Thanks to Barbara Bredner for the report. + + * DESCRIPTION: Version 0.7.6 released. + +2007-11-21 Chris Jackson <chr...@mr...> + + * R/simul.R: Bug fix, "cur.t not found" error. + + * R/simul.R: Allow covariates on misclassification probabilities + in simulations + +2007-11-20 Chris Jackson <chr...@mr...> + + * R/msm.R: Don't give no-SEs warning when hessian=FALSE + + * R/simul.R: Handle only one observation per subject. + + * R/outputs.R: New internal function intervaltrans.msm to + determine set of allowed transitions in an interval. + + * DESCRIPTION: Version 0.7.5 released. + +2007-11-08 Chris Jackson <chr...@mr...> + + * R/outputs.R(qratio.se.msm): Bug fix for factor + covariates. Thanks to Peter Jepsen. + +2007-11-05 Chris Jackson <chr...@mr...> + + * R/boot.R (bootdata.trans.msm,bootdata.subject.msm), R/msm.R + (msm.form.data,msm.form.covdata): Handle factor covariates + properly when bootstrap refitting, by retaining the original + covariates (not the numeric contrasts) in the data. Thanks to + Peter Jepsen. + + * R/outputs.R: qmatrix.msm, ematrix.msm, sojourn.msm and + qratio.msm can now be called with ci="none", returning just the + matrix of estimates, with no CI. + +2007-11-02 Chris Jackson <chr...@mr...> + + * R/utils.R: MatrixExp now accepts a vector of t, in which case it + only needs to calculate the eigensystem once. + +2007-10-30 Chris Jackson <chr...@mr...> + + * R/utils.R: Bug fix in ppexp. Thanks to Mike Murphy. + + * msm-manual: More explanation of censored states versus censored + event times. + +2007-10-25 Chris Jackson <chr...@mr...> + + * src/hmm.c: New beta HMM outcome distribution. + + * src/lik.c: Ignore initprobs in HMMs if the true state is known + at the initial observation. + +2007-10-24 Chris Jackson <chr...@mr...> + + * src/lik.c: Handle censoring properly in Viterbi algorithm. + +2007-10-22 Chris Jackson <chr...@mr...> + + * R/boot.R(bootdata.subject.msm): Bug fix, wrong covariate matrix + was being read. Thanks to Peter Jepsen for the report. + + * msm-manual.pdf: Correction of algebraic typos in Viterbi + algorithm. + + * src/lik.c: Account for obstrue in Viterbi algorithm. + + * R/outputs.R: Allow Viterbi algorithm to be used to impute + censored states in data with censored states but no HMM. + +2007-10-18 Chris Jackson <chr...@mr...> + + * R/outputs.R(prevalence.msm,plot.prevalence.msm): Account for + arguments supplied to prevalence.msm when doing the plot. Thanks + to Peter Jepsen for the report. + +2007-10-01 Chris Jackson <chr...@mr...> + + * src/Makevars: CR endings removed to satisfy R CMD CHECK in R 2.6.0 + + * R/outputs.R(print.msm.est): test for CI using is.list(), since $ + on an atomic object fails in R 2.7.0 instead of returning NULL. + + * DESCRIPTION: Version 0.7.4 released. Use standardised license string. + +2007-08-15 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.7.3 released. + +2007-08-14 Chris Jackson <chr...@mr...> + + * R/boot.R: Handle obstype and obsmisc in bootstrap refitting, and + handle refitting of msm models where obstype, obsmisc and subject + vectors are calculated within the argument to msm. Thanks to + Peter Jepsen for the report. + + * R/boot.R, R/outputs.R: Add bootstrap handlers (both + nonparametric and normal-theory) for qmatrix.msm, ematrix.msm, + sojourn.msm, qratio.msm, pmatrix.piecewise.msm, totlos.msm, + prevalence.msm. + +2007-07-27 Chris Jackson <chr...@mr...> + + * src/analyticp.c: Bug fix: exponential of certain degenerate 5 + state intensity matrices was not being calculated properly. Thanks + to Ross Boylan for the report. + + * man/msm.Rd: Make clear that the initial values for constrained + parameters are taken from the first of the multiple initial values + supplied. Thanks to Ross Boylan. + +2007-06-30 Chris Jackson <chr...@mr...> + + * R/outputs.R(surface.msm): Bug fix: don't include auxiliary + parameters in HMMs. Thanks to Michael Sweeting. + +2007-06-29 Chris Jackson <chr...@mr...> + + * R/utils.R(MatrixExp), src/pijt.c(MatrixExp): Bug fix. When there + are complex eigenvalues, don't use the eigensystem method of + calculating the matrix exponential. Thanks to V\xE9ronique Bouchard. + +2007-06-05 Chris Jackson <chr...@mr...> + + * R/outputs.R(expected.msm): Bug fix, wrong risk set was being + calculated for user-specified "times". + + * R/outputs.R(observed.msm): Allow interpolation of observed + states using the midpoint of an interval. + + * R/outputs.R(pmatrix.msm), R/boot.R: Confidence intervals for P + matrix can now be calculated by simulating from multivariate + normal distribution of MLEs. + + * R/outputs.R(plot.prevalence.msm),man/plot.prevalence.msm.Rd: new + function for prevalence plots. + + * man/pmatrix.piecewise.msm.Rd: Example corrected to use four sets + of covariates. Thanks to Qing Wang. + + * DESCRIPTION,NAMESPACE: Added rmvnorm import from "mvtnorm" package. + +2007-05-31 Chris Jackson <chr...@mr...> + + * DESCRIPTION: Version 0.7.2 released. + +2007-05-29 Chris Jackson <chr...@mr...> + + * R/outputs.R: Functions to calculate SEs and CIs for ematrix.msm + adapted to deal with multinomial logistic regression. CIs for + probabilities are calculated using delta method approximation to + variance of logit p, instead of log p as previously. + +2007-05-26 Chris Jackson <chr...@mr...> + + * R/utils.R: Truncated normal random sampling algorithm + improved to use the rejection method by Christian Robert. + Thanks to Vivek Roy for the suggestion. + +2007-05-25 Chris Jackson <chr...@mr...> + + * R/msm.R: Constraints on intensity covariate effects that some + effects are equal to other effects multiplied by -1 are now + allowed. + + * R/msm.R: Structural zeroes are allowed for initial state + occupancy probabilities. + + * inst/doc/msm-manual.pdf: Misclassification examples on heart + data changed so that individuals' first observations are not + misclassified. + +2007-05-21 Chris Jackson <chr...@mr...> + + * R/lik.c: Serious bug fix. Effects of covariates on outcome + probabilities in misclassification models (categorical HMMs) are + now estimated using multinomial logistic regressions, instead of + (incorrectly) independent univariate logistic regressions for each + probability. + + * R/msm.R, R/lik.c: Effects of covariates on initial state + probabilities in HMMs can now be estimated through multinomial + logistic regression. + +2007-05-13 Chris Jackson <chr...@mr...> + + * R/outputs.R, R/boot.R: New option "ci.boot" to prevalence.msm, a + helper to calculate bootstrap confidence limits for the expected + prevalences using "boot.msm". + + * R/msm.R, src/lik.c: New argument "obstrue" to msm, to allow some + observations to be observed without error in misclassification models. + +2007-05-11 Chris Jackson <chr...@mr...> + + * R/msm.R: Return derivatives in $deriv component of the msm + object after optimisation. Thanks to Ole Rummel. + +2007-04-18 Chris Jackson <chr...@mr...> + + * R/msm.R: Don't drop covariates on transition process which are + missing at the last observation for a patient, because they are + not used in the analysis. This has the consequences that output + from prevalence.msm may be different from earlier versions (0.7 or + earlier) if there are missing values in the data. Users are + advised to drop missing values from their data (if statistically + appropriate!) before using msm. + + * DESCRIPTION: Maintainer email address changed. + + * DESCRIPTION: Version 0.7.1 released. + +2007-04-05 Chris Jackson <chr...@im...> + + * R/outputs.R(viterbi.msm): Bug fix for models with + covariates. Thanks to Hongjie Wang. + + * R/outputs.R(prevalence.msm): Can now calculate expected + prevalences for models with piecewise-constant intensities, in the + same manner as pmatrix.piecewise.msm. + +2007-04-04 Chris Jackson <chr...@im...> + + * R/outputs.R(prevalence.msm): Bug fix, initstates was being + ignored. Thanks to Peter Jensen. + + * R/msm.R: Give a warning when the standard errors cannot be + calculated. + + * R/msm.R(msm.form.houtput): Bug fix for initprobs display with + only two states. + +2007-03-02 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm, qematrix.msm): Bug fix: When + center=FALSE, reported baseline intensity matrix should be + labelled as with covariates set to zero, not at their means. + Thanks to Ross Boylan. + +2007-02-09 Chris Jackson <chr...@im...> + + * src/lik.c: Return likelihood of zero for individuals with only + one observation in censoring and hidden models. Thanks to Jonathan + Williams for discovering the bug. + + * data/heart.txt: Age at transplant date corrected. Thanks to + Jonathan Williams. + +2006-11-21 Chris Jackson <chr...@im...> + + * R/msm.R: Initial state occupancy probabilities can now be + estimated. See new argument "est.initprobs" to msm. + + * DESCRIPTION: Version 0.7 released. + +2006-11-20 Chris Jackson <chr...@im...> + + * R/simul.R(sim.msm): Transpose error in bug fix from 0.6.4 + corrected. + + * R/outputs.R: Values of factor covariates are now supplied to + extractor functions in a sensible way, at last. Reordering bug + fixed with named covariate lists. + +2006-11-19 Chris Jackson <chr...@im...> + + * R/boot.R: New file. Implements bootstrap resampling for fitted + msm models. + + * R/outputs.R: Bootstrap confidence intervals available for + pmatrix.msm and totlos.msm. + + * R/outputs.R: pmatrix.msm now defaults to one time unit, instead + of forcing time unit to be explicitly given. + + * R/outputs.R: observed.msm function rewritten. Fixes bug in + calculating observed prevalence for state at maximum observed + time, reported by Jeremy Penn. It is also now much faster. + + * R/outputs.R: prevalence.msm is also adapted sensibly to handle + data where not all individuals start at a common time. + +2006-09-29 Chris Jackson <chr...@im...> + + * man/deltamethod.Rd: Example fixed to use correct covariance + matrix. Thanks to Andreas Beyerlein. + +2006-09-21 Chris Jackson <chr...@im...> + + * src/Makevars: PKG_LIBS fix to pass R CMD CHECK in R 2.4.0 + + * DESCRIPTION: Version 0.6.4 released. + +2006-09-12 Chris Jackson <chr...@im...> + + * R/simul.R(sim.msm) Bug fix: multiply covariates by baseline + intensities in the correct order. Also convert vector beta to + matrix. Thanks to Stephan Lenz for the report. + +2006-09-08 Chris Jackson <chr...@im...> + + * R/utils.R(rtnorm) Bug fix: use the correct components of + parameters which are vectors. Thanks to Jean-Baptiste Denis + for the report. + +2006-07-16 Chris Jackson <chr...@im...> + + * Rd/msm.Rd, inst/doc/msm-manual.pdf: Documentation correction - + the initial values of the qmatrix are with covariates at their + means in the data, not with the covariates at zero. This bug + has existed since version 0.5. + +2006-07-16 Chris Jackson <chr...@im...> + + * R/msm.R: Row and column names of crudeinits output retained from + qmatrix input. + +2006-06-29 Chris Jackson <chr...@im...> + + * Definition of initprobs corrected on manual p31. + +2006-06-28 Chris Jackson <chr...@im...> + + * References reinstated in the PDF manual. + + * DESCRIPTION: Version 0.6.3 released. + +2006-06-23 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.6.2 released. + +2006-06-21 Chris Jackson <chr...@im...> + + * msm.obs.to.fromto,msm.check.times: Support character subject + variables. Thanks to Danstan Bagenda for the report. + +2006-06-21 Chris Jackson <chr...@im...> + + * Analytically-calculated transition probability matrices + implemented for selected 3, 4 and 5 state models. These are + calculated in new file src/analyticp.c. New option "analyticp" in + msm() to revert to the old matrix exponential method. + Update to msm-manual.pdf describing this method. + +2006-06-20 Chris Jackson <chr...@im...> + + * R/simul.R(getobs.msm): Bug fix - Keep only one observation in + the absorbing state when absorbing state is not the highest state. + +2006-05-29 Chris Jackson <chr...@im...> + + * man/logLik.Rd: help page fixed to explain that this returns the + minus log likelihood. Thanks to Ole Rummel. + + * msm.R (likderiv.msm): bug fix - transformation of the + derivatives when all parameters are fixed was returning all NAs. + +2006-03-26 Chris Jackson <chr...@im...> + + * lik.c(Viterbi): Bug fix - don't ignore initprobs. Thanks to + Melanie Wall for reporting this. + + * DESCRIPTION: Version 0.6.1 released. + +2006-03-15 Chris Jackson <chr...@im...> + + * NAMESPACE: Import persp, plot and contour in from graphics. + + * msm.R (msm.check.times): Bug fix for factor subjects with empty + levels. Thanks to Jacques Gautrais. + +2006-01-04 Chris Jackson <chr...@im...> + + * msm.R (msm.form.data): use match(, unique()) to convert subject + to ordinal, not factor. Also do msm.check.times after dropping + missing data. Plus fix for missing obstime. + +2005-11-25 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.6 released. + +2005-11-17 Chris Jackson <chr...@im...> + + * R/outputs.R: New function surface.msm for surface plots of + likelihoods. + +2005-11-16 Chris Jackson <chr...@im...> + + * lik.c,pijt.c, etc.: Analytic derivatives of the likelihood + implemented for all models, apart from hidden Markov models or + models with censoring. New argument "use.deriv" to tell msm to + use these where appropriate. Thanks to Andrew Titman for the + debugging help. + + * The Dennis and Schnabel algorithm in the R function "nlm" can + now also be used to maximise the likelihood, as an alternative to + the algorithms in "optim". + +2005-11-11 Chris Jackson <chr...@im...> + + * msm-manual.pdf: definition of initial state probability f + corrected in hidden likelihood, equation 13. Thanks to Andrew + Titman. + +2005-11-08 Chris Jackson <chr...@im...> + + * man/deltamethod.Rd: Documentation of deltamethod clarified to + explain how to use user-defined variables within the formula. + +2005-10-11 Chris Jackson <chr...@im...> + + * Negative binomial hidden Markov model output distribution added. + + * DESCRIPTION: Version 0.5.2 released. + +2005-10-10 Chris Jackson <chr...@im...> + + * lik.c(Viterbi): Bug fix, wasn't handling Markov chains with + progressive and regressive states properly. Thanks to Rochelle + Watkins. + + * msm.R(msm.form.covdata): further fix for missing data. + +2005-10-1 Chris Jackson <chr...@im...> + + * msm.form.qmodel: Bug fix with gen.inits==TRUE and + censoring. Thanks to Jacques Gautrais. + +2005-07-27 Chris Jackson <chr...@im...> + + * sim.msm: collapse.covs fixed to handle covariate matrices with + one observation time. + + * msm.R(msm.form.covdata): bug fix for covariates in global + environment, not a data frame. This bug produced the error "Error + in 1:n : NA/NaN argument". + +2005-05-27 Chris Jackson <chr...@im...> + + * sim.msm: sample replaced by resample as in ?sample, to fix + simulations with small models. + + * msm.R: Fix for one-parameter models. (drop=FALSE in subsetting covmat) + +2005-05-25 Chris Jackson <chr...@im...> + + * utils.R: New functions (dpqr)pexp for the exponential + distribution with piecewise-constant rate. + + * utils.R: Bug fix: arguments lower.tail and log.p implemented for + truncated normal and measurement error distributions. + + * DESCRIPTION: Version 0.5.1 released. + +2005-05-23 Chris Jackson <chr...@im...> + + * tests/*: Tests are now fully automated. Outputs are compared + against known results using stopifnot(). + + * outputs.R(hazard.msm, odds.msm) Names "L95", "U95" changed to + "L","U" for generality. + +2005-05-20 Chris Jackson <chr...@im...> + + * msm.R: Data reorganised so that covariates are stored in a + matrix throughout. These are available from the model output as + cov for one per observation time, and covmat for one per time + difference. This fixes a bug which prevented covariates with + names such as "state", "time", "subject", among others, from being + used. + +2005-05-16 Chris Jackson <chr...@im...> + + * simul.R(sim.msm) Re-written. Fixes a bug in simulating from + models with time-dependent covariates, where not every covariate + change was accounted for. Uses new function rpexp to simulate + from the exponential distribution with piecewise-constant rate. + Thanks to Mike Sweeting for the bug report. + + * simul.R(sim.msm) Simulations now contain a censoring time at + maxtime, instead of the future absorption time. + + * simul.R(getobs.msm) Re-written, replacing ugly loops with + vectorised code. + +2005-04-11 Chris Jackson <chr...@im...> + + * man/simul.Rd: clarified that qmatrix is with covariates set to + zero. Thanks to Anne Presanis. + +2005-04-11 Chris Jackson <chr...@im...> + + * outputs.R(pmatrix.piecewise.msm): Bug fix for times of length 1. + Thanks to Anne Presanis. + +2005-03-09 Chris Jackson <chr...@im...> + + * pijt.c(Pmat): Don't recalculate pii within j loop. + +2005-03-08 Chris Jackson <chr...@im...> + + * pijt.c: New function Eigen. MatrixExp merged into one function. + +2005-03-07 Chris Jackson <chr...@im...> + + * msm.R(msm): Argument "hessian" added to msm. Covariance matrix + is set to NULL instead of a string when SEs not available. + + * msm.R(msm): Confidence limits of fixed parameters set to NA, not + zero width. + +2005-03-06 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.5 released. This is a major re-write, so + instead of a detailed change log, the NEWS entry is reproduced + below. + +Version 0.5 (2005-03-06) +----------- + +* Major update. Much of the internal R and C code has been re-written. + +* General continuous-time hidden Markov models can now be fitted with + msm, as well as misclassification models. Allowed response + distributions conditionally on the hidden state include categorical, + normal, Poisson, exponential and others. See the new "hmodel" + argument. Misclassification models can either be fitted in the old + style using an ematrix, or using a general HMM with a categorical + response distribution. Covariates can be fitted to many of the new + hidden response processes via generalized regressions. See + "hcovariates", "hcovinits" arguments. + +* Per-observation observation schemes, generalising the "exacttimes" + and "death" concepts. An optional new variable in the data can + specify whether each observation is a snapshot of the process, an + exactly-observed transition time, or a death state. Observations + are allowed to be at identical times, for example, a snapshot + followed instantly by an exact transition time. + +* Various syntax changes for cleaner moder specification. + + - Instead of 0/1 indicators, qmatrix and ematrix should contain the + initial values for the transition intensity / misclassification + matrix. These matrices can be named with names for the states of + the Markov chain. + + - The inits argument is abolished. Initial values are estimated + automatically if the new argument to msm "gen.inits = TRUE" is + supplied. This uses the initial values calculated by + crudeinits.msm. + + - misc no longer needs to be specified if an ematrix is supplied. + + - fixedpars=TRUE fixes all parameters, or specific parameters can + be fixed as before. + + - crudeinits.msm takes a state ~ time formula instead of two + separate state, time arguments, for consistency with the msm + function. + + - Initial values for covariate effects on transition rates / + misclassification probabilities are assumed to be zero unless + otherwise specified by the new "covinits" / "misccovinits" argument. + +* Support for 'from-to' style data has been withdrawn. Storing data in + this format is inadvisable as it destroys the longitudinal nature of + the data. + +* Speed improvements. The algorithm for calculating the likelihood + for non-hidden multi-state models has changed so that the matrix + exponential of the Q matrix is only calculated once for each time + difference / covariate combination. Therefore, users should see + speed improvements for data where the same from-state, to-state, + time difference, covariates combination appears many times. + +* Confidence intervals are now presented instead of standard errors + for uncertainty in parameter estimates. + +* New method of calculating matrix exponentials when the eigenvector + matrix is not invertible. It now uses the more robust method of + Pade approximants with scaling and squaring, instead of power + series. Faster LAPACK routines are now used for matrix inversion. + +* covmatch argument to msm has been abolished. To take a + time-dependent covariate value from the end of the relevant + transition instead of the default start, users are expected to + manipulate their data accordingly before calling msm, shifting the + positions of the covariate back by one within each subject. + +* Syntax changes for simmulti.msm. + +Bug fixes +--------- + +* The likelihood is now calculated correctly for individuals with + censored intermediate states, as well as censored initial and final states. + Thanks to Michael Sweeting for reporting this. + +* hazard.scale and odds.scale were interpreted wrongly in hazard.msm + and odds.msm respectively. + +* time-dependent covariate values now taken from the start instead of + end of the transition under hidden Markov models. + + +2005-01-28 Chris Jackson <chr...@im...> + + * src/lik.c (GetCensoredPObsTrue): Censored outcomes are now + assumed to be not misclassified. + + * msm.R(msm.form.censor): Bug fix - transient states were detected + incorrectly. + + * src/pijt.c: Bug fix. P matrix calculation for misclassification + models was ignoring exacttimes. + + * src/lik.c: Bug fix. Ignore death when exacttimes = TRUE. + + * DESCRIPTION: Version 0.4.1 released. + +2005-01-07 Chris Jackson <chr...@im...> + + * DESCRIPTION: Version 0.4 released. + +2005-01-06 Chris Jackson <chr...@im...> + + * msm/R/msm.process.covs: Bug fix - covariates were not being + centered. Thanks to Andrew Titman. + +2004-12-29 Chris Jackson <chr...@im...> + + Support added for censored observations. + + * src/lik.c: Bug fix. Don't ignore exacttimes for + misclassification models. + + Fixes in documentation. Thanks to Ross Boylan. + +2004-09-18 Chris Jackson <chr...@im...> + + * man: Rd syntax errors fixed to pass R CMD CHECK under 2.0.0 * + + * msm-manual: Reference to the PDF manual for msm made more + prominent. + + * DESCRIPTION: Version 0.3.3 released. + +2004-06-23 Chris Jackson <chr...@im...> + + * msm.R(msm.process.covs): Bug fix, constraints were not being + calculated properly when some covariates were constrained and some + were not. Thanks to Mike Sweeting. + +2004-06-01 Chris Jackson <chr...@im...> + + * msm-manual: Correction - heartmiscsex.msm is actually run using + default Nelder-Mead optimization, not BFGS. + +2004-05-13 Chris Jackson <chr...@im...> + + * R/outputs.R: plot.msm now plots survival curves in different + colours as well as different line types. + +2004-05-11 Chris Jackson <chr...@im...> + + * R/simul.R: simmulti.msm now returns a data frame, as it should + do. + +2004-04-23 Chris Jackson <chr...@im...> + + * New argument "start" in simmulti.msm to give the starting state + for each individual. Thanks to Stephan Lenz for the suggestion. + + +2004-03-25 Chris Jackson <chr...@im...> + + * NEWS file moved to inst directory, so that it ends up in the + root directory of binary installs. Leave ChangeLog in the source + package. + + * DESCRIPTION: Version 0.3.2 released. + +2004-03-24 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm): Bug fix - only say "covariates set to + their means" in the output if there actually are any covariates. + + * msm-manual.pdf: Hidden Markov model theory moved to straight + after general model theory, general cleanups. + +2004-03-23 Chris Jackson <chr...@im...> + + * msm-manual.pdf: R code examples rewritten using Sweave. + Examples run again with different death assumption, most estimates + are negligibly different. Misclassification model examples + corrected to include death. Example of plot.msm added. This is + not distributed as a vignette, as the msm model examples take a + long time to fit. + +2004-03-22 Chris Jackson <chr...@im...> + + * R/simul.R(simmulti.msm, getobs.msm): tunit argument abolished + and death times assumed to be known exactly. + + * src/lik.c(fillparvec): Bug fix. Bounds checking on vector of + indices of fixed parameters. Thanks to Ross Boylan. + +2004-03-21 Chris Jackson <chr...@im...> + + * R/msm.R, src/lik.c: tunit argument is now abolished (with + warning given). Death states are assumed to have exact entry + times, not within one day. This is cleaner and more logical, as + in longitudinal studies all observations are usually accurate to + one basic time unit, not just deaths. + + * R/msm.R, src/lik.c: More than one death state is now supported. + A death state has exact entry time, with an unknown transient + state at the previous instant. Thanks to Jean-Luc Bulliard for + suggesting this. + + * R/msm.R(msm.check.times): Just give a warning if a subject only + has one observation, no need to die. + + * R/msm.R(lik.msm): Bug fix. set diagonal to 0 when calculating + number of misclassified states nms, in case user has given non + zero diagonal entries in ematrix. + + * (various) Changes made so that R CMD CHECK passes with R 1.9.0 + alpha: codoc mismatches and PACKAGE argument in .C() + +2003-10-14 Chris Jackson <chr...@im...> + + * src/pijt.c(MatrixExpSeries): Bug fix. Don't overwrite the matrix + A, as it is needed after the function exits. This had led to wrong + results when exacttimes = TRUE and the intensity matrix had + repeated eigenvalues. + + * src/lik.c(liksimple, liksimple_fromto, UpdateLik): Don't ignore + death argument when exacttimes = TRUE. + + * R/msm.R(msm.check.times): Use table instead of tapply to count + the number of observations per subject. Fixes further problems + with running out of memory. + + * DESCRIPTION: Version 0.3.1 released. + +2003-09-29 Chris Jackson <chr...@im...> + + * R/outputs.R: Debugging print statements removed from + pmatrix.piecewise.msm + + * msm-manual.pdf: Version number added. + + * DESCRIPTION: Version 0.3 released. + +2003-09-26 Chris Jackson <chr...@im...> + + * src/lik.c, src/pijt.c: Allocate memory using S_alloc, not + Calloc. Solves the problem of running out of memory for large + datasets. + + * R/outputs.R(observed.msm): Fixed a bug with looping over a + factor patient ID, which caused prevalence.msm to fail. + +2003-09-25 Chris Jackson <chr...@im...> + + * R/outputs.R(print.msm) Don't draw ASCII underlines under + "Multi-state Markov models" banner - looks ugly in proportional + font. + + * R/msm.R: nmiscs model attribute (number of misclassification + probabilities) changed to nmisc for compatibility with C code. + + * src/lik.c(liksimple, liksimple_fromto): Bug fixed in the + likelhood calculation for non-misclassified reversible models with + death time known within one day. The error assumed the unobserved + states on the day before death could only be states greater or + equal than the previously observed state. This is not true for + reversible models. + + * man/summary.msm.Rd: usage and argument lists made consistent, + satisfying new R CMD CHECK. + +2003-09-24 Chris Jackson <chr...@im...> + + * R/msm.R, R/outputs.R, src/lik.c: A new argument "qconstraint" to + msm now allow equality constraints between baseline transition + intensities. A similar argument "econstraint" allows equality + constraints between misclassification probabilities. Thanks to + Mike Sweeting and Ross Boylan for suggesting this. + +2003-09-23 Chris Jackson <chr...@im...> + + * src/pijt.c(pijt): Bug fixed in the likelihood calculation for + exact transition times with reversible models. The error assumed + Prr(t) was always equal to exp(-qrr t), when this is only + satisfied for a state r which is only visited once. + +2003-06-30 Chris Jackson <chr...@im...> + + * R/outputs.R(qematrix.msm): Didn't work when the baseline rates + or probabilities were fixed to zero, bug fixed (now uses + x$model$qvector to test whether a transition is allowed, not + x$Qmatrices$logbaseline). + + * R/outputs.R: New function - pmatrix.piecewise.msm, for + calculating P-matrices for processes with non-homogeneous but + piecewise-constant intensities. Thanks to Mike Sweeting for + suggesting this. + + * DESCRIPTION: Version 0.2.2 released + +2003-06-25 Chris Jackson <chr...@im...> + + * R/msm.R (msm.check.model): Bug fix - was reporting the wrong + subject numbers when there were disallowed transitions in the + data. Thanks to Stephan Lenz for spotting this. + +2003-06-20 Chris Jackson <chr...@im...> + + * R/outputs.R: Covariates argument is now checked that it is a + list, to avoid ugly warnings in R 1.7.0 + +2003-06-16 Chris Jackson <chr...@im...> + + * R/msm.R (msm.form.output): Died when only one parameter in the + model, fixed by coercing covmat to matrix. + +2003-06-03 Chris Jackson <chr...@im...> + + * inst/doc/msm-manual.pdf: Edits to manual, e.g. correction of + covariates formulae to include baseline intensity, lots of typos + corrected. + + * DESCRIPTION: Version 0.2.1 released + +2003-04-29 Chris Jackson <chr...@im...> + + * R/simul.R: Bug fix in simmulti.msm: didn't work for one + covariate. Thanks to Mike Sweeting for spotting this. + + * R/msm.R: Subject identification variable is now allowed to be + factor or character. Thanks to Pablo Emilio Verde for the + suggestion. + + * R/msm.R: msm.check.times also checks whether all the + observations on a subject are adjacent in the data set. + +2003-03-20 Chris Jackson <chr...@im...> + + * R/R: Bug fix in msm.check.times. Thanks to Pablo Emilio Verde + for helping to find this. + +2003-02-20 Chris Jackson <chr...@im...> + + * R/simul.R: Bug fix in getobs.msm: exact death times were + ignored. (obstimes[i] replaced by sim$times[j+1]). + +2003-01-05 Chris Jackson <chr...@ic...> + + * DESCRIPTION: Version 0.2 released. + + * inst/doc/msm-manual.pdf: PDF manual completed. + +2003-01-03 Chris Jackson <chr...@ic...> + + * man: Heart transplant data added as an example data set + + * man: Aesthetic cleanups of all help pages + + * R/msm.R: New function crudeinits.msm to estimate a set of + initial values for transition rates by assuming data represent + the only transition times. + + * R/msm.R: New function statetable.msm to calculate frequencies of + successive state pairs in data. + + * R/outputs.R: Methodology changed for prevalencemisc.msm to make + it more similar to prevalence.msm, avoiding confusion. Observed + counts now common to both, and separated out into a new function + observed.msm. Then prevalencemisc.msm (and the internal C onestep) + was removed and prevalence.msm was made general to both + misclassification and non-misclassification models. + +2002-12-18 Chris Jackson <chr...@ic...> + + * src/lik.c: Bugfix. nms changed to nst in likelihood-calculating + functions. Fixes failure to calculate the likelihood where some + states where some states are observed without error, but are not + death states (Thanks to Martyn Plummer). + + * R/simul.R: Bugfix in getobs.msm, which led to the entrance to + not being observed for models with absorbing states. + +2002-12-09 Chris Jackson <chr...@ic...> + + * R/outputs.R: new function odds.msm to calculate odds ratios for + misclassification probabilities. + + * R/outputs.R: new function ematrix.msm. Calls new internal + functions, including qematrix.msm. + +2002-12-03 Chris Jackson <chr...@ic...> + + * R/outputs.R: new function qratio.msm for estimating ratios of + intensities and (via new function qratio.se.msm) their standard + errors. Documentation in man/qratio.msm.Rd. + +2002-12-02 Chris Jackson <chr...@ic...> + + * R/outputs.R: new internal function qmatrix.diagse.msm + + * R/msm.R Null components of msm objects removed, e.g. + misclassification parameters for non-misclassification models. + +2002-11-27 Chris Jackson <chr...@ic...> + + * R: File msm.R split into msm.R, outputs.R and utils.R. + + * R/msm.R. New functions absorbing.msm and transient.msm which + give the indices of the absorbing or transient states of the model. + + * R/msm.R. (plot.msm) Now accepts a "covariates" argument for + covariates at which to evaluate the survival probabilities. + + * R/msm.R. Functions which operate on msm objects now have the + msm object argument named "x", instead of "msm", for consistency. + + * man/qmatrix.msm.Rd, man/pmatrix.msm.Rd, man/sojourn.msm.Rd. Updated + documentation. + + * R/msm.R (msm). The contents of msm objects has been + reorganised. The first component of Qmatrices is now called + "logbaseline" and gives the estimates of the log intensites as + returned from the optimisation. Components "qcenter" and + "ecenter" are removed, as they were named confusingly. The + component 'Pmatrix' is also removed, as it is obsoleted by the + function 'pmatrix.msm'. New component 'foundse' is a logical + indicating whether the Hessian is positive definite, i.e. whether + standard errors are available. + + * R/msm.R (sojourn.msm) Function rewritten to allow a given set of + covariate values, using the new qmatrix.msm. Now takes a fitted + msm model as its argument, and the component "mean" in the return + is changed to "estimate". + + * R/msm.R (qmatrix.msm). New function to compute transition + intensity matrix at given covariate values. + + * R/msm.R (pmatrix.msm). New function to compute transition + probability matrix at given covariate values. + + * R/simul.R (simmulti.msm): Check for ordered patient IDs, and + sort input data if not ordered. Also check for duplicated + observation times and remove them. Default for 'death' argument + changed to FALSE for consistency with msm(). Give column names to + the simulated data. + +2002-11-13 Chris Jackson <chr...@ic...> + + * R/msm.R: New function msm.check.qmatrix to test for consistency + of Markov chain intensity matrices. + + * R/msm.R, man/totlos.Rd: New function totlos.msm to estimate total length of stay in a + state, with documentation. + + * src/lik.c, src/pijt.c: Unused and uninitialised variables fixed so the library builds + cleanly with -Wall. + +2002-11-08 Chris Jackson <chr...@ic...> + + * src/lik.c: Debugging print statements removed from onestep + + * msm_0.1.tar.gz: First release Added: trunk/rmol/R/msm/DESCRIPTION =================================================================== --- trunk/rmol/R/msm/DESCRIPTION (rev 0) +++ trunk/rmol/R/msm/DESCRIPTION 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,18 @@ +Package: msm +Version: 0.8.2 +Date: 2009-04-08 +Title: Multi-state Markov and hidden Markov models in continuous time +Author: Christopher Jackson <chr...@mr...> +Maintainer: Christopher Jackson <chr...@mr...> +Description: Functions for fitting general continuous-time Markov and + hidden Markov multi-state models to longitudinal data. Both + Markov transition rates and the hidden Markov output process + can be modelled in terms of covariates. A variety of + observation schemes are supported, including processes observed + at arbitrary times, completely-observed processes, and censored + states. +License: GPL-2 +Imports: survival,mvtnorm +Packaged: 2009-04-08 19:03:15 UTC; chris +Repository: CRAN +Date/Publication: 2009-04-14 17:32:26 Added: trunk/rmol/R/msm/NAMESPACE =================================================================== --- trunk/rmol/R/msm/NAMESPACE (rev 0) +++ trunk/rmol/R/msm/NAMESPACE 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,92 @@ +useDynLib(msm) + +export( +absorbing.msm, +boot.msm, +coef.msm, +contour.msm, +crudeinits.msm, +deltamethod, +ematrix.msm, +hazard.msm, +image.msm, +MatrixExp, +msm, +logLik.msm, +lrtest.msm, +odds.msm, +pearson.msm, +persp.msm, +plot.msm, +plotprog.msm, +plot.prevalence.msm, +plot.survfit.msm, +pmatrix.msm, +pmatrix.piecewise.msm, +prevalence.msm, +qmatrix.msm, +qratio.msm, +scoreresid.msm, +sim.msm, +simmulti.msm, +sojourn.msm, +statetable.msm, +summary.msm, +surface.msm, +totlos.msm, +transient.msm, +viterbi.msm, +hmmCat, +hmmIdent, +hmmUnif, +hmmNorm, +hmmLNorm, +hmmExp, +hmmGamma, +hmmWeibull, +hmmPois, +hmmBinom, +hmmTNorm, +hmmMETNorm, +hmmMEUnif, +hmmNBinom, +hmmBeta, +dtnorm, +ptnorm, +qtnorm, +rtnorm, +dmenorm, +pmenorm, +qmenorm, +rmenorm, +dmeunif, +pmeunif, +qmeunif, +rmeunif, +dpexp, +ppexp, +qpexp, +rpexp +) + +importFrom(graphics, plot) +importFrom(graphics, persp) +importFrom(graphics, contour) +importFrom(graphics, image) +importFrom(stats, coef) +importFrom(mvtnorm, rmvnorm) +importFrom(survival, Surv) +importFrom(survival, survfit) + +S3method(print, msm) +S3method(summary, msm) +S3method(plot, msm) +S3method(contour, msm) +S3method(persp, msm) +S3method(image, msm) +S3method(coef, msm) +S3method(logLik, msm) +S3method(print, hmodel) +S3method(print, hmmdist) +S3method(print, msm.est) +S3method(print, pearson.msm) Added: trunk/rmol/R/msm/R/boot.R =================================================================== --- trunk/rmol/R/msm/R/boot.R (rev 0) +++ trunk/rmol/R/msm/R/boot.R 2009-05-03 21:46:25 UTC (rev 204) @@ -0,0 +1,247 @@ +### Take a bootstrap sample from the data contained in a fitted msm +### model. Sample pairs of consecutive observations, i.e. independent +### transitions. Not applicable if model is hidden or some states are +### censored. + +bootdata.trans.msm <- function(x) { + dat <- if (!is.null(x$data.orig)) x$data.orig else x$data + subj.num <- match(dat$subject, unique(dat$subject)) + nextsubj <- c(subj.num[2:length(subj.num)], Inf) + lastsubj <- subj.num != nextsubj + inds <- sample(which(!lastsubj), replace=TRUE) + data.boot <- as.data.frame(matrix(nrow=length(inds)*2, ncol=length(dat$covlabels.orig) + 4)) + state.name <- deparse(as.list(x$call$formula)[[2]]) + time.name <- deparse(as.list(x$call$formula)[[3]]) + colnames(data.boot) <- c("subject.name", time.name, state.name, "obstype.name", dat$covlabels.orig) + data.boot[,state.name] <- as.vector(rbind(dat$state[inds], dat$state[inds+1])) + # in the bootstrap data, label each transition as being from a different subject + data.boot[,"subject.name"] <- rep(seq(along=inds), each=2) + data.boot[,time.name] <- as.vector(rbind(dat$time[inds], dat$time[inds+1])) + data.boot[,"obstype.name"] <- as.vector(rbind(dat$obstype.obs[inds], dat$obstype.obs[inds+1])) + for (j in dat$covlabels.orig) { + frominds <- seq(1, 2*length(inds)-1, 2) + data.boot[frominds, j] <- data.boot[frominds+1,j] <- dat$cov.orig[inds, j] + if (dat$covdata$covfactor[j]) + data.boot[,j] <- factor(data.boot[,j], labels=levels(dat$cov.orig[,j])) + } + colnames(data.boot) <- gsub("factor\\((.+)\\)", "\\1", colnames(data.boot)) + data.boot +} + +### Take a bootstrap sample from the data contained in a fitted msm +### model. Sample subjects. Used for hidden models or models with +### censoring, in which the transitions within a subject are not +### independent. + +bootdata.subject.msm <- function(x) { + dat <- if (!is.null(x$data.orig)) x$data.orig else x$data + subj.num <- match(dat$subject, unique(dat$subject)) + subjs <- sample(unique(subj.num), replace=TRUE) + inds <- new.subj <- NULL + for (i in seq(along=subjs)) { + subj.inds <- which(subj.num == subjs[i]) + inds <- c(inds, subj.inds) + new.subj <- c(new.subj, rep(i, length(subj.inds))) + } + data.boot <- as.data.frame(matrix(nrow=length(inds), ncol=length(dat$covlabels.orig) + 5)) + state.name <- deparse(as.list(x$call$formula)[[2]]) + time.name <- deparse(as.list(x$call$formula)[[3]]) + colnames(data.boot) <- c("subject.name", time.name, state.name, "obstype.name", "obstrue.name", dat$covlabels.orig) + data.boot[,"subject.name"] <- new.subj + data.boot[,time.name] <- dat$time[inds] + data.boot[,state.name] <- dat$state[inds] + data.boot[,"obstype.name"] <- dat$obstype[inds] + data.boot[,"obstrue.name"] <- dat$obstrue[inds] + for (j in dat$covlabels.orig) { + data.boot[, j] <- dat$cov.orig[inds, j] + if (dat$covdata$covfactor[j]){ + data.boot[,j] <- factor(data.boot[,j], labels=levels(dat$cov.orig[,j])) + } + } + colnames(data.boot) <- gsub("factor\\((.+)\\)", "\\1", colnames(data.boot)) + data.boot +} + +### Given a fitted msm model, draw a bootstrap dataset, refit the +### model, and optionally compute a statistic on the refitted model. +### Repeat B times, store the results in a list. +### msm objects tend to be large, so it is advised to compute a statistic on them by specifying "stat", instead +### of using this function to return a list of refitted msm objects. +### To compute more than one statistic, specify, e.g. stat=function(x)list(stat1(x),stat2(x)) + +### Some of the arguments to the msm call might be user-defined objects. +### e.g. qmatrix, ematrix, hmodel, ... +### Put in help file that these must be in the working environment. + +### a) if call supplied as factor(), strip factor() from name. + +boot.msm <- function(x, stat=pmatrix.msm, B=1000, file=NULL){ + boot.list <- vector(B, mode="list") + if (!is.null(x$call$subject)) x$call$subject <- substitute(subject.name) + if (!is.null(x$call$obstype)) x$call$obstype <- substitute(obstype.name) + if (!is.null(x$call$obstrue)) x$call$obstrue <- substitute(obstrue.name) + for (i in 1:B) { + boot.data <- if (x$hmodel$hidden || x$cmodel$ncens) bootdata.subject.msm(x) else bootdata.trans.msm(x) + x$call$data <- substitute(boot.data) + boot.list[[i]] <- try(eval(x$call)) + if (!is.null(stat)) + boot.list[[i]] <- stat(boot.list[[i]]) + if (!is.null(file)) save(boot.list, file=file) + } + boot.list +} + +### Utilities for calculating bootstrap CIs for particular statistics + +qematrix.ci.msm <- function(x, covariates="mean", intmisc="intens", sojourn=FALSE, cl=0.95, B=1000) { + q.list <- boot.msm(x, function(x)qematrix.msm(x=x, covariates=covariates, intmisc=intmisc)$estimates, B) + q.array <- array(unlist(q.list), dim=c(dim(q.list[[1]]), length(q.list))) + q.ci <- apply(q.array, c(1,2), function(x)(c(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)), sd(x)))) + q.ci <- aperm(q.ci, c(2,3,1)) + if (sojourn) { + soj.array <- apply(q.array, 3, function(x) -1/diag(x)) + soj.ci <- apply(soj.array, 1, function(x)(c(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)), sd(x)))) + list(q=q.ci, soj=soj.ci) + } + else q.ci +} + +qratio.ci.msm <- function(x, ind1, ind2, covariates="mean", cl=0.95, B=1000) { + q.list <- boot.msm(x, function(x)qratio.msm(x=x, ind1=ind1, ind2=ind2, covariates=covariates)["estimate"], B) + q.vec <- unlist(q.list) + c(quantile(q.vec, c(0.5 - cl/2, 0.5 + cl/2)), sd(q.vec)) +} + +pmatrix.ci.msm <- function(x, t, covariates="mean", cl=0.95, B=1000) { + p.list <- boot.msm(x, function(x)pmatrix.msm(x=x, t=t, covariates=covariates,ci="none"), B) + p.array <- array(unlist(p.list), dim=c(dim(p.list[[1]]), length(p.list))) + p.ci <- apply(p.array, c(1,2), function(x)(quantile(x, c(0.5 - cl/2, 0.5 + cl/2)))) + aperm(p.ci, c(2,3,1)) +} + +pmatrix.piecewise.ci.msm <- function(x, t1, t2, times, covariates="mean", cl=0.95, B=1000) { + p.list <- boot.msm(x, function(x)pmatrix.piecewise.msm(x=x, t1=t1, t2=t2, times=times, covariates=covariates,ci="none"), B) + p.array <- array(unlist(p.list), dim=c(dim(p.list[[1]]), length(p.list))) + p.ci <- apply(p.array, c(... [truncated message content] |
From: <den...@us...> - 2009-05-03 16:45:25
|
Revision: 203 http://rmol.svn.sourceforge.net/rmol/?rev=203&view=rev Author: denis_arnaud Date: 2009-05-03 16:45:21 +0000 (Sun, 03 May 2009) Log Message: ----------- [Building] 1. Better structured the source code for the batch generation. 2. The batch now reads options from the command-line. Modified Paths: -------------- trunk/rmol/configure.ac trunk/rmol/doc/Makefile.am trunk/rmol/po/Makefile.in.in trunk/rmol/po/POTFILES.in trunk/rmol/rmol/Makefile.am trunk/rmol/rmol/basic/Makefile.am trunk/rmol/rmol/bom/Makefile.am trunk/rmol/rmol/command/Makefile.am trunk/rmol/rmol/factory/Makefile.am trunk/rmol/rmol/field/Makefile.am trunk/rmol/rmol/service/Makefile.am trunk/rmol/rmol.spec.in trunk/rmol/test/Makefile.am trunk/rmol/test/SimulateTestSuite.cpp trunk/rmol/test/com/Makefile.am Added Paths: ----------- trunk/rmol/rmol/batches/ trunk/rmol/rmol/batches/Makefile.am trunk/rmol/rmol/batches/rmol.cpp trunk/rmol/rmol/batches/sources.mk trunk/rmol/rmol/config/ trunk/rmol/rmol/config/Makefile.am trunk/rmol/rmol/core/ trunk/rmol/rmol/core/Makefile.am trunk/rmol/rmol/core/sources.mk trunk/rmol/test/samples/Makefile.am trunk/rmol/test/samples/sources.mk Removed Paths: ------------- trunk/rmol/rmol/rmol.cpp trunk/rmol/rmol/sources.mk Property Changed: ---------------- trunk/rmol/rmol/ trunk/rmol/test/samples/ Modified: trunk/rmol/configure.ac =================================================================== --- trunk/rmol/configure.ac 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/configure.ac 2009-05-03 16:45:21 UTC (rev 203) @@ -60,13 +60,6 @@ # Set default language to C++ AC_LANG([C++]) -# Check for debug switch -AC_ARG_ENABLE(debug, - [AS_HELP_STRING([--enable-debug], - [build additional debugging library])]) -test "x$enable_debug" != xyes && enable_debug=no -AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes]) - # Check for exceptions switch AC_ARG_ENABLE(exceptions, [AS_HELP_STRING([--enable-exceptions], @@ -103,37 +96,11 @@ AC_SUBST(docdir) -PACKAGE_DEBUG="$PACKAGE" -# Set debug flags -if test "x$enable_debug" = xyes; then - PACKAGE_DEBUG="$PACKAGE"_debug - CXXFLAGS_DEBUG="-DASSERT_LEVEL=2 -g" - # Only for GCC compiler - if test "x$GXX" = xyes; then - if test "x$enable_exceptions" = xno; then - CXXFLAGS_DEBUG="$CXXFLAGS_DEBUG -fno-exceptions" - fi - CXXFLAGS_DEBUG="$CXXFLAGS_DEBUG -Wall -pipe" - fi +# Default compilation flags +if test -z "${CXXFLAGS}"; then + CXXFLAGS="-g -Wall" fi -AC_SUBST(CXXFLAGS_DEBUG) -AC_SUBST(PACKAGE_DEBUG) -# Set optimised flags -if test "x$CXXFLAGS" = x; then - CXXFLAGS_OPT="-DASSERT_LEVEL=1 -O3" - # Only for GCC compiler - if test "x$GXX" = xyes; then - if test "x$enable_exceptions" = xno; then - CXXFLAGS_OPT="$CXXFLAGS_OPT -fno-exceptions" - fi - CXXFLAGS_OPT="$CXXFLAGS_OPT -pipe" - fi -else - CXXFLAGS_OPT="$CXXFLAGS" - CXXFLAGS="" -fi -AC_SUBST(CXXFLAGS_OPT) # --------------------------------------------------------- # GSL (GNU Scientific Library: http://gnu.org/projects/gsl) @@ -156,6 +123,9 @@ AC_SUBST(BOOST_FILESYSTEM_LIB) +# ------------------------------------------------------------------- +# Support for documentation +# ------------------------------------------------------------------- # Checks for documentation build tools #AC_CHECK_PROG([texinfo_ok], [texinfo], [yes], [no]) #if test "x$enable_info_doc" != xno; then @@ -315,6 +285,9 @@ rmol/factory/Makefile rmol/command/Makefile rmol/service/Makefile + rmol/core/Makefile + rmol/config/Makefile + rmol/batches/Makefile man/Makefile info/Makefile doc/Makefile @@ -327,6 +300,7 @@ doc/sourceforge/howto_release_rmol.html po/Makefile.in test/Makefile + test/samples/Makefile test/com/Makefile win32/Makefile) AC_OUTPUT @@ -346,7 +320,6 @@ - infodir ........... : ${infodir} Switches: - - debug ............. : ${enable_debug} - exceptions ........ : ${enable_exceptions} - use-nls ........... : ${USE_NLS} - info-doc .......... : ${enable_info_doc} @@ -367,8 +340,7 @@ Compiler/linker flags/libs/defs: - CXX ............... : ${CXX} - - CXXFLAGS .......... : ${CXXFLAGS_OPT} - - CXXFLAGS_DEBUG .... : ${CXXFLAGS_DEBUG} + - CXXFLAGS .......... : ${CXXFLAGS} - CPPFLAGS .......... : ${CPPFLAGS} - LDFLAGS ........... : ${LDFLAGS} - LIBS .............. : ${LIBS} Modified: trunk/rmol/doc/Makefile.am =================================================================== --- trunk/rmol/doc/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/doc/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -1,13 +1,14 @@ include $(top_srcdir)/doc/local/sources.mk include $(top_srcdir)/doc/tutorial/sources.mk include $(top_srcdir)/doc/tutorial/src/sources.mk -include $(top_srcdir)/@PACKAGE@/sources.mk include $(top_srcdir)/@PACKAGE@/basic/sources.mk include $(top_srcdir)/@PACKAGE@/field/sources.mk include $(top_srcdir)/@PACKAGE@/bom/sources.mk include $(top_srcdir)/@PACKAGE@/factory/sources.mk include $(top_srcdir)/@PACKAGE@/command/sources.mk include $(top_srcdir)/@PACKAGE@/service/sources.mk +include $(top_srcdir)/@PACKAGE@/core/sources.mk +include $(top_srcdir)/@PACKAGE@/batches/sources.mk SUBDIRS = images tutorial local Modified: trunk/rmol/po/Makefile.in.in =================================================================== --- trunk/rmol/po/Makefile.in.in 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/po/Makefile.in.in 2009-05-03 16:45:21 UTC (rev 203) @@ -22,7 +22,6 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ -datarootdir = @datarootdir@ datadir = @datadir@ localedir = $(datadir)/locale gettextsrcdir = $(datadir)/gettext/po Modified: trunk/rmol/po/POTFILES.in =================================================================== --- trunk/rmol/po/POTFILES.in 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/po/POTFILES.in 2009-05-03 16:45:21 UTC (rev 203) @@ -74,7 +74,8 @@ rmol/bom/BucketHolder.cpp rmol/bom/DistributionParameterList.hpp rmol/bom/Gaussian.hpp -rmol/rmol.cpp +rmol/config/rmol-paths.hpp +rmol/batches/rmol.cpp rmol/command/Optimiser.hpp rmol/command/Optimiser.cpp rmol/command/FileMgr.hpp Property changes on: trunk/rmol/rmol ___________________________________________________________________ Modified: svn:ignore - .deps .libs Makefile Makefile.in config.h config.h.in stamp-h1 rmol rmol.log + .deps .libs Makefile Makefile.in config.h config.h.in stamp-h1 Modified: trunk/rmol/rmol/Makefile.am =================================================================== --- trunk/rmol/rmol/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -1,54 +1,15 @@ include $(top_srcdir)/Makefile.common -include $(srcdir)/sources.mk +include $(srcdir)/core/sources.mk ## Source directory MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = basic field bom factory command service +SUBDIRS = basic field bom factory command service core config batches EXTRA_DIST = config_msvc.h -lib_LTLIBRARIES = lib@PACKAGE@.la -if ENABLE_DEBUG - lib_LTLIBRARIES += lib@PACKAGE@_debug.la -endif -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 = \ - $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \ - $(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION) -lib@PACKAGE@_debug_la_SOURCES = $(service_h_sources) $(service_cc_sources) -lib@PACKAGE@_debug_la_LIBADD =$(top_builddir)/@PACKAGE@/basic/libbas_debug.la \ - $(top_builddir)/@PACKAGE@/field/libfld_debug.la \ - $(top_builddir)/@PACKAGE@/bom/libbom_debug.la \ - $(top_builddir)/@PACKAGE@/factory/libfac_debug.la \ - $(top_builddir)/@PACKAGE@/command/libcmd_debug.la \ - $(top_builddir)/@PACKAGE@/service/libsvc_debug.la -lib@PACKAGE@_debug_la_LDFLAGS = \ - $(BOOST_LIBS) $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \ - $(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION) - -bin_PROGRAMS = rmol -if ENABLE_DEBUG - bin_PROGRAMS += rmol_debug -endif - -rmol_SOURCES = $(bin_h_sources) $(bin_cc_sources) -rmol_CXXFLAGS = $(BOOST_CFLAGS) -rmol_LDADD = lib@PACKAGE@.la -rmol_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) - -rmol_debug_SOURCES = $(rmol_SOURCES) -rmol_debug_CXXFLAGS = $(BOOST_CFLAGS) -rmol_debug_LDFLAGS = $(rmol_LDFLAGS) -rmol_debug_LDADD = lib@PACKAGE@_debug.la - +# Header files nobase_pkginclude_HEADERS = $(service_h_sources) nobase_nodist_pkginclude_HEADERS = $(top_builddir)/@PACKAGE@/config.h Modified: trunk/rmol/rmol/basic/Makefile.am =================================================================== --- trunk/rmol/rmol/basic/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/basic/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,14 +3,9 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libbas.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libbas_debug.la -endif + libbas_la_SOURCES= $(bas_h_sources) $(bas_cc_sources) -libbas_la_CXXFLAGS = $(CXXFLAGS_OPT) $(BOOST_CFLAGS) +libbas_la_CXXFLAGS = $(BOOST_CFLAGS) -libbas_debug_la_SOURCES = $(bas_h_sources) $(bas_cc_sources) -libbas_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) $(BOOST_CFLAGS) - #pkgincludedir = $(includedir)/@PACKAGE@/basic #pkginclude_HEADERS = $(bas_h_sources) Property changes on: trunk/rmol/rmol/batches ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile rmol rmol.log Added: trunk/rmol/rmol/batches/Makefile.am =================================================================== --- trunk/rmol/rmol/batches/Makefile.am (rev 0) +++ trunk/rmol/rmol/batches/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,16 @@ +include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk + +## Source directory + +MAINTAINERCLEANFILES = Makefile.in + + +# Binaries (batches) +bin_PROGRAMS = rmol + +rmol_SOURCES = $(batches_h_sources) $(batches_cc_sources) +rmol_CXXFLAGS = $(BOOST_CFLAGS) +#rmol_LDADD = +rmol_LDFLAGS = $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(top_builddir)/@PACKAGE@/core/lib@PACKAGE@.la Copied: trunk/rmol/rmol/batches/rmol.cpp (from rev 201, trunk/rmol/rmol/rmol.cpp) =================================================================== --- trunk/rmol/rmol/batches/rmol.cpp (rev 0) +++ trunk/rmol/rmol/batches/rmol.cpp 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,256 @@ +// C +#include <assert.h> +// STL +#include <iostream> +#include <sstream> +#include <fstream> +#include <string> +// Boost (Extended STL) +#include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/date_time/gregorian/gregorian.hpp> +#include <boost/program_options.hpp> +// RMOL +#include <rmol/RMOL_Service.hpp> +#include <rmol/config/rmol-paths.hpp> + + +// //////// Constants ////// +/** Default name and location for the log file. */ +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"); + +/** Default number of random draws to be generated (best if over 100). */ +const int K_RMOL_DEFAULT_RANDOM_DRAWS = 100000; + +/** Default value for the capacity of the resource (e.g., a flight cabin). */ +const double K_RMOL_DEFAULT_CAPACITY = 500.0; + +/** Default name and location for the Revenue Management method to be used. + <br> + <ul> + <li>0 = Monte-Carlo</li> + <li>1 = Dynamic Programming</li> + <li>2 = EMSR</li> + <li>3 = EMSR-a</li> + <li>4 = EMSR-b</li> + </ul> */ +const short K_RMOL_DEFAULT_METHOD = 0; + + +// ///////// Parsing of Options & Configuration ///////// +// A helper function to simplify the main part. +template<class T> std::ostream& operator<< (std::ostream& os, + const std::vector<T>& v) { + std::copy (v.begin(), v.end(), std::ostream_iterator<T> (std::cout, " ")); + return os; +} + +/** Early return status (so that it can be differentiated from an error). */ +const int K_RMOL_EARLY_RETURN_STATUS = 99; + +/** Read and parse the command line options. */ +int readConfiguration (int argc, char* argv[], int& lRandomDraws, + double& lCapacity, short& lMethod, + std::string& lInputFilename, std::string& lLogFilename) { + + + // Declare a group of options that will be allowed only on command line + boost::program_options::options_description generic ("Generic options"); + generic.add_options() + ("prefix", "print installation prefix") + ("version,v", "print version string") + ("help,h", "produce help message"); + + // Declare a group of options that will be allowed both on command + // line and in config file + boost::program_options::options_description config ("Configuration"); + config.add_options() + ("draws,d", + boost::program_options::value<int>(&lRandomDraws)->default_value(K_RMOL_DEFAULT_RANDOM_DRAWS), + "Number of to-be-generated random draws") + ("capacity,c", + boost::program_options::value<double>(&lCapacity)->default_value(K_RMOL_DEFAULT_CAPACITY), + "Resource capacity (e.g., for a flight leg)") + ("method,m", + boost::program_options::value<short>(&lMethod)->default_value(K_RMOL_DEFAULT_METHOD), + "Revenue Management method to be used (0 = Monte-Carlo, 1 = Dynamic Programming, 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b)") + ("input,i", + boost::program_options::value< std::string >(&lInputFilename)->default_value(K_RMOL_DEFAULT_INPUT_FILENAME), + "(CVS) input file for the demand distributions") + ("log,l", + boost::program_options::value< std::string >(&lLogFilename)->default_value(K_RMOL_DEFAULT_LOG_FILENAME), + "Filename for the logs") + ; + + // Hidden options, will be allowed both on command line and + // in config file, but will not be shown to the user. + boost::program_options::options_description hidden ("Hidden options"); + hidden.add_options() + ("copyright", + boost::program_options::value< std::vector<std::string> >(), + "Show the copyright (license)"); + + boost::program_options::options_description cmdline_options; + cmdline_options.add(generic).add(config).add(hidden); + + boost::program_options::options_description config_file_options; + config_file_options.add(config).add(hidden); + + boost::program_options::options_description visible ("Allowed options"); + visible.add(generic).add(config); + + boost::program_options::positional_options_description p; + p.add ("copyright", -1); + + boost::program_options::variables_map vm; + boost::program_options:: + store (boost::program_options::command_line_parser (argc, argv). + options (cmdline_options).positional(p).run(), vm); + + std::ifstream ifs ("rmol.cfg"); + boost::program_options::store (parse_config_file (ifs, config_file_options), + vm); + boost::program_options::notify (vm); + + if (vm.count ("help")) { + std::cout << visible << std::endl; + return K_RMOL_EARLY_RETURN_STATUS; + } + + if (vm.count ("version")) { + std::cout << PACKAGE_NAME << ", version " << PACKAGE_VERSION << std::endl; + return K_RMOL_EARLY_RETURN_STATUS; + } + + if (vm.count ("prefix")) { + std::cout << "Installation prefix: " << PREFIXDIR << std::endl; + return K_RMOL_EARLY_RETURN_STATUS; + } + + if (vm.count ("input")) { + lInputFilename = vm["input"].as< std::string >(); + std::cout << "Input filename is: " << lInputFilename << std::endl; + } + + if (vm.count ("log")) { + lLogFilename = vm["log"].as< std::string >(); + std::cout << "Log filename is: " << lLogFilename << std::endl; + } + + std::cout << "The number of random draws is: " << lRandomDraws << std::endl; + std::cout << "The resource capacity is: " << lCapacity << std::endl; + std::cout << "The Revenue Management method is: " << lMethod << std::endl; + + return 0; +} + + +// ///////// M A I N //////////// +int main (int argc, char* argv[]) { + try { + + // Number of random draws to be generated (best if greater than 100) + int lRandomDraws = 0; + + // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, + // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b) + short lMethod = 0; + + // Cabin Capacity (it must be greater then 100 here) + double lCapacity = 0.0; + + // Input file name + std::string lInputFilename; + + // Output log File + std::string lLogFilename; + + // Call the command-line option parser + const int lOptionParserStatus = + readConfiguration (argc, argv, lRandomDraws, lCapacity, lMethod, + lInputFilename, lLogFilename); + + if (lOptionParserStatus == K_RMOL_EARLY_RETURN_STATUS) { + return 0; + } + + // Check wether or not a (CSV) input file should be read + bool hasInputFile = false; + if (lInputFilename.empty() == false) { + hasInputFile = true; + } + + // Set the log parameters + std::ofstream logOutputFile; + // Open and clean the log outputfile + logOutputFile.open (lLogFilename.c_str()); + logOutputFile.clear(); + + // Initialise the list of classes/buckets + RMOL::RMOL_Service rmolService (logOutputFile, lCapacity); + rmolService.setUpStudyStatManager(); + + if (hasInputFile) { + // Read the input file + rmolService.readFromInputFile (lInputFilename); + + } 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 (lMethod) { + case 0: { + // Calculate the optimal protections by the Monte Carlo + // Integration approach + rmolService.optimalOptimisationByMCIntegration (lRandomDraws); + 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 + rmolService.heuristicOptimisationByEmsrA (); + break; + } + case 4: { + // Calculate the protections by EMSR-b + rmolService.heuristicOptimisationByEmsrB (); + break; + } + default: { + rmolService.optimalOptimisationByMCIntegration (lRandomDraws); + } + } + + } catch (const std::exception& stde) { + std::cerr << "Standard exception: " << stde.what() << std::endl; + return -1; + + } catch (...) { + return -1; + } + + return 0; +} Property changes on: trunk/rmol/rmol/batches/rmol.cpp ___________________________________________________________________ Added: svn:mergeinfo + Added: trunk/rmol/rmol/batches/sources.mk =================================================================== --- trunk/rmol/rmol/batches/sources.mk (rev 0) +++ trunk/rmol/rmol/batches/sources.mk 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,2 @@ +batches_h_sources = +batches_cc_sources = $(top_srcdir)/rmol/batches/rmol.cpp Modified: trunk/rmol/rmol/bom/Makefile.am =================================================================== --- trunk/rmol/rmol/bom/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/bom/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,16 +3,10 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libbom.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libbom_debug.la -endif + libbom_la_SOURCES= $(bom_h_sources) $(bom_cc_sources) -libbom_la_CXXFLAGS = $(CXXFLAGS_OPT) $(GSL_CFLAGS) $(BOOST_CFLAGS) -libbom_la_LIBADD = $(GSL_LIBS) +libbom_la_CXXFLAGS = $(GSL_CFLAGS) $(BOOST_CFLAGS) +libbom_la_LDFLAGS = $(GSL_LIBS) -libbom_debug_la_SOURCES = $(bom_h_sources) $(bom_cc_sources) -libbom_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) $(GSL_CFLAGS) $(BOOST_CFLAGS) -libbom_debug_la_LIBADD = $(GSL_LIBS) - #pkgincludedir = $(includedir)/@PACKAGE@/bom #pkginclude_HEADERS = $(bom_h_sources) Modified: trunk/rmol/rmol/command/Makefile.am =================================================================== --- trunk/rmol/rmol/command/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/command/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,14 +3,9 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libcmd.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libcmd_debug.la -endif + libcmd_la_SOURCES= $(cmd_h_sources) $(cmd_cc_sources) -libcmd_la_CXXFLAGS = $(CXXFLAGS_OPT) $(BOOST_CFLAGS) +libcmd_la_CXXFLAGS = $(BOOST_CFLAGS) -libcmd_debug_la_SOURCES = $(cmd_h_sources) $(cmd_cc_sources) -libcmd_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) $(BOOST_CFLAGS) - #pkgincludedir = $(includedir)/@PACKAGE@/command #pkginclude_HEADERS = $(cmd_h_sources) Property changes on: trunk/rmol/rmol/config ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile rmol-paths.hpp Added: trunk/rmol/rmol/config/Makefile.am =================================================================== --- trunk/rmol/rmol/config/Makefile.am (rev 0) +++ trunk/rmol/rmol/config/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,25 @@ +include $(top_srcdir)/Makefile.common + +## Source directory + +DISTCLEANFILES = @PACKAGE@-paths.hpp + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = @PACKAGE@-paths.hpp + +# Targets +all-local: @PACKAGE@-paths.hpp + +@PACKAGE@-paths.hpp: Makefile + @echo '#ifndef __OPENTREP_PATHS_HPP' > $@ + @echo '#define __OPENTREP_PATHS_HPP' >> $@ + @echo '#define PACKAGE "@PACKAGE@"' >> $@ + @echo '#define PACKAGE_NAME "@PACKAGE_NAME@"' >> $@ + @echo '#define PACKAGE_VERSION "@VERSION@"' >> $@ + @echo '#define PREFIXDIR "$(prefix)"' >> $@ + @echo '#define BINDIR "$(bindir)"' >> $@ + @echo '#define LIBEXECDIR "$(libexecdir)"' >> $@ + @echo '#define DATADIR "$(datadir)"' >> $@ + @echo '#define DOCDIR "$(docdir)"' >> $@ + @echo '#endif // __OPENTREP_PATHS_HPP' >> $@ Property changes on: trunk/rmol/rmol/core ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile Makefile.in Added: trunk/rmol/rmol/core/Makefile.am =================================================================== --- trunk/rmol/rmol/core/Makefile.am (rev 0) +++ trunk/rmol/rmol/core/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,24 @@ +include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk + +## Source directory + +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = + + +# Library +lib_LTLIBRARIES = lib@PACKAGE@.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 = \ + $(BOOST_DATE_TIME_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) \ + $(GSL_LIBS) -version-info $(GENERIC_LIBRARY_VERSION) Copied: trunk/rmol/rmol/core/sources.mk (from rev 201, trunk/rmol/rmol/sources.mk) =================================================================== --- trunk/rmol/rmol/core/sources.mk (rev 0) +++ trunk/rmol/rmol/core/sources.mk 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,3 @@ +service_h_sources = $(top_srcdir)/rmol/RMOL_Types.hpp \ + $(top_srcdir)/rmol/RMOL_Service.hpp +service_cc_sources = Property changes on: trunk/rmol/rmol/core/sources.mk ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/rmol/rmol/factory/Makefile.am =================================================================== --- trunk/rmol/rmol/factory/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/factory/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,14 +3,9 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libfac.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libfac_debug.la -endif + libfac_la_SOURCES= $(fac_h_sources) $(fac_cc_sources) -libfac_la_CXXFLAGS = $(CXXFLAGS_OPT) +libfac_la_CXXFLAGS = -libfac_debug_la_SOURCES = $(fac_h_sources) $(fac_cc_sources) -libfac_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) - #pkgincludedir = $(includedir)/@PACKAGE@/factory #pkginclude_HEADERS = $(fac_h_sources) Modified: trunk/rmol/rmol/field/Makefile.am =================================================================== --- trunk/rmol/rmol/field/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/field/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,14 +3,9 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libfld.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libfld_debug.la -endif + libfld_la_SOURCES= $(fld_h_sources) $(fld_cc_sources) -libfld_la_CXXFLAGS = $(CXXFLAGS_OPT) +libfld_la_CXXFLAGS = -libfld_debug_la_SOURCES = $(fld_h_sources) $(fld_cc_sources) -libfld_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) - #pkgincludedir = $(includedir)/@PACKAGE@/field #pkginclude_HEADERS = $(fld_h_sources) Deleted: trunk/rmol/rmol/rmol.cpp =================================================================== --- trunk/rmol/rmol/rmol.cpp 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/rmol.cpp 2009-05-03 16:45:21 UTC (rev 203) @@ -1,121 +0,0 @@ -// STL -#include <iostream> -#include <sstream> -#include <fstream> -// RMOL -#include <rmol/RMOL_Service.hpp> - - -// ///////// M A I N //////////// -int main (int argc, char* argv[]) { - try { - - // Output log File - std::string lLogFilename ("rmol.log"); - - // Number of random draws to be generated (best if greater than 100) - int K = 100000; - - // Methods of optimisation (0 = Monte-Carlo, 1 = Dynamic Programming, - // 2 = EMSR, 3 = EMSR-a, 4 = EMSR-b) - short METHOD_FLAG = 0; - - // Cabin Capacity (it must be greater then 100 here) - double cabinCapacity = 500.0; - - // Input file name - std::string inputFileName ("class.csv"); - bool hasInputFile = false; - - if (argc >= 1 && argv[1] != NULL) { - std::istringstream istr (argv[1]); - istr >> lLogFilename; - } - - if (argc >= 2 && argv[2] != NULL) { - std::istringstream istr (argv[2]); - istr >> K; - } - - if (argc >= 3 && argv[3] != NULL) { - std::istringstream istr (argv[3]); - istr >> cabinCapacity; - } - - if (argc >= 4 && argv[4] != NULL) { - std::istringstream istr (argv[4]); - istr >> inputFileName; - hasInputFile = true; - } - - if (argc >= 5 && argv[5] != NULL) { - std::istringstream istr (argv[5]); - istr >> METHOD_FLAG; - } - - // Set the log parameters - std::ofstream logOutputFile; - // open and clean the log outputfile - logOutputFile.open (lLogFilename.c_str()); - logOutputFile.clear(); - - // Initialise the list of classes/buckets - RMOL::RMOL_Service rmolService (logOutputFile, cabinCapacity); - rmolService.setUpStudyStatManager(); - - 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 - rmolService.heuristicOptimisationByEmsrA (); - break; - - case 4 : // Calculate the protections by EMSR-b - rmolService.heuristicOptimisationByEmsrB (); - break; - - default : rmolService.optimalOptimisationByMCIntegration (K); - } - - } catch (const std::exception& stde) { - std::cerr << "Standard exception: " << stde.what() << std::endl; - return -1; - - } catch (...) { - return -1; - } - - return 0; -} Modified: trunk/rmol/rmol/service/Makefile.am =================================================================== --- trunk/rmol/rmol/service/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/service/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -3,14 +3,9 @@ include $(srcdir)/sources.mk noinst_LTLIBRARIES= libsvc.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libsvc_debug.la -endif + libsvc_la_SOURCES= $(svc_h_sources) $(svc_cc_sources) -libsvc_la_CXXFLAGS = $(CXXFLAGS_OPT) +libsvc_la_CXXFLAGS = -libsvc_debug_la_SOURCES = $(svc_h_sources) $(svc_cc_sources) -libsvc_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) - #pkgincludedir = $(includedir)/@PACKAGE@/service #pkginclude_HEADERS = $(cmd_h_sources) Deleted: trunk/rmol/rmol/sources.mk =================================================================== --- trunk/rmol/rmol/sources.mk 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol/sources.mk 2009-05-03 16:45:21 UTC (rev 203) @@ -1,3 +0,0 @@ -service_h_sources = $(top_srcdir)/rmol/RMOL_Types.hpp \ - $(top_srcdir)/rmol/RMOL_Service.hpp -service_cc_sources = $(top_srcdir)/rmol/rmol.cpp Modified: trunk/rmol/rmol.spec.in =================================================================== --- trunk/rmol/rmol.spec.in 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/rmol.spec.in 2009-05-03 16:45:21 UTC (rev 203) @@ -121,6 +121,9 @@ %changelog +* Sun May 03 2009 Denis Arnaud <den...@m4...> 0.20.0-1 +- Upstream integration + * Sun Mar 25 2009 Denis Arnaud <den...@m4...> 0.19.0-1 - RPM release for Fedora 10 Modified: trunk/rmol/test/Makefile.am =================================================================== --- trunk/rmol/test/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/test/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -1,26 +1,27 @@ -## command sub-directory +## test sub-directory include $(top_srcdir)/Makefile.common MAINTAINERCLEANFILES = Makefile.in ## -SUBDIRS = com +SUBDIRS = samples com +EXTRA_DIST = testLib.sh ## + check_PROGRAMS = OptimiseTestSuite SimulateTestSuite TESTS = $(check_PROGRAMS) XFAIL_TESTS = #IndexBuildingTestSuite OptimiseTestSuite_SOURCES = OptimiseTestSuite.hpp OptimiseTestSuite.cpp OptimiseTestSuite_CXXFLAGS= $(BOOST_CFLAGS) $(CPPUNIT_CFLAGS) -OptimiseTestSuite_LDFLAGS = $(BOOST_LIBS) $(CPPUNIT_LIBS) -OptimiseTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la \ - $(top_builddir)/@PACKAGE@/lib@PACKAGE@.la +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_LDFLAGS = $(BOOST_LIBS) $(GSL_LIBS) $(CPPUNIT_LIBS) -SimulateTestSuite_LDADD = $(top_builddir)/test/com/libcppunitcore.la - - -EXTRA_DIST = sample1.csv sample2.csv sample3.csv sample4.csv testLib.sh +SimulateTestSuite_LDADD = +SimulateTestSuite_LDFLAGS = $(BOOST_LIBS) $(GSL_LIBS) $(CPPUNIT_LIBS) \ + $(top_builddir)/test/com/libcppunitcore.la Modified: trunk/rmol/test/SimulateTestSuite.cpp =================================================================== --- trunk/rmol/test/SimulateTestSuite.cpp 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/test/SimulateTestSuite.cpp 2009-05-03 16:45:21 UTC (rev 203) @@ -66,9 +66,6 @@ // Length of the Simulation (time-length) const int kSimulationLength = 365; - // Number of draws - const int K = 1000; - // Rate, expressed as a number of events per day // (lambda => mu = 1/ lambda) const double lambda = 10.0; Modified: trunk/rmol/test/com/Makefile.am =================================================================== --- trunk/rmol/test/com/Makefile.am 2009-05-03 12:54:10 UTC (rev 202) +++ trunk/rmol/test/com/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -1,18 +1,12 @@ -## command sub-directory +## test/com sub-directory include $(top_srcdir)/Makefile.common include $(srcdir)/sources.mk MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = + noinst_LTLIBRARIES= libcppunitcore.la -if ENABLE_DEBUG -noinst_LTLIBRARIES += libcppunitcore_debug.la -endif libcppunitcore_la_SOURCES = $(test_com_h_sources) $(test_com_cc_sources) -libcppunitcore_la_CXXFLAGS = $(CXXFLAGS_OPT) $(CPPUNIT_CFLAGS) - -libcppunitcore_debug_la_SOURCES = $(test_com_h_sources) $(test_com_cc_sources) -libcppunitcore_debug_la_CXXFLAGS = $(CXXFLAGS_DEBUG) $(CPPUNIT_CFLAGS) - -EXTRA_DIST = +libcppunitcore_la_CXXFLAGS = $(CPPUNIT_CFLAGS) Property changes on: trunk/rmol/test/samples ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile Added: trunk/rmol/test/samples/Makefile.am =================================================================== --- trunk/rmol/test/samples/Makefile.am (rev 0) +++ trunk/rmol/test/samples/Makefile.am 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,7 @@ +## test/samples sub-directory +include $(top_srcdir)/Makefile.common +include $(srcdir)/sources.mk + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = sample1.csv sample2.csv sample3.csv sample4.csv Added: trunk/rmol/test/samples/sources.mk =================================================================== --- trunk/rmol/test/samples/sources.mk (rev 0) +++ trunk/rmol/test/samples/sources.mk 2009-05-03 16:45:21 UTC (rev 203) @@ -0,0 +1,4 @@ +test_com_h_sources = $(top_srcdir)/test/com/CppUnitCore.hpp \ + $(top_srcdir)/test/com/XmlOutputterHookForCC.hpp +test_com_cc_sources = $(top_srcdir)/test/com/CppUnitCore.cpp \ + $(top_srcdir)/test/com/XmlOutputterHookForCC.cpp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-03 12:54:12
|
Revision: 202 http://rmol.svn.sourceforge.net/rmol/?rev=202&view=rev Author: denis_arnaud Date: 2009-05-03 12:54:10 +0000 (Sun, 03 May 2009) Log Message: ----------- [R] Added the RM2 (RM for R) project. Added Paths: ----------- trunk/rmol/R/ trunk/rmol/R/README trunk/rmol/R/RM2/ trunk/rmol/R/RM2/DESCRIPTION trunk/rmol/R/RM2/NAMESPACE trunk/rmol/R/RM2/R/ trunk/rmol/R/RM2/R/EM.R trunk/rmol/R/RM2/R/EMSRb.R trunk/rmol/R/RM2/R/EMSRb_internal.R trunk/rmol/R/RM2/R/EM_internal.R trunk/rmol/R/RM2/R/PD.R trunk/rmol/R/RM2/R/PD_internal.R trunk/rmol/R/RM2/RM2.pdf trunk/rmol/R/RM2/man/ trunk/rmol/R/RM2/man/EM.Rd trunk/rmol/R/RM2/man/EMSRb.Rd trunk/rmol/R/RM2/man/EMSRb_internal.Rd trunk/rmol/R/RM2/man/EM_internal.Rd trunk/rmol/R/RM2/man/PD.Rd trunk/rmol/R/RM2/man/PD_internal.Rd Added: trunk/rmol/R/README =================================================================== --- trunk/rmol/R/README (rev 0) +++ trunk/rmol/R/README 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,9 @@ + +This directory contains the contribution, for the R platform +(http://www.r-project.org), from Tudor Bodea (tud...@ih...), +Dev Koushik (dev...@ih...) and Mark +Ferguson (mar...@mg...). + +The original documentation and source tar-ball can be retrieved on +the CRAN-R dedicated site: http://cran.r-project.org/src/contrib. + Added: trunk/rmol/R/RM2/DESCRIPTION =================================================================== --- trunk/rmol/R/RM2/DESCRIPTION (rev 0) +++ trunk/rmol/R/RM2/DESCRIPTION 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,11 @@ +Package: RM2 +Version: 0.0 +Date: 2008-07-16 +Title: Revenue Management and Pricing Package +Author: Tudor Bodea <tud...@ih...> & Dev Koushik <dev...@ih...> & Mark Ferguson <mar...@mg...>. +Maintainer: Tudor Bodea <tud...@ih...> +Depends: R (>= 2.7.1), msm +Description: RM2 is a simple package that implements functions + used in revenue management and pricing environments. +License: GPL (version 3 or later) +Packaged: Wed Aug 13 07:58:00 2008; BodeaTu Added: trunk/rmol/R/RM2/NAMESPACE =================================================================== --- trunk/rmol/R/RM2/NAMESPACE (rev 0) +++ trunk/rmol/R/RM2/NAMESPACE 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1 @@ +export(EMSRb, EM, PD) Added: trunk/rmol/R/RM2/R/EM.R =================================================================== --- trunk/rmol/R/RM2/R/EM.R (rev 0) +++ trunk/rmol/R/RM2/R/EM.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,4 @@ +EM = function (demand = demand, eps = 0.005) { + res <- try(RM2:::EM_internal(demand, eps), silent = TRUE) + if (class(res) == 'try-error') {print("Warning: All demand instances are unconstrained")} else {return(res)} +} # end EM function Added: trunk/rmol/R/RM2/R/EMSRb.R =================================================================== --- trunk/rmol/R/RM2/R/EMSRb.R (rev 0) +++ trunk/rmol/R/RM2/R/EMSRb.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,3 @@ +EMSRb = function(Fare = Fare, Mean = Mean, Var = Var, p_up = numeric(length(Fare)), cap = cap) { + return(RM2:::EMSRb_internal(Fare, Mean, Var, p_up, cap)) +} # end function Added: trunk/rmol/R/RM2/R/EMSRb_internal.R =================================================================== --- trunk/rmol/R/RM2/R/EMSRb_internal.R (rev 0) +++ trunk/rmol/R/RM2/R/EMSRb_internal.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,28 @@ +EMSRb_internal = function (Fare = Fare, Mean = Mean, Var = Var, p_up = numeric(length(Fare)), cap = cap) { + N_FProd <- length(Fare) + # ASSURE CONSISTENCY OF THE INPUTS + tmp <- sort.int(Fare, decreasing=T, method = "sh", index.return=TRUE) + Fare <- tmp$x + ind <- tmp$ix + Mean <- Mean[ind] + Var <- Var[ind] + p_up <- p_up[ind] + # INITIALIZE PROTECTION LEVELS + p <- vector(mode="numeric", length(Fare)) + for (i in 1:(length(Fare)-1)) { + # WEIGHTED AVERAGE REVENUE: wr + wr <- sum(Fare[1:i]*Mean[1:i])/sum(Mean[1:i]) + # MEAN AGGREGATE DEMAND + X <- sum(Mean[1:i]) + # STANDARD DEVIATION AGGREGATE DEMAND + Sigma <- sqrt(sum(Var[1:i])) + # COMPUTE CURRENT PROTECTION LEVEL + p[i] <- qnorm((1 / (1 - p_up[i+1])) * (1 - Fare[i+1]/wr), mean=X, sd=Sigma) + } # end for i + p[length(Fare)] <- cap + # INTEGER PROTECTION LEVELS + p <- ceiling(p) + p <- p * (p < cap) + cap * (p >= cap) + names(p) <- as.character(Fare) + return(p) +} # end function Added: trunk/rmol/R/RM2/R/EM_internal.R =================================================================== --- trunk/rmol/R/RM2/R/EM_internal.R (rev 0) +++ trunk/rmol/R/RM2/R/EM_internal.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,40 @@ +EM_internal = function(demand = demand, eps = 0.005) { + # M - NUMBER OF CONSTRAINED DEMAND INSTANCES; N - NUMBER OF UNCONSTRAINED DEMAND INSTANCES + M <- length(demand[names(demand) == "1"]) + if (M == 0) {stop("Warning: All demand instances are unconstrained")} + else { + N <- length(demand[names(demand) == "0"]) + # INITIALIZATION: COMPUTE THE MEAN AND THE STANDARD DEVIATION USING THE UNCONSTRAINED DEMAND VALUES + mean_v <- sum(demand[names(demand) == "0"])/N + sd_v <- sqrt(sum((demand[names(demand) == "0"] - mean_v)^2)/N) + history <- as.data.frame(matrix(c(mean_v, sd_v), 1,2)) + # SPECIFY WHERE THE DISTRIBUTIONS ARE LEFT TRUNCATED + bl_const <- demand[names(demand) == "1"] + # INITIALIZE NUMBER OF ITERATIONS + niter <- 1 + repeat { + # EXPECTATION: COMPUTE EXPECTED VALUES OF THE TRUNCATED NORMAL DISTRIBUTIONS + tmp <- (bl_const - mean_v)/sd_v + hazard <- dnorm(tmp) / (1 - pnorm(tmp)) + exp.trunc <- mean_v + hazard * sd_v + exp.trunc2 <- mean_v^2 + sd_v^2 + sd_v^2 * hazard * tmp + 2 * mean_v * sd_v * hazard + demand[names(demand) == "1"] <- exp.trunc + # MAXIMIZATION: COMPUTE THE NEW VALUES FOR THE MEAN AND THE STANDARD DEVIATION + new_mean_v <- sum(demand) / (N + M) + new_sd_v <- sqrt(1 / (N+M) * (sum(exp.trunc2) - 2 * mean_v * sum(exp.trunc) + M * mean_v^2 + sum((demand[names(demand) == "0"] - mean_v)^2))) + if (sum(c(abs(new_mean_v - mean_v), abs(new_sd_v - sd_v)) > eps) == 0 ){ + niter <- niter + 1 + history <- rbind(history, c(new_mean_v, new_sd_v)) + break + } + else { + niter <- niter + 1 + history <- rbind(history, c(new_mean_v, new_sd_v)) + mean_v <- new_mean_v + sd_v <- new_sd_v + } + } # end repeat + names(history) <- c("Mean", "StDev") + return(list(param = round(c(new_mean_v, new_sd_v), 2), niter = niter, demand = round(demand, 2), history = round(history, 2))) + } # end if +} # end EM_internal function Added: trunk/rmol/R/RM2/R/PD.R =================================================================== --- trunk/rmol/R/RM2/R/PD.R (rev 0) +++ trunk/rmol/R/RM2/R/PD.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,4 @@ +PD = function (demand = demand, tau = 0.5, eps = 0.005) { + res <- try(RM2:::PD_internal(demand, tau, eps), silent = TRUE) + if (class(res) == 'try-error') {print("Warning: All demand instances are unconstrained")} else {return(res)} +} # end PD function Added: trunk/rmol/R/RM2/R/PD_internal.R =================================================================== --- trunk/rmol/R/RM2/R/PD_internal.R (rev 0) +++ trunk/rmol/R/RM2/R/PD_internal.R 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,42 @@ +PD_internal = function(demand = demand, tau = 0.5, eps = 0.005) { + # CHECK IF msm LIBRARY EXISTS + # library(msm) + # M - NUMBER OF CONSTRAINED DEMAND INSTANCES; N - NUMBER OF UNCONSTRAINED DEMAND INSTANCES + M <- length(demand[names(demand) == "1"]) + if (M == 0) {stop("Warning: All demand instances are unconstrained")} + else { + N <- length(demand[names(demand) == "0"]) + # INITIALIZATION: COMPUTE THE MEAN AND THE STANDARD DEVIATION USING THE UNCONSTRAINED DEMAND VALUES + mean_v <- sum(demand[names(demand) == "0"])/N + sd_v <- sqrt(sum((demand[names(demand) == "0"] - mean_v)^2)/N) + history <- as.data.frame(matrix(c(mean_v, sd_v), 1,2)) + # SPECIFY WHERE THE DISTRIBUTIONS ARE LEFT TRUNCATED + bl_const <- demand[names(demand) == "1"] + # INITIALIZE NUMBER OF ITERATIONS + niter <- 1 + repeat { + # EXPECTATION: COMPUTE EXPECTED VALUES OF THE TRUNCATED NORMAL DISTRIBUTIONS + tmp <- numeric() + for (ind_constr in 1:length(bl_const)) { + tmp <- c(tmp, qtnorm(tau, mean = mean_v, sd = sd_v, lower = bl_const[ind_constr], upper = Inf, lower.tail = F)) + } # end for ind_constr + demand[names(demand) == "1"] <- tmp + # MAXIMIZATION: COMPUTE THE NEW VALUES FOR THE MEAN AND THE STANDARD DEVIATION + new_mean_v <- mean(demand) + new_sd_v <- sd(demand) + if (sum(c(abs(new_mean_v - mean_v), abs(new_sd_v - sd_v)) > eps) == 0 ){ + niter <- niter + 1 + history <- rbind(history, c(new_mean_v, new_sd_v)) + break + } + else { + niter <- niter + 1 + history <- rbind(history, c(new_mean_v, new_sd_v)) + mean_v <- new_mean_v + sd_v <- new_sd_v + } + } # end repeat + names(history) <- c("Mean", "StDev") + return(list(param = round(c(new_mean_v, new_sd_v), 2), niter = niter, demand = round(demand, 2), history = round(history, 2))) + } # end if +} # end PD_internal function Added: trunk/rmol/R/RM2/RM2.pdf =================================================================== (Binary files differ) Property changes on: trunk/rmol/R/RM2/RM2.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/rmol/R/RM2/man/EM.Rd =================================================================== --- trunk/rmol/R/RM2/man/EM.Rd (rev 0) +++ trunk/rmol/R/RM2/man/EM.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,54 @@ +\name{EM} +\alias{EM} +\title{ Unconstrain the demand using the Expectation-Maximization algorithm } +\description{ + \code{EM} unconstrains demand data in quantity-based revenue management. +} +\usage{ +EM(demand = demand, eps = 0.005) +} +\arguments{ + \item{demand}{ demand vector with constrained and unconstrained entries. A 0 in the name of an entry means that the corresponding demand is unconstrained. Conversely, a 1 in the name of an entry suggests that the corresponding demand is constrained. } + \item{eps}{ small number used as the stopping criterion. The default value is 0.005.} +} +\details{ + \code{EM} unconstrains demand data in quantity-based revenue management. The observed demand entries, some of which are constrained because the product class was closed, are assumed to be realizations from an underlying normal distribution with mean \eqn{\mu} and standard deviation \eqn{\sigma}. The objective is to find the parameters \eqn{\mu} and \eqn{\sigma} of this underlying demand distribution. +} +\value{ + \item{param}{ parameters of demand distribution } + \item{niter}{ number of iterations } + \item{demand}{ unconstrained demand vector} + \item{history}{ parameter convergence history } +} +\references{ Talluri, K. T. and Van Ryzin, G. (2004) \emph{The Theory and Practice of Revenue Management}. New York, NY: Springer Science + Business Media, Inc. (Pages 474--477).} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\examples{ +# SPECIFY THE SEED +set.seed(333) +# SPECIFY REAL PARAMETERS OF THE DEMAND DISTRIBUTION +rmean <- 20 +rsd <- 4 +nrn <- 20 +# GENERATE REAL DEMAND +rdemand <- round(rnorm(nrn, rmean, rsd)) +# GENERATE BOOKING LIMITS +bl <- round(rnorm(nrn, rmean, rsd)) +# GENERATE OBSERVED DEMAND +demand <- rdemand * (rdemand <= bl) + bl * (rdemand > bl) +# IDENTIFIED PERIODS WITH CONSTRAINED DEMAND: 1 - CONSTRAINED DEMAND +names(demand) <- as.character(as.numeric(rdemand>bl)) +demand +# UNTRUNCATE DEMAND +EM(demand) +EM(demand, eps=0.005) +EM(demand, eps=0.00005) +# MODIFY DEMAND VECTOR - NO CONSTRAINED INSTANCES ARE OBSERVED +names(demand) <- rep(0, length(demand)) +# ATTEMPT TO UNTRUNCATE THE DEMAND +EM(demand, eps=0.005) +} +\keyword{ optimize } Property changes on: trunk/rmol/R/RM2/man/EM.Rd ___________________________________________________________________ Added: svn:executable + * Added: trunk/rmol/R/RM2/man/EMSRb.Rd =================================================================== --- trunk/rmol/R/RM2/man/EMSRb.Rd (rev 0) +++ trunk/rmol/R/RM2/man/EMSRb.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,37 @@ +\name{EMSRb} +\alias{EMSRb} +\title{ Perform EMSR-b with Buy-up Heuristic for the Single-Resource Problem } +\description{ + \code{EMSRb} heuristic sets the protection levels for multiple fare classes. +} +\usage{ +EMSRb(Fare = Fare, Mean = Mean, Var = Var, p_up = numeric(length(Fare)), cap = cap) +} +\arguments{ + \item{Fare}{ revenue vector associated with selling the offered products } + \item{Mean}{ mean product demand } + \item{Var}{ product demand variance } + \item{p_up}{ buy-up probabilities. The default entails no buy-up probabilities. } + \item{cap}{ available capacity } +} +\details{ + \code{EMSRb} sorts internally the \code{Fare} vector together with all other input vectors in descending order of the revenues. If \code{p_up} is missing, \code{EMSRb} performs the classical EMSRb heuristic. +} +\value{ + \item{p}{ protection levels } +} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\examples{ +## Run a simple EMRSb instance +Fare <- c(150, 100, 50, 250) +Mean <- c(75, 125, 500, 50) +Var <- c(75, 125, 500, 50) +cap <- 400 +p <- EMSRb(Fare = Fare, Mean = Mean, Var = Var, cap = cap) +p +} +\keyword{ optimize } Property changes on: trunk/rmol/R/RM2/man/EMSRb.Rd ___________________________________________________________________ Added: svn:executable + * Added: trunk/rmol/R/RM2/man/EMSRb_internal.Rd =================================================================== --- trunk/rmol/R/RM2/man/EMSRb_internal.Rd (rev 0) +++ trunk/rmol/R/RM2/man/EMSRb_internal.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,28 @@ +\name{EMSRb_internal} +\alias{EMSRb_internal} +\title{ Perform EMSR-b with Buy-up Heuristic for the Single-Resource Problem } +\description{ + \code{EMSRb_internal} is called by \code{EMRSb} and sets the protection levels for multiple fare classes. +} +\usage{ +EMSRb_internal(Fare = Fare, Mean = Mean, Var = Var, p_up = numeric(length(Fare)), cap = cap) +} +\arguments{ + \item{Fare}{ revenue vector associated with selling the offered products } + \item{Mean}{ mean product demand } + \item{Var}{ product demand variance } + \item{p_up}{ buy-up probabilities. The default entails no buy-up probabilities. } + \item{cap}{ available capacity } +} +\details{ + \code{EMSRb_internal} sorts internally the \code{Fare} vector together with all other input vectors in descending order of the revenues. If \code{p_up} is missing, \code{EMSRb_internal} performs the classical EMSRb heuristic. +} +\value{ + \item{p}{ protection levels } +} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\keyword{ internal } Property changes on: trunk/rmol/R/RM2/man/EMSRb_internal.Rd ___________________________________________________________________ Added: svn:executable + * Added: trunk/rmol/R/RM2/man/EM_internal.Rd =================================================================== --- trunk/rmol/R/RM2/man/EM_internal.Rd (rev 0) +++ trunk/rmol/R/RM2/man/EM_internal.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,29 @@ +\name{EM_internal} +\alias{EM_internal} +\title{ Unconstrain the demand using the Expectation-Maximization algorithm } +\description{ + \code{EM_internal} is the internal function called by \code{EM} . +} +\usage{ +EM_internal(demand = demand, eps = 0.005) +} +\arguments{ + \item{demand}{ demand vector with constrained and unconstrained entries. A 0 in the name of an entry means that the corresponding demand is unconstrained. Conversely, a 1 in the name of an entry suggests that the corresponding demand is constrained. } + \item{eps}{ small number used as the stopping criterion. The default value is 0.005.} +} +\details{ + \code{EM_internal} unconstrains demand data in quantity-based revenue management. +} +\value{ + \item{param}{ parameters of demand distribution } + \item{niter}{ number of iterations } + \item{demand}{ unconstrained demand } + \item{history}{ convergence history } +} +\references{ Talluri, K. T. and Van Ryzin, G. (2004) \emph{The Theory and Practice of Revenue Management}. New York, NY: Springer Science + Business Media, Inc. (Pages 474-477).} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\keyword{ internal } Property changes on: trunk/rmol/R/RM2/man/EM_internal.Rd ___________________________________________________________________ Added: svn:executable + * Added: trunk/rmol/R/RM2/man/PD.Rd =================================================================== --- trunk/rmol/R/RM2/man/PD.Rd (rev 0) +++ trunk/rmol/R/RM2/man/PD.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,55 @@ +\name{PD} +\alias{PD} +\title{ Unconstrain the demand using the Projection-Detruncation algorithm } +\description{ + \code{PD} unconstrains demand data in quantity-based revenue management. +} +\usage{ +PD(demand = demand, tau = 0.5, eps = 0.005) +} +\arguments{ + \item{demand}{ demand vector with constrained and unconstrained entries. A 0 in the name of an entry means that the corresponding demand is unconstrained. Conversely, a 1 in the name of an entry suggests that the corresponding demand is constrained. } + \item{tau}{ fixed constant that reflects how aggresive the unconstrainig is. The default value is 0.5.} + \item{eps}{ small number used as the stopping criterion. The default value is 0.005.} +} +\details{ + \code{PD} unconstrains demand data in quantity-based revenue management. The observed demand entries, some of which are constrained because the product class was closed, are assumed to be realizations from an underlying normal distribution with mean \eqn{\mu} and standard deviation \eqn{\sigma}. The objective is to find the parameters \eqn{\mu} and \eqn{\sigma} of this underlying demand distribution. +} +\value{ + \item{param}{ parameters of demand distribution } + \item{niter}{ number of iterations } + \item{demand}{ unconstrained demand vector} + \item{history}{ parameter convergence history } +} +\references{ Talluri, K. T. and Van Ryzin, G. (2004) \emph{The Theory and Practice of Revenue Management}. New York, NY: Springer Science + Business Media, Inc. (Pages 485--486).} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\examples{ +# SPECIFY THE SEED +set.seed(333) +# SPECIFY REAL PARAMETERS OF THE DEMAND DISTRIBUTION +rmean <- 20 +rsd <- 4 +nrn <- 20 +# GENERATE REAL DEMAND +rdemand <- round(rnorm(nrn, rmean, rsd)) +# GENERATE BOOKING LIMITS +bl <- round(rnorm(nrn, rmean, rsd)) +# GENERATE OBSERVED DEMAND +demand <- rdemand * (rdemand <= bl) + bl * (rdemand > bl) +# IDENTIFIED PERIODS WITH CONSTRAINED DEMAND: 1 - CONSTRAINED DEMAND +names(demand) <- as.character(as.numeric(rdemand>bl)) +demand +# UNTRUNCATE DEMAND +PD(demand) +PD(demand, tau=0.5, eps=0.005) +PD(demand, tau=0.5, eps=0.00005) +# MODIFY DEMAND VECTOR - NO CONSTRAINED INSTANCES ARE OBSERVED +names(demand) <- rep(0, length(demand)) +# ATTEMPT TO UNTRUNCATE THE DEMAND +PD(demand, tau=0.5, eps=0.005) +} +\keyword{ optimize } Property changes on: trunk/rmol/R/RM2/man/PD.Rd ___________________________________________________________________ Added: svn:executable + * Added: trunk/rmol/R/RM2/man/PD_internal.Rd =================================================================== --- trunk/rmol/R/RM2/man/PD_internal.Rd (rev 0) +++ trunk/rmol/R/RM2/man/PD_internal.Rd 2009-05-03 12:54:10 UTC (rev 202) @@ -0,0 +1,30 @@ +\name{PD_internal} +\alias{PD_internal} +\title{ Unconstrain the demand using the Projection-Detruncation algorithm } +\description{ + \code{PD_internal} is the internal function called by \code{PD} . +} +\usage{ +PD_internal(demand = demand, tau = 0.5, eps = 0.005) +} +\arguments{ + \item{demand}{ demand vector with constrained and unconstrained entries. A 0 in the name of an entry means that the corresponding demand is unconstrained. Conversely, a 1 in the name of an entry suggests that the corresponding demand is constrained. } + \item{tau}{ fixed constant that reflects how aggresive the unconstrainig is. The default value is 0.5.} + \item{eps}{ small number used as the stopping criterion. The default value is 0.005.} +} +\details{ + \code{PD_internal} unconstrains demand data in quantity-based revenue management. +} +\value{ + \item{param}{ parameters of demand distribution } + \item{niter}{ number of iterations } + \item{demand}{ unconstrained demand } + \item{history}{ convergence history } +} +\references{ Talluri, K. T. and Van Ryzin, G. (2004) \emph{The Theory and Practice of Revenue Management}. New York, NY: Springer Science + Business Media, Inc. (Pages 485-486).} +\author{ +Tudor Bodea \email{tud...@ih...} \cr +Dev Koushik \email{dev...@ih...} \cr +Mark Ferguson \email{mar...@mg...} +} +\keyword{ internal } Property changes on: trunk/rmol/R/RM2/man/PD_internal.Rd ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <den...@us...> - 2009-05-02 23:51:19
|
Revision: 201 http://rmol.svn.sourceforge.net/rmol/?rev=201&view=rev Author: denis_arnaud Date: 2009-05-02 23:51:11 +0000 (Sat, 02 May 2009) Log Message: ----------- [Conf] Added datarootdir within the po/Makefile.in.in Modified Paths: -------------- trunk/rmol/po/Makefile.in.in Modified: trunk/rmol/po/Makefile.in.in =================================================================== --- trunk/rmol/po/Makefile.in.in 2009-04-24 10:19:45 UTC (rev 200) +++ trunk/rmol/po/Makefile.in.in 2009-05-02 23:51:11 UTC (rev 201) @@ -22,6 +22,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ datadir = @datadir@ localedir = $(datadir)/locale gettextsrcdir = $(datadir)/gettext/po This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |