From: <qua...@us...> - 2010-08-20 14:54:06
|
Revision: 273 http://stdair.svn.sourceforge.net/stdair/?rev=273&view=rev Author: quannaus Date: 2010-08-20 14:53:57 +0000 (Fri, 20 Aug 2010) Log Message: ----------- [dev] Implemented a new architecture for stdair. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Types.hpp trunk/stdair/stdair/basic/sources.mk trunk/stdair/stdair/batches/stdair.cpp trunk/stdair/stdair/bom/AirlineFeature.cpp trunk/stdair/stdair/bom/AirlineFeature.hpp trunk/stdair/stdair/bom/AirlineFeatureKey.cpp trunk/stdair/stdair/bom/AirlineFeatureKey.hpp trunk/stdair/stdair/bom/AirlineFeatureTypes.hpp trunk/stdair/stdair/bom/BomManager.cpp trunk/stdair/stdair/bom/BomManager.hpp trunk/stdair/stdair/bom/BomRoot.cpp trunk/stdair/stdair/bom/BomRoot.hpp trunk/stdair/stdair/bom/BomRootKey.cpp trunk/stdair/stdair/bom/BomRootKey.hpp trunk/stdair/stdair/bom/BookingClass.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/BookingClassKey.cpp trunk/stdair/stdair/bom/BookingClassKey.hpp trunk/stdair/stdair/bom/BookingClassTypes.hpp trunk/stdair/stdair/bom/BookingRequestStruct.hpp trunk/stdair/stdair/bom/Bucket.cpp trunk/stdair/stdair/bom/Bucket.hpp trunk/stdair/stdair/bom/BucketKey.cpp trunk/stdair/stdair/bom/BucketKey.hpp trunk/stdair/stdair/bom/BucketTypes.hpp trunk/stdair/stdair/bom/EventQueue.hpp trunk/stdair/stdair/bom/EventStruct.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/FlightDateKey.cpp trunk/stdair/stdair/bom/FlightDateKey.hpp trunk/stdair/stdair/bom/FlightDateTypes.hpp trunk/stdair/stdair/bom/FlightPeriod.cpp trunk/stdair/stdair/bom/FlightPeriod.hpp trunk/stdair/stdair/bom/FlightPeriodKey.cpp trunk/stdair/stdair/bom/FlightPeriodKey.hpp trunk/stdair/stdair/bom/FlightPeriodTypes.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/InventoryKey.cpp trunk/stdair/stdair/bom/InventoryKey.hpp trunk/stdair/stdair/bom/InventoryTypes.hpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/LegCabinKey.cpp trunk/stdair/stdair/bom/LegCabinKey.hpp trunk/stdair/stdair/bom/LegCabinTypes.hpp trunk/stdair/stdair/bom/LegDate.cpp trunk/stdair/stdair/bom/LegDate.hpp trunk/stdair/stdair/bom/LegDateKey.cpp trunk/stdair/stdair/bom/LegDateKey.hpp trunk/stdair/stdair/bom/LegDateTypes.hpp trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinKey.cpp trunk/stdair/stdair/bom/SegmentCabinKey.hpp trunk/stdair/stdair/bom/SegmentCabinTypes.hpp trunk/stdair/stdair/bom/SegmentDate.cpp trunk/stdair/stdair/bom/SegmentDate.hpp trunk/stdair/stdair/bom/SegmentDateKey.cpp trunk/stdair/stdair/bom/SegmentDateKey.hpp trunk/stdair/stdair/bom/SegmentDateTypes.hpp trunk/stdair/stdair/bom/SegmentPeriod.cpp trunk/stdair/stdair/bom/SegmentPeriod.hpp trunk/stdair/stdair/bom/SegmentPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPeriodTypes.hpp trunk/stdair/stdair/bom/TravelSolutionStruct.hpp trunk/stdair/stdair/bom/YieldStore.cpp trunk/stdair/stdair/bom/YieldStore.hpp trunk/stdair/stdair/bom/YieldStoreKey.cpp trunk/stdair/stdair/bom/YieldStoreKey.hpp trunk/stdair/stdair/bom/YieldStoreTypes.hpp trunk/stdair/stdair/bom/sources.mk trunk/stdair/stdair/command/CmdBomManager.cpp trunk/stdair/stdair/command/CmdBomManager.hpp trunk/stdair/stdair/factory/sources.mk trunk/stdair/stdair/service/STDAIR_Service.cpp trunk/stdair/stdair/service/sources.mk Added Paths: ----------- trunk/stdair/stdair/bom/BomAbstract.hpp trunk/stdair/stdair/bom/KeyAbstract.hpp trunk/stdair/stdair/bom/RelationShip.hpp trunk/stdair/stdair/bom/RelationShipAbstract.hpp trunk/stdair/stdair/factory/FacAbstract.cpp trunk/stdair/stdair/factory/FacAbstract.hpp trunk/stdair/stdair/factory/FacBom.hpp trunk/stdair/stdair/factory/FacBomManager.cpp trunk/stdair/stdair/factory/FacBomManager.hpp trunk/stdair/stdair/service/FacSupervisor.cpp trunk/stdair/stdair/service/FacSupervisor.hpp Removed Paths: ------------- trunk/stdair/stdair/basic/CategoricalAttribute.hpp trunk/stdair/stdair/basic/CategoricalAttributeLite.hpp trunk/stdair/stdair/basic/ContinuousAttribute.hpp trunk/stdair/stdair/basic/ContinuousAttributeLite.hpp trunk/stdair/stdair/basic/DemandCharacteristicTypes.hpp trunk/stdair/stdair/basic/DemandCharacteristics.cpp trunk/stdair/stdair/basic/DemandCharacteristics.hpp trunk/stdair/stdair/basic/DemandDistribution.cpp trunk/stdair/stdair/basic/DemandDistribution.hpp trunk/stdair/stdair/basic/DictionaryManager.cpp trunk/stdair/stdair/basic/DictionaryManager.hpp trunk/stdair/stdair/basic/RandomGeneration.cpp trunk/stdair/stdair/basic/RandomGeneration.hpp trunk/stdair/stdair/basic/RandomGenerationContext.cpp trunk/stdair/stdair/basic/RandomGenerationContext.hpp trunk/stdair/stdair/bom/AirlineFeatureContent.cpp trunk/stdair/stdair/bom/AirlineFeatureContent.hpp trunk/stdair/stdair/bom/BomChildrenHolder.hpp trunk/stdair/stdair/bom/BomChildrenHolderImp.hpp trunk/stdair/stdair/bom/BomContent.hpp trunk/stdair/stdair/bom/BomIterator.hpp trunk/stdair/stdair/bom/BomKey.hpp trunk/stdair/stdair/bom/BomList.hpp trunk/stdair/stdair/bom/BomMap.hpp trunk/stdair/stdair/bom/BomMultimap.hpp trunk/stdair/stdair/bom/BomRootContent.cpp trunk/stdair/stdair/bom/BomRootContent.hpp trunk/stdair/stdair/bom/BomRootTypes.hpp trunk/stdair/stdair/bom/BomSource.hpp trunk/stdair/stdair/bom/BomStopContent.hpp trunk/stdair/stdair/bom/BomStructure.hpp trunk/stdair/stdair/bom/BomTypes.hpp trunk/stdair/stdair/bom/BookingClassContent.cpp trunk/stdair/stdair/bom/BookingClassContent.hpp trunk/stdair/stdair/bom/BucketContent.cpp trunk/stdair/stdair/bom/BucketContent.hpp trunk/stdair/stdair/bom/DemandStream.cpp trunk/stdair/stdair/bom/DemandStream.hpp trunk/stdair/stdair/bom/DemandStreamContent.cpp trunk/stdair/stdair/bom/DemandStreamContent.hpp trunk/stdair/stdair/bom/DemandStreamKey.cpp trunk/stdair/stdair/bom/DemandStreamKey.hpp trunk/stdair/stdair/bom/DemandStreamTypes.hpp trunk/stdair/stdair/bom/FlightDateContent.cpp trunk/stdair/stdair/bom/FlightDateContent.hpp trunk/stdair/stdair/bom/FlightPeriodContent.cpp trunk/stdair/stdair/bom/FlightPeriodContent.hpp trunk/stdair/stdair/bom/InventoryContent.cpp trunk/stdair/stdair/bom/InventoryContent.hpp trunk/stdair/stdair/bom/LegCabinContent.cpp trunk/stdair/stdair/bom/LegCabinContent.hpp trunk/stdair/stdair/bom/LegDateContent.cpp trunk/stdair/stdair/bom/LegDateContent.hpp trunk/stdair/stdair/bom/OriginDestinationSet.cpp trunk/stdair/stdair/bom/OriginDestinationSet.hpp trunk/stdair/stdair/bom/OriginDestinationSetContent.cpp trunk/stdair/stdair/bom/OriginDestinationSetContent.hpp trunk/stdair/stdair/bom/OriginDestinationSetKey.cpp trunk/stdair/stdair/bom/OriginDestinationSetKey.hpp trunk/stdair/stdair/bom/OriginDestinationSetTypes.hpp trunk/stdair/stdair/bom/ReachableUniverse.cpp trunk/stdair/stdair/bom/ReachableUniverse.hpp trunk/stdair/stdair/bom/ReachableUniverseContent.cpp trunk/stdair/stdair/bom/ReachableUniverseContent.hpp trunk/stdair/stdair/bom/ReachableUniverseKey.cpp trunk/stdair/stdair/bom/ReachableUniverseKey.hpp trunk/stdair/stdair/bom/ReachableUniverseTypes.hpp trunk/stdair/stdair/bom/SegmentCabinContent.cpp trunk/stdair/stdair/bom/SegmentCabinContent.hpp trunk/stdair/stdair/bom/SegmentDateContent.cpp trunk/stdair/stdair/bom/SegmentDateContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp trunk/stdair/stdair/bom/SegmentPathPeriod.hpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPathPeriodContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.cpp trunk/stdair/stdair/bom/SegmentPathPeriodKey.hpp trunk/stdair/stdair/bom/SegmentPathPeriodTypes.hpp trunk/stdair/stdair/bom/SegmentPeriodContent.cpp trunk/stdair/stdair/bom/SegmentPeriodContent.hpp trunk/stdair/stdair/bom/Structure.hpp trunk/stdair/stdair/bom/YieldStoreContent.cpp trunk/stdair/stdair/bom/YieldStoreContent.hpp trunk/stdair/stdair/factory/FacBomContent.cpp trunk/stdair/stdair/factory/FacBomContent.hpp trunk/stdair/stdair/factory/FacBomStructure.cpp trunk/stdair/stdair/factory/FacBomStructure.hpp trunk/stdair/stdair/factory/FacSupervisor.cpp trunk/stdair/stdair/factory/FacSupervisor.hpp Modified: trunk/stdair/stdair/STDAIR_Types.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Types.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/STDAIR_Types.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -39,12 +39,18 @@ class NonInitialisedServiceException : public RootException { }; + class NonInitialisedContainerException : public RootException { }; + + class NonInitialisedRelationShip : public RootException { }; + class MemoryAllocationException : public RootException { }; class ObjectLinkingException : public RootException { }; class ParserException : public RootException { }; + class DocumentNotFoundException : public RootException { }; + class CodeConversionException : public ParserException { }; class CodeDuplicationException : public ParserException { }; @@ -58,8 +64,6 @@ class SQLDatabaseConnectionImpossibleException : public SQLDatabaseException { }; - class DocumentNotFoundException : public RootException { }; - // /////////////// Log ///////////// /** Level of logs. */ namespace LOG { @@ -216,7 +220,7 @@ typedef double MeanValue_T; /** Define a standard deviation value (e.g., 1.5). */ - typedef double StandardDeviationValue_T; + typedef double StdDevValue_T; /** Define the cabin capacity (resource, e.g., 200 seats). <br>The capacity is expressed as a double to cope with overbooking. */ @@ -421,9 +425,6 @@ /** Probability */ typedef float Probability_T; - /** Dictionary key. */ - typedef unsigned char DictionaryKey_T; - // ////////////////////////////////////////////////////////////////////// // Date / Time /** Time duration in (integer) number of seconds */ @@ -476,4 +477,82 @@ typedef std::map<CabinCode_T, ClassList_String_T> CabinBookingClassMap_T; } + +#define CATCH \ + catch (const stdair::FileNotFoundException& ex) { \ + std::cerr << "FileNotFoundException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedLogServiceException& ex) { \ + std::cerr << "NonInitialisedLogServiceException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedDBSessionManagerException& ex) { \ + std::cerr << "NonInitialisedDBSessionManagerException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedServiceException& ex) { \ + std::cerr << "NonInitialisedServiceException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedContainerException& ex) { \ + std::cerr << "NonInitialisedContainerException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::NonInitialisedRelationShip& ex) { \ + std::cerr << "NonInitialisedRelationShip" << std::endl; \ + return -1; \ + \ + } catch (const stdair::MemoryAllocationException& ex) { \ + std::cerr << "MemoryAllocationException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectLinkingException& ex) { \ + std::cerr << "ObjectLinkingException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::CodeConversionException& ex) { \ + std::cerr << "CodeConversionException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::CodeDuplicationException& ex) { \ + std::cerr << "CodeDuplicationException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectCreationgDuplicationException& ex) { \ + std::cerr << "ObjectCreationgDuplicationException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::ObjectNotFoundException& ex) { \ + std::cerr << "ObjectNotFoundException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::DocumentNotFoundException& ex) { \ + std::cerr << "DocumentNotFoundException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::SQLDatabaseConnectionImpossibleException& ex) { \ + std::cerr << "SQLDatabaseConnectionImpossibleException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::SQLDatabaseException& ex) { \ + std::cerr << "SQLDatabaseException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::ParserException& ex) { \ + std::cerr << "ParserException" << std::endl; \ + return -1; \ + \ + } catch (const stdair::RootException& ex) { \ + std::cerr << "RootException" << std::endl; \ + return -1; \ + \ + } catch (const std::exception& stde) { \ + std::cerr << "Standard exception: " << stde.what() << std::endl; \ + return -1; \ + \ + } catch (...) { \ + return -1; \ + } \ + #endif // __STDAIR_STDAIR_TYPES_HPP Deleted: trunk/stdair/stdair/basic/CategoricalAttribute.hpp =================================================================== --- trunk/stdair/stdair/basic/CategoricalAttribute.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/CategoricalAttribute.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,138 +0,0 @@ -#ifndef __STDAIR_BAS_CATEGORICALATTRIBUTE_HPP -#define __STDAIR_BAS_CATEGORICALATTRIBUTE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <map> -#include <iosfwd> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DictionaryManager.hpp> - -namespace stdair { - - /** Class modeling the distribution of values that can be taken by a - categorical attribute. */ - template <class T> - struct CategoricalAttribute { - - public: - /** Define the probability mass function type. */ - typedef std::map<T, DictionaryKey_T> ProbabilityMassFunction_T; - - /** Define the inverse cumulative distribution type. */ - typedef std::map<DictionaryKey_T, T> InverseCumulativeDistribution_T; - - private: - // ///////////// Getters /////////// - /** Get the probability mass function. */ - const ProbabilityMassFunction_T& getProbabilityMassFunction() const { - return _probabilityMassFunction; - } - - /** Get the inverse cumulative distribution. */ - const InverseCumulativeDistribution_T& getInverseCumulativeDistribution () const { - return _inverseCumulativeDistribution; - } - - // ///////////// Setters /////////// - /** Set the probability mass function */ - void setProbabilityMassFunction (const ProbabilityMassFunction_T& iProbabilityMassFunction) { - _probabilityMassFunction = iProbabilityMassFunction; - determineInverseCumulativeDistributionFromProbabilityMassFunction(); - } - - public: - // /////////////// Business Methods ////////// - /** Get value from inverse cumulative distribution. */ - const T getValue (Probability_T iCumulativeProbability) const { - const DictionaryKey_T lKey = - DictionaryManager::valueToKey (iCumulativeProbability); - return _inverseCumulativeDistribution. - lower_bound (lKey)->second; - } - - public: - // ////////////// Display Support Methods ////////// - /** Display probability mass function. */ - const std::string displayProbabilityMassFunction () const { - std::ostringstream oStr; - unsigned int idx = 0; - - for (typename ProbabilityMassFunction_T::const_iterator it = - _probabilityMassFunction.begin(); - it != _probabilityMassFunction.end(); ++it, ++idx) { - if (idx != 0) { - oStr << ", "; - } - oStr << it->first << ":" - << DictionaryManager::keyToValue (it->second); - } - - return oStr.str(); - } - - /** Display inverse cumulative distribution. */ - const std::string displayInverseCumulativeDistribution () const { - std::ostringstream oStr; - - for (typename InverseCumulativeDistribution_T::const_iterator it = - _inverseCumulativeDistribution.begin(); - it != _inverseCumulativeDistribution.end(); ++it) { - oStr << "cumulative prob: " << DictionaryManager::keyToValue (it->first) - << " value: " << it->second << std::endl; - } - - return oStr.str(); - } - - public: - // ////////// Constructors and destructors ///////// - /** Constructor by default */ - CategoricalAttribute (const ProbabilityMassFunction_T& iProbabilityMassFunction) - : _probabilityMassFunction (iProbabilityMassFunction) { - determineInverseCumulativeDistributionFromProbabilityMassFunction(); - } - /** Default constructors. */ - CategoricalAttribute () { } - CategoricalAttribute (const CategoricalAttribute& iCategoricalAttribute) - : _probabilityMassFunction (iCategoricalAttribute._probabilityMassFunction) { - determineInverseCumulativeDistributionFromProbabilityMassFunction(); - } - - /** Destructor */ - virtual ~CategoricalAttribute () { } - - - /** Determine inverse cumulative distribution from probability mass function (initialisation). */ - void determineInverseCumulativeDistributionFromProbabilityMassFunction () { - Probability_T cumulative_probability_so_far = 0.0; - for (typename ProbabilityMassFunction_T::const_iterator itProbabilityMassFunction = _probabilityMassFunction.begin(); - itProbabilityMassFunction != _probabilityMassFunction.end(); - ++itProbabilityMassFunction) { - Probability_T attribute_probability_mass = - DictionaryManager::keyToValue (itProbabilityMassFunction->second); - if (attribute_probability_mass > 0) { - T attribute_value = itProbabilityMassFunction->first; - cumulative_probability_so_far += attribute_probability_mass; - DictionaryKey_T lKey = - DictionaryManager::valueToKey (cumulative_probability_so_far); - //_inverseCumulativeDistribution[lKey] = attribute_value; - _inverseCumulativeDistribution.insert (typename InverseCumulativeDistribution_T::value_type (lKey, attribute_value)); - } - } - } - - private: - // ////////// Attributes ////////// - /** Probability mass function */ - ProbabilityMassFunction_T _probabilityMassFunction; - - /** Inverse cumulative distribution */ - InverseCumulativeDistribution_T _inverseCumulativeDistribution; - - }; -} -#endif // __STDAIR_BAS_CATEGORICALATTRIBUTE_HPP Deleted: trunk/stdair/stdair/basic/CategoricalAttributeLite.hpp =================================================================== --- trunk/stdair/stdair/basic/CategoricalAttributeLite.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/CategoricalAttributeLite.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,122 +0,0 @@ -#ifndef __STDAIR_BAS_CATEGORICALATTRIBUTELITE_HPP -#define __STDAIR_BAS_CATEGORICALATTRIBUTELITE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <map> -#include <iosfwd> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DictionaryManager.hpp> -#include <stdair/service/Logger.hpp> - -namespace stdair { - - /** Class modeling the distribution of values that can be taken by a - categorical attribute. */ - template <class T> - struct CategoricalAttributeLite { - public: - /** Define the probability mass function type. */ - typedef std::map<T, Probability_T> ProbabilityMassFunction_T; - - public: - // /////////////// Business Methods ////////// - /** Get value from inverse cumulative distribution. */ - const T getValue (Probability_T iCumulativeProbability) const { - const DictionaryKey_T lKey = - DictionaryManager::valueToKey (iCumulativeProbability); - - for (unsigned int idx = 0; idx < _size; ++idx) { - if (_cumulativeDistribution[idx] >= lKey) { - return _valueArray[idx]; - } - } - - STDAIR_LOG_ERROR ("The following cumulative probability " - << "is out of range: " << iCumulativeProbability); - assert (false); - T t; - return t; - } - - public: - // ////////////// Display Support Methods ////////// - /** Display probability mass function. */ - const std::string displayProbabilityMass () const { - std::ostringstream oStr; - - for (unsigned int idx = 0; idx < _size; ++idx) { - if (idx != 0) { - oStr << ", "; - } - oStr << _valueArray [idx] << ":" - << DictionaryManager::keyToValue (_cumulativeDistribution[idx]); - } - return oStr.str(); - } - - public: - // ////////// Constructors and destructors ///////// - /** Constructor by default */ - CategoricalAttributeLite (const ProbabilityMassFunction_T& iValueMap) - : _size (iValueMap.size()) { - _cumulativeDistribution = new DictionaryKey_T[_size]; - _valueArray = new T[_size]; - init (iValueMap); - } - /** Destructor */ - virtual ~CategoricalAttributeLite () { - // TODO: Verify that the arrays are correctly cleaned. - delete _cumulativeDistribution; _cumulativeDistribution = NULL; - delete _valueArray; _valueArray = NULL; - } - - private: - /** Default constructors. */ - CategoricalAttributeLite (); - CategoricalAttributeLite (const CategoricalAttributeLite&); - - - /** Initialise the two arrays from the given map. */ - void init (const ProbabilityMassFunction_T& iValueMap) { - - Probability_T cumulative_probability_so_far = 0.0; - unsigned int idx = 0; - - // Browse the map to retrieve the values and to build the - // cumulative probabilities. - for (typename ProbabilityMassFunction_T::const_iterator itProbabilityMassFunction = iValueMap.begin(); - itProbabilityMassFunction != iValueMap.end(); - ++itProbabilityMassFunction, ++idx) { - - Probability_T attribute_probability_mass = - itProbabilityMassFunction->second; - if (attribute_probability_mass > 0) { - T attribute_value = itProbabilityMassFunction->first; - cumulative_probability_so_far += attribute_probability_mass; - DictionaryKey_T lKey = - DictionaryManager::valueToKey (cumulative_probability_so_far); - - // Build the two arrays. - _cumulativeDistribution[idx] = lKey; - _valueArray[idx] = attribute_value; - } - } - } - - private: - // ////////// Attributes ////////// - /** Size of the two arrays. */ - const unsigned int _size; - - /** Cumulative dictionary-coded distribution. */ - DictionaryKey_T* _cumulativeDistribution; - - /** The corresponding values. */ - T* _valueArray; - }; -} -#endif // __STDAIR_BAS_CATEGORICALATTRIBUTELITE_HPP Deleted: trunk/stdair/stdair/basic/ContinuousAttribute.hpp =================================================================== --- trunk/stdair/stdair/basic/ContinuousAttribute.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/ContinuousAttribute.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,154 +0,0 @@ -#ifndef __STDAIR_BAS_CONTINUOUSATTRIBUTE_HPP -#define __STDAIR_BAS_CONTINUOUSATTRIBUTE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DictionaryManager.hpp> -#include <stdair/service/Logger.hpp> - -namespace stdair { - - /** Class modeling the distribution of values that can be taken by a - continuous attribute. */ - template <class T> - struct ContinuousAttribute { - public: - - // ///////////// Type definitions ////////////// - /** */ - typedef std::multimap<T, DictionaryKey_T> ContinuousDistribution_T; - typedef std::multimap<DictionaryKey_T, T> ContinuousInverseDistribution_T; - - private: - // ///////////// Getters /////////// - /** Get the cumulative distribution. */ - const ContinuousDistribution_T& getCumulativeDistribution() const { - return _cumulativeDistribution; - } - - /** Get the inverse cumulative distribution. */ - const ContinuousInverseDistribution_T& getInverseCumulativeDistribution () const { - return _inverseCumulativeDistribution; - } - - private: - // ///////////// Setters /////////// - /** Set the cumulative distribution */ - void setCumulativeDistribution (const ContinuousDistribution_T& iCumulativeDistribution) { - _cumulativeDistribution = iCumulativeDistribution; - determineInverseCumulativeDistributionFromCumulativeDistribution(); - } - - public: - // /////////////// Business Methods ////////// - /** Get value from inverse cumulative distribution. */ - const T getValue (const Probability_T& iCumulativeProbability) const { - const DictionaryKey_T lKey = - DictionaryManager::valueToKey (iCumulativeProbability); - typename ContinuousInverseDistribution_T::const_iterator it = - _inverseCumulativeDistribution.lower_bound (lKey); - - Probability_T cumulativeProbabilityNextPoint = - DictionaryManager::keyToValue (it->first); - T valueNextPoint = it->second; - - if (it == _inverseCumulativeDistribution.begin()) { - STDAIR_LOG_DEBUG ("Last element"); - return valueNextPoint; - } - --it; - - Probability_T cumulativeProbabilityPreviousPoint = - DictionaryManager::keyToValue (it->first); - T valuePreviousPoint = it->second; - if (cumulativeProbabilityNextPoint == cumulativeProbabilityPreviousPoint) { - return valuePreviousPoint; - } - - return valuePreviousPoint + (valueNextPoint - valuePreviousPoint) - * (iCumulativeProbability - cumulativeProbabilityPreviousPoint) - / (cumulativeProbabilityNextPoint - cumulativeProbabilityPreviousPoint); - } - - public: - // ////////////// Display Support Methods ////////// - /** Display cumulative distribution */ - const std::string displayCumulativeDistribution() const { - std::ostringstream oStr; - unsigned int idx = 0; - for (typename ContinuousDistribution_T::const_iterator it = - _cumulativeDistribution.begin(); - it != _cumulativeDistribution.end(); ++it, ++idx) { - if (idx != 0) { - oStr << ", "; - } - oStr << it->first << ":" - << DictionaryManager::keyToValue (it->second); - } - return oStr.str(); - } - - /** Display inverse cumulative distribution */ - const std::string displayInverseCumulativeDistribution() const { - std::ostringstream oStr; - for (typename ContinuousInverseDistribution_T::const_iterator it = - _inverseCumulativeDistribution.begin(); - it != _inverseCumulativeDistribution.end(); ++it) { - oStr << "cumulative prob: " << DictionaryManager::keyToValue (it->first) - << " value: " << it->second << std::endl; - } - return oStr.str(); - } - - public: - // ////////// Constructors and destructors ///////// - /** Constructor by default */ - ContinuousAttribute () { } - - /** Constructor */ - ContinuousAttribute (const ContinuousDistribution_T& iCumulativeDistribution) - : _cumulativeDistribution (iCumulativeDistribution) { - determineInverseCumulativeDistributionFromCumulativeDistribution(); - } - - /** Copy constructor */ - ContinuousAttribute (const ContinuousAttribute& iContinuousAttribute) - : _cumulativeDistribution (iContinuousAttribute._cumulativeDistribution), - _inverseCumulativeDistribution (iContinuousAttribute._inverseCumulativeDistribution) { - } - - /** Destructor */ - virtual ~ContinuousAttribute () { } - - /** Determine inverse cumulative distribution from cumulative - distribution (initialisation). */ - void determineInverseCumulativeDistributionFromCumulativeDistribution () { - for (typename ContinuousDistribution_T::iterator itCumulativeDistribution = - _cumulativeDistribution.begin(); - itCumulativeDistribution != _cumulativeDistribution.end(); - ++itCumulativeDistribution) { - _inverseCumulativeDistribution. - insert (typename ContinuousInverseDistribution_T:: - value_type (itCumulativeDistribution->second, - itCumulativeDistribution->first)); - } - } - - private: - // ////////// Attributes ////////// - - /** Cumulative distribution */ - ContinuousDistribution_T _cumulativeDistribution; - - /** Inverse cumulative distribution */ - ContinuousInverseDistribution_T _inverseCumulativeDistribution; - }; - -} -#endif // __STDAIR_BAS_CONTINUOUSATTRIBUTE_HPP Deleted: trunk/stdair/stdair/basic/ContinuousAttributeLite.hpp =================================================================== --- trunk/stdair/stdair/basic/ContinuousAttributeLite.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/ContinuousAttributeLite.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,129 +0,0 @@ -#ifndef __STDAIR_BAS_CONTINUOUSATTRIBUTELITE_HPP -#define __STDAIR_BAS_CONTINUOUSATTRIBUTELITE_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -#include <map> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DictionaryManager.hpp> -#include <stdair/service/Logger.hpp> - -namespace stdair { - - /** Class modeling the distribution of values that can be taken by a - continuous attribute. */ - template <class T> - struct ContinuousAttributeLite { - public: - // ///////////// Type definitions ////////////// - typedef std::multimap<T, Probability_T> ContinuousDistribution_T; - - public: - // /////////////// Business Methods ////////// - /** Get value from inverse cumulative distribution. */ - const T getValue (const Probability_T& iCumulativeProbability) const { - const DictionaryKey_T lKey = - DictionaryManager::valueToKey (iCumulativeProbability); - unsigned int idx = 0; - - // Find the first cumulative probablity value greater or equal to lKey. - for (; idx < _size; ++idx) { - if (_cumulativeDistribution[idx] >= lKey) { - break; - } - } - - if (idx == 0) { - return _valueArray[idx]; - } - - Probability_T lCumulativeCurrentPoint = - DictionaryManager::keyToValue (_cumulativeDistribution[idx]); - Probability_T lCumulativePreviousPoint = - DictionaryManager::keyToValue (_cumulativeDistribution[idx-1]); - T lValueCurrentPoint = _valueArray[idx]; - T lValuePreviousPoint = _valueArray[idx-1]; - - if (lCumulativePreviousPoint == lCumulativeCurrentPoint) { - return lValuePreviousPoint; - } - - return lValuePreviousPoint + (lValueCurrentPoint - lValuePreviousPoint) - * (iCumulativeProbability - lCumulativePreviousPoint) - / (lCumulativeCurrentPoint - lCumulativePreviousPoint); - } - - public: - // ////////////// Display Support Methods ////////// - /** Display cumulative distribution */ - const std::string displayCumulativeDistribution() const { - std::ostringstream oStr; - - for (unsigned int idx = 0; idx < _size; ++idx) { - if (idx != 0) { - oStr << ", "; - } - oStr << _valueArray[idx] << ":" - << DictionaryManager::keyToValue (_cumulativeDistribution[idx]); - } - return oStr.str(); - } - - public: - // ////////// Constructors and destructors ///////// - /** Constructor */ - ContinuousAttributeLite (const ContinuousDistribution_T& iValueMap) - : _size (iValueMap.size()) { - _cumulativeDistribution = new DictionaryKey_T[_size]; - _valueArray = new T[_size]; - init (iValueMap); - } - - /** Destructor */ - virtual ~ContinuousAttributeLite () { - // TODO: Verify that the arrays are correctly cleaned. - delete _cumulativeDistribution; _cumulativeDistribution = NULL; - delete _valueArray; _valueArray = NULL; - } - - private: - /** Constructors by default */ - ContinuousAttributeLite (); - ContinuousAttributeLite (const ContinuousAttributeLite&); - - /** Determine inverse cumulative distribution from cumulative - distribution (initialisation). */ - void init (const ContinuousDistribution_T& iValueMap) { - unsigned int idx = 0; - - // Browse the map to retrieve the values and cumulative probabilities. - for (typename ContinuousDistribution_T::const_iterator it = - iValueMap.begin(); it != iValueMap.end(); ++it, ++idx) { - - T attributeValue = it->first; - DictionaryKey_T lKey = DictionaryManager::valueToKey (it->second); - - // Build the two arrays. - _cumulativeDistribution[idx] = lKey; - _valueArray[idx] = attributeValue; - } - } - - private: - // ////////// Attributes ////////// - /** Size of the two arrays. */ - const unsigned int _size; - - /** Cumulative dictionary-coded distribution. */ - DictionaryKey_T* _cumulativeDistribution; - - /** The corresponding values. */ - T* _valueArray; - }; - -} -#endif // __STDAIR_BAS_CONTINUOUSATTRIBUTELITE_HPP Deleted: trunk/stdair/stdair/basic/DemandCharacteristicTypes.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristicTypes.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DemandCharacteristicTypes.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,69 +0,0 @@ -#ifndef __STDAIR_BAS_DEMANDCHARACTERISTICTYPES_HPP -#define __STDAIR_BAS_DEMANDCHARACTERISTICTYPES_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// StdAir -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/ContinuousAttributeLite.hpp> -#include <stdair/basic/CategoricalAttributeLite.hpp> - -namespace stdair { - - /** Type definition for the continuous distribition of the duration - (as a float number). */ - typedef ContinuousAttributeLite<FloatDuration_T> ContinuousFloatDuration_T; - - /** Type definition for the arrival pattern cumulative distribution. */ - typedef ContinuousFloatDuration_T::ContinuousDistribution_T ArrivalPatternCumulativeDistribution_T; - - /** Define the point-of-sale probablity mass. */ - typedef CategoricalAttributeLite<AirportCode_T> POSProbabilityMass_T; - - /** Define the probability mass function type of point-of-sale. */ - typedef POSProbabilityMass_T::ProbabilityMassFunction_T POSProbabilityMassFunction_T; - - /** Define the booking channel probablity mass. */ - typedef CategoricalAttributeLite<ChannelLabel_T> ChannelProbabilityMass_T; - - /** Define the probability mass function type of booking channel. */ - typedef ChannelProbabilityMass_T::ProbabilityMassFunction_T ChannelProbabilityMassFunction_T; - - /** Define the trip type probablity mass. */ - typedef CategoricalAttributeLite<TripType_T> TripTypeProbabilityMass_T; - - /** Define the probability mass function type of trip type. */ - typedef TripTypeProbabilityMass_T::ProbabilityMassFunction_T TripTypeProbabilityMassFunction_T; - - /** Define the stay duration probablity mass. */ - typedef CategoricalAttributeLite<DayDuration_T> StayDurationProbabilityMass_T; - - /** Define the probability mass function type of stay duration. */ - typedef StayDurationProbabilityMass_T::ProbabilityMassFunction_T StayDurationProbabilityMassFunction_T; - - /** Define the frequent flyer probablity mass. */ - typedef CategoricalAttributeLite<FrequentFlyer_T> FrequentFlyerProbabilityMass_T; - - /** Define the probability mass function type of frequent flyer. */ - typedef FrequentFlyerProbabilityMass_T::ProbabilityMassFunction_T FrequentFlyerProbabilityMassFunction_T; - - /** Define the preferred departure time cumulative distribution. */ - typedef ContinuousAttributeLite<IntDuration_T> PreferredDepartureTimeCumulativeDistribution_T; - - /** Define the preferred departure time continuous distribution. */ - typedef PreferredDepartureTimeCumulativeDistribution_T::ContinuousDistribution_T PreferredDepartureTimeContinuousDistribution_T; - - /** Define the willingness-to-pay cumulative distribution. */ - typedef ContinuousAttributeLite<WTP_T> WTPCumulativeDistribution_T; - - /** Define the willingness-to-pay continuous distribution. */ - typedef WTPCumulativeDistribution_T::ContinuousDistribution_T WTPContinuousDistribution_T; - - /** Define the value of time cumulative distribution. */ - typedef ContinuousAttributeLite<PriceValue_T> ValueOfTimeCumulativeDistribution_T; - - /** Define the value of time continuous distribution. */ - typedef ValueOfTimeCumulativeDistribution_T::ContinuousDistribution_T ValueOfTimeContinuousDistribution_T; -} -#endif // __STDAIR_BAS_DEMANDCHARACTERISTICTYPES_HPP Deleted: trunk/stdair/stdair/basic/DemandCharacteristics.cpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DemandCharacteristics.cpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,78 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -#include <sstream> -// StdAir -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/BasConst_General.hpp> -#include <stdair/basic/DemandCharacteristics.hpp> - -namespace stdair { - - // ///////////////////////////////////////////////////// - DemandCharacteristics:: - DemandCharacteristics (const ArrivalPatternCumulativeDistribution_T& iArrivalPattern, - const POSProbabilityMassFunction_T& iPOSProbMass, - const ChannelProbabilityMassFunction_T& iChannelProbMass, - const TripTypeProbabilityMassFunction_T& iTripTypeProbMass, - const StayDurationProbabilityMassFunction_T& iStayDurationProbMass, - const FrequentFlyerProbabilityMassFunction_T& iFrequentFlyerProbMass, - const PreferredDepartureTimeContinuousDistribution_T& iPreferredDepartureTimeContinuousDistribution, - const WTPContinuousDistribution_T& iWTPContinuousDistribution, - const ValueOfTimeContinuousDistribution_T& iValueOfTimeContinuousDistribution) - : _arrivalPattern (iArrivalPattern), - _posProbabilityMass (iPOSProbMass), - _channelProbabilityMass (iChannelProbMass), - _tripTypeProbabilityMass (iTripTypeProbMass), - _stayDurationProbabilityMass (iStayDurationProbMass), - _frequentFlyerProbabilityMass (iFrequentFlyerProbMass), - _preferredDepartureTimeCumulativeDistribution (iPreferredDepartureTimeContinuousDistribution), - _wtpCumulativeDistribution (iWTPContinuousDistribution), - _valueOfTimeCumulativeDistribution (iValueOfTimeContinuousDistribution) { - } - - // ///////////////////////////////////////////////////// - DemandCharacteristics::~DemandCharacteristics () { - } - - // ///////////////////////////////////////////////////// - std::string DemandCharacteristics::display() const { - std::ostringstream oStr; - - // - oStr << "****************** Demand characteristics ******************" - << std::endl; - oStr << "Arrival pattern (days from departure, proportion): "; - oStr << _arrivalPattern.displayCumulativeDistribution() << std::endl; - oStr << "POS probability mass (POS, propotion): "; - oStr << _posProbabilityMass.displayProbabilityMass() - << std::endl; - oStr << "Channel probability mass (channel, propotion): "; - oStr << _channelProbabilityMass.displayProbabilityMass() - << std::endl; - oStr << "Trip type probability mass (trip type, propotion): "; - oStr << _tripTypeProbabilityMass.displayProbabilityMass() - << std::endl; - oStr << "Stay duration probability mass (number of days, propotion): "; - oStr << _stayDurationProbabilityMass.displayProbabilityMass() - << std::endl; - oStr << "Frequent flyer probability mass (frequent flyer, propotion): "; - oStr << _frequentFlyerProbabilityMass.displayProbabilityMass() - << std::endl; - oStr << "Preferred departure time cumulative distribution (time, proportion: "; - oStr << _preferredDepartureTimeCumulativeDistribution.displayCumulativeDistribution() << std::endl; - oStr << "WTP cumulative distribution (WTP, proportion: "; - oStr << _wtpCumulativeDistribution.displayCumulativeDistribution() - << std::endl; - oStr << "Value of time cumulative distribution (value of time, proportion: "; - oStr << _valueOfTimeCumulativeDistribution.displayCumulativeDistribution() - << std::endl; - - - return oStr.str(); - } - -} - Deleted: trunk/stdair/stdair/basic/DemandCharacteristics.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DemandCharacteristics.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,79 +0,0 @@ -#ifndef __STDAIR_BAS_DEMAND_CHARACTERISTICS_HPP -#define __STDAIR_BAS_DEMAND_CHARACTERISTICS_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -// StdAir -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DemandCharacteristicTypes.hpp> -#include <stdair/bom/DemandStreamKey.hpp> - -namespace stdair { - - /** Class modeling the characteristics of a demand type. */ - struct DemandCharacteristics { - - public: - // ////////////// Display Support Methods ////////// - /** Display demand characteristics */ - std::string display() const; - - - public: - // ////////// Constructors and destructors ///////// - /** Default constructor. */ - DemandCharacteristics (const ArrivalPatternCumulativeDistribution_T&, - const POSProbabilityMassFunction_T&, - const ChannelProbabilityMassFunction_T&, - const TripTypeProbabilityMassFunction_T&, - const StayDurationProbabilityMassFunction_T&, - const FrequentFlyerProbabilityMassFunction_T&, - const PreferredDepartureTimeContinuousDistribution_T&, - const WTPContinuousDistribution_T&, - const ValueOfTimeContinuousDistribution_T&); - - /** Destructor */ - ~DemandCharacteristics (); - private: - /** Default constructor. */ - DemandCharacteristics (); - /** Copy constructor. */ - DemandCharacteristics (const DemandCharacteristics&); - - public: - // //////////////////// Attributes ///////////////////// - /** Arrival pattern (cumulative distribution of timing of arrival - of requests (negative number of days between departure date - and request date). */ - const ContinuousFloatDuration_T _arrivalPattern; - - /** POS probability mass. */ - const POSProbabilityMass_T _posProbabilityMass; - - /** Channel probability mass. */ - const ChannelProbabilityMass_T _channelProbabilityMass; - - /** Trip type probability mass */ - const TripTypeProbabilityMass_T _tripTypeProbabilityMass; - - /** Stay duration probability mass */ - const StayDurationProbabilityMass_T _stayDurationProbabilityMass; - - /** Frequent flyer probability mass */ - const FrequentFlyerProbabilityMass_T _frequentFlyerProbabilityMass; - - /** Preferred departure time cumulative distribution. */ - const PreferredDepartureTimeCumulativeDistribution_T _preferredDepartureTimeCumulativeDistribution; - - /** Willingness-to-pay cumulative distribution */ - const WTPCumulativeDistribution_T _wtpCumulativeDistribution; - - /** Value of time cumulative distribution. */ - const ValueOfTimeCumulativeDistribution_T _valueOfTimeCumulativeDistribution; - }; - -} -#endif // __STDAIR_BAS_DEMAND_CHARACTERISTICS_HPP Deleted: trunk/stdair/stdair/basic/DemandDistribution.cpp =================================================================== --- trunk/stdair/stdair/basic/DemandDistribution.cpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DemandDistribution.cpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,51 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <cassert> -#include <sstream> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/DemandDistribution.hpp> - -namespace stdair { - - // ///////////////////////////////////////////////////// - DemandDistribution:: - DemandDistribution (const NbOfRequests_T& iMean, - const StandardDeviationValue_T& iStandardDeviation) - : _meanNumberOfRequests (iMean), - _standardDeviationNumberOfRequests (iStandardDeviation){ - } - - // ///////////////////////////////////////////////////// - DemandDistribution::DemandDistribution () { - } - - // ///////////////////////////////////////////////////// - DemandDistribution::~DemandDistribution () { - } - - // ///////////////////////////////////////////////////// - DemandDistribution:: - DemandDistribution (const DemandDistribution& iDemandDistribution) - : _meanNumberOfRequests (iDemandDistribution._meanNumberOfRequests), - _standardDeviationNumberOfRequests (iDemandDistribution._standardDeviationNumberOfRequests) { - } - - // ///////////////////////////////////////////////////// - std::string DemandDistribution::display() const { - std::ostringstream oStr; - - oStr << "****************** Demand distribution ******************" - << std::endl; - oStr << "Mean number of requests .......... : " - << _meanNumberOfRequests << std::endl; - oStr << "Std dev of number of requests .... : " - << _standardDeviationNumberOfRequests << std::endl; - - return oStr.str(); - } - -} - Deleted: trunk/stdair/stdair/basic/DemandDistribution.hpp =================================================================== --- trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DemandDistribution.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,44 +0,0 @@ -#ifndef __STDAIR_BAS_DEMAND_DISTRIBUTION_HPP -#define __STDAIR_BAS_DEMAND_DISTRIBUTION_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <string> -// STDAIR -#include <stdair/STDAIR_Types.hpp> -#include <stdair/basic/ContinuousAttribute.hpp> - -namespace stdair { - - /** Class modeling the distribution of a demand type. */ - struct DemandDistribution { - - // ////////////// Display Support Methods ////////// - /** Display demand distribution */ - std::string display() const; - - - // ////////// Constructors and destructors ///////// - /** Constructor. */ - DemandDistribution (const NbOfRequests_T& iMean, - const StandardDeviationValue_T& iStandardDeviation); - /** Default constructor. */ - DemandDistribution (); - /** Copy constructor. */ - DemandDistribution (const DemandDistribution&); - /** Destructor. */ - ~DemandDistribution (); - - - // ////////// Attributes ////////// - /** Mean number of requests */ - NbOfRequests_T _meanNumberOfRequests; - - /** Standard deviation of number of requests */ - StandardDeviationValue_T _standardDeviationNumberOfRequests; - }; - -} -#endif // __STDAIR_BAS_DEMAND_DISTRIBUTION_HPP Deleted: trunk/stdair/stdair/basic/DictionaryManager.cpp =================================================================== --- trunk/stdair/stdair/basic/DictionaryManager.cpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DictionaryManager.cpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,21 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/basic/DictionaryManager.hpp> - -namespace stdair { - // //////////////////////////////////////////////////////////////////// - const Probability_T DictionaryManager::keyToValue(const DictionaryKey_T iKey) { - return static_cast<Probability_T>(iKey) / 200; - } - - // //////////////////////////////////////////////////////////////////// - const DictionaryKey_T DictionaryManager:: - valueToKey (const Probability_T iValue) { - return iValue * 200; - } - - // DEBUG - unsigned int COUNT = 0; -} Deleted: trunk/stdair/stdair/basic/DictionaryManager.hpp =================================================================== --- trunk/stdair/stdair/basic/DictionaryManager.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/DictionaryManager.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,25 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -#ifndef __STDAIR_BOM_DICTIONARYMANAGER_HPP -#define __STDAIR_BOM_DICTIONARYMANAGER_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STDAIR -#include <stdair/STDAIR_Types.hpp> - -namespace stdair { - - /** Class wrapper of dictionary business methods. */ - class DictionaryManager { - public: - // //////////// Business methods ///////////////// - /** Convert from key to value. */ - static const Probability_T keyToValue (const DictionaryKey_T); - - /** Convert from value to key. */ - static const DictionaryKey_T valueToKey (const Probability_T); - - }; -} -#endif // __STDAIR_BOM_DICTIONARYMANAGER_HPP Deleted: trunk/stdair/stdair/basic/RandomGeneration.cpp =================================================================== --- trunk/stdair/stdair/basic/RandomGeneration.cpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/RandomGeneration.cpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,72 +0,0 @@ -// STL -#include <cassert> -#include <iostream> -// Boost -#include <boost/version.hpp> -#if BOOST_VERSION >= 103500 -#include <boost/math/distributions/normal.hpp> -#endif // BOOST_VERSION >= 103500 -//STDAIR -#include <stdair/basic/RandomGeneration.hpp> - -namespace stdair { - - // ////////////////////////////////////////////////////////////////////// - RandomGeneration::RandomGeneration (const RandomSeed_T& iSeed) - : _seed (iSeed), _generator (iSeed), - _uniformGenerator (_generator, boost::uniform_real<> (0, 1)) { - init (); - } - - // ////////////////////////////////////////////////////////////////////// - RandomGeneration::RandomGeneration (const RandomGeneration& iRandomGeneration) - : _seed (iRandomGeneration._seed), - _generator (iRandomGeneration._generator), - _uniformGenerator (iRandomGeneration._uniformGenerator) { - } - - // ////////////////////////////////////////////////////////////////////// - RandomGeneration::RandomGeneration () - : _seed (0), _generator (0), - _uniformGenerator (_generator, boost::uniform_real<> (0, 1)) { - assert (false); - } - - // ////////////////////////////////////////////////////////////////////// - RandomGeneration::~RandomGeneration () { - } - - // ////////////////////////////////////////////////////////////////////// - void RandomGeneration::init () { - } - - // ////////////////////////////////////////////////////////////////////// - RealNumber_T RandomGeneration::generateUniform01 () { - const RealNumber_T lVariateUnif = _uniformGenerator(); - return lVariateUnif; - } - - // ////////////////////////////////////////////////////////////////////// - RealNumber_T RandomGeneration:: - generateUniform (const RealNumber_T& iMinValue, const RealNumber_T& iMaxValue){ - const RealNumber_T lVariateUnif = - iMinValue + _uniformGenerator() * (iMaxValue - iMinValue); - return lVariateUnif; - } - - // ////////////////////////////////////////////////////////////////////// - RealNumber_T RandomGeneration:: - generateNormal (const RealNumber_T& mu, const RealNumber_T& sigma) { -#if BOOST_VERSION >= 103500 - const Probability_T lVariateUnif = generateUniform01 (); - const boost::math::normal lNormal (mu, sigma); - const RealNumber_T lRealNumberOfRequestsToBeGenerated = - boost::math::quantile(lNormal, lVariateUnif); -#else // BOOST_VERSION >= 103500 - // TODO: rely on GSL when Boost version smaller than 1.35 - const RealNumber_T lRealNumberOfRequestsToBeGenerated = 0.0; -#endif // BOOST_VERSION >= 103500 - - return lRealNumberOfRequestsToBeGenerated; - } -} Deleted: trunk/stdair/stdair/basic/RandomGeneration.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGeneration.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/RandomGeneration.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,64 +0,0 @@ -#ifndef __STDAIR_BAS_BOM_RANDOMGENERATION_HPP -#define __STDAIR_BAS_BOM_RANDOMGENERATION_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// Boost Random -#include <boost/random/uniform_real.hpp> -#include <boost/random/variate_generator.hpp> -// STDAIR -#include <stdair/STDAIR_Types.hpp> - -namespace stdair { - - /** Random generator. */ - struct RandomGeneration { - // //////////// Business Methods ///////////// - /** Generate a randomized number following a uniform distribution - between 0 (included) and 1 (excluded). */ - RealNumber_T generateUniform01 (); - - /** Generate a randomized number following a uniform distribution - between a minimum (included) and a maximum (excluded) - value. */ - RealNumber_T generateUniform (const RealNumber_T&, const RealNumber_T&); - - /** Generate a randomized number following a normal distribution - specified by a mean and a standard deviation. */ - RealNumber_T generateNormal (const RealNumber_T&, const RealNumber_T&); - - // ////////// Constructors and destructors ///////// - /** Constructor. */ - RandomGeneration (const RandomSeed_T&); - /** Default constructors. */ - RandomGeneration (); - RandomGeneration (const RandomGeneration&); - /** Destructor. */ - ~RandomGeneration (); - /** Initialize the random generator. - <br>A uniform random number distribution is defined, which - produces "real" values between 0 and 1 (0 inclusive, 1 - exclusive). */ - void init (); - - // ////////// Attributes ////////// - /** The seed of the random generator. - <br>The seed is unsigned, otherwise the wrong overload may be - selected when using mt19937 as the boost::base_generator_type. */ - RandomSeed_T _seed; - - /** Random number generator engine. - <br>The random number generator is currently based on boost::minstd_rand. - Alternates are boost::mt19937, boost::ecuyer1988. */ - BaseGenerator_T _generator; - - /** Random number generator. - <br>It is initialized with a reproducible seed and a uniform - distribution. */ - boost::variate_generator<BaseGenerator_T&, - boost::uniform_real<> > _uniformGenerator; - }; - -} -#endif // __STDAIR_BAS_BOM_RANDOMGENERATION_HPP Deleted: trunk/stdair/stdair/basic/RandomGenerationContext.cpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/RandomGenerationContext.cpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,38 +0,0 @@ -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -// STDAIR -#include <stdair/basic/RandomGenerationContext.hpp> - -namespace stdair { - - // ////////////////////////////////////////////////////////////////////// - RandomGenerationContext::RandomGenerationContext () - : _cumulativeProbabilitySoFar (0.0), - _numberOfRequestsGeneratedSoFar (0) { - } - - // ////////////////////////////////////////////////////////////////////// - RandomGenerationContext::RandomGenerationContext (const RandomGenerationContext& iRandomGenerationContext) - : _cumulativeProbabilitySoFar (iRandomGenerationContext._cumulativeProbabilitySoFar), - _numberOfRequestsGeneratedSoFar (iRandomGenerationContext._numberOfRequestsGeneratedSoFar) { - } - - // ////////////////////////////////////////////////////////////////////// - RandomGenerationContext::~RandomGenerationContext () { - } - - // ////////////////////////////////////////////////////////////////////// - void RandomGenerationContext::incrementGeneratedRequestsCounter () { - ++_numberOfRequestsGeneratedSoFar; - } - - // ////////////////////////////////////////////////////////////////////// - void RandomGenerationContext::reset () { - _cumulativeProbabilitySoFar = 0.0; - _numberOfRequestsGeneratedSoFar = 0; - } - -} Deleted: trunk/stdair/stdair/basic/RandomGenerationContext.hpp =================================================================== --- trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-20 10:40:49 UTC (rev 272) +++ trunk/stdair/stdair/basic/RandomGenerationContext.hpp 2010-08-20 14:53:57 UTC (rev 273) @@ -1,43 +0,0 @@ -#ifndef __STDAIR_BAS_RANDOM_GENERATION_CONTEXT_HPP -#define __STDAIR_BAS_RANDOM_GENERATION_CONTEXT_HPP - -// ////////////////////////////////////////////////////////////////////// -// Import section -// ////////////////////////////////////////////////////////////////////// -// STL -#include <iosfwd> -// STDAIR -#include <stdair/STDAIR_Types.hpp> - -namespace stdair { - - /** Structure holding the context necessary for demand random generation. */ - struct RandomGenerationContext { - - // ////////// Constructors and destructors ///////// - /** Constructor by default */ - RandomGenerationContext (); - /** Default constructors. */ - RandomGenerationContext (const RandomGenerationContext&); - /** Destructor */ - ~RandomGenerationContext (); - - // /////////////// Business Methods ////////// - /** Increment counter of requests generated so far */ - void incrementGeneratedRequestsCounter (); - - /** Reset the counters. */ - void reset (); - - // ////////// Attributes ////////// - /** Cumulative probability in arrival pattern for last request - generated so far (needed for sequential generat... [truncated message content] |