|
From: <qua...@us...> - 2010-01-04 10:53:23
|
Revision: 45
http://dsim.svn.sourceforge.net/dsim/?rev=45&view=rev
Author: quannaus
Date: 2010-01-04 10:53:16 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
[Dev] Some small changes in the type definition.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-01-03 17:04:17 UTC (rev 44)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-01-04 10:53:16 UTC (rev 45)
@@ -6,6 +6,8 @@
#include <string>
#include <vector>
#include <exception>
+// STDAIR
+#include <stdair/STDAIR_Types.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
// Dsim
@@ -23,10 +25,10 @@
DSIM_LOG_DEBUG ("The simulation is starting");
// Airline code
- std::string lAirlineCode ("LH");
+ stdair::AirlineCode_T lAirlineCode ("BA");
// Number of passengers in the travelling group
- SIMCRS::PartySize_T lPartySize = 5;
+ stdair::PartySize_T lPartySize = 5;
// Make a booking
ioSIMCRS_Service.sell (lAirlineCode, lPartySize);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-01-28 19:38:20
|
Revision: 56
http://dsim.svn.sourceforge.net/dsim/?rev=56&view=rev
Author: denis_arnaud
Date: 2010-01-28 19:38:14 +0000 (Thu, 28 Jan 2010)
Log Message:
-----------
[DSIM] Check that the pointer on OutboundPath object is not NULL.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-01-28 15:53:26 UTC (rev 55)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-01-28 19:38:14 UTC (rev 56)
@@ -75,8 +75,10 @@
const stdair::NbOfSeats_T& lNbOfSeats = iBookingRequest.getPartySize();
// Make a sale.
+ assert (lChosenTravelSolution_ptr != NULL);
ioSIMCRS_Service.sell (*lChosenTravelSolution_ptr, lNbOfSeats);
}
}
}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-10-04 09:30:59
|
Revision: 139
http://dsim.svn.sourceforge.net/dsim/?rev=139&view=rev
Author: quannaus
Date: 2010-10-04 09:30:53 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
[dev] Adapted the demand generation to stdair.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-10-03 16:25:59 UTC (rev 138)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-10-04 09:30:53 UTC (rev 139)
@@ -61,21 +61,15 @@
// generate next request
bool stillHavingRequestsToBeGenerated =
ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated(lDemandStreamKey);
-
if (stillHavingRequestsToBeGenerated) {
stdair::BookingRequestPtr_T lNextRequest =
ioTRADEMGEN_Service.generateNextRequest (lDemandStreamKey);
assert (lNextRequest != NULL);
-
- stdair::DateTime_T lNextRequestDateTime =
- lNextRequest->getRequestDateTime ();
- stdair::EventStruct lNextEventStruct ("Request",
- lNextRequestDateTime,
- lDemandStreamKey,
+
+ stdair::EventStruct lNextEventStruct ("Request", lDemandStreamKey,
lNextRequest);
lEventQueue.addEvent (lNextEventStruct);
}
-
lEventQueue.eraseLastUsedEvent ();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-02-03 14:58:09
|
Revision: 59
http://dsim.svn.sourceforge.net/dsim/?rev=59&view=rev
Author: quannaus
Date: 2010-02-03 14:57:56 +0000 (Wed, 03 Feb 2010)
Log Message:
-----------
[dev] Implemented a sale.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-01-29 16:02:46 UTC (rev 58)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-03 14:57:56 UTC (rev 59)
@@ -10,6 +10,7 @@
#include <stdair/STDAIR_Types.hpp>
#include <stdair/bom/OutboundPathTypes.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
+#include <stdair/bom/TravelSolutionStruct.hpp>
#include <stdair/service/Logger.hpp>
// Distribution
#include <simcrs/SIMCRS_Service.hpp>
@@ -64,19 +65,24 @@
const stdair::BookingRequestStruct& iBookingRequest) {
// Retrieve a list of travel solutions corresponding the given
// booking request.
- stdair::OutboundPathLightList_T lOutboundPathList =
+ stdair::TravelSolutionList_T lTravelSolutionList =
ioSIMCRS_Service.getTravelSolutions (iBookingRequest);
// Hardcode a travel solution choice.
- if (lOutboundPathList.empty() == false) {
- stdair::OutboundPath* lChosenTravelSolution_ptr = lOutboundPathList.at(0);
-
+ if (lTravelSolutionList.empty() == false) {
+ // DEBUG
+ STDAIR_LOG_DEBUG ("A travel solution is chosen.");
+
+ stdair::TravelSolutionStruct lChosenTravelSolution =
+ lTravelSolutionList.at(0);
// Get the number of seats in the request.
const stdair::NbOfSeats_T& lNbOfSeats = iBookingRequest.getPartySize();
+ // Make a sale.
+ ioSIMCRS_Service.sell (lChosenTravelSolution, lNbOfSeats);
- // Make a sale.
- assert (lChosenTravelSolution_ptr != NULL);
- ioSIMCRS_Service.sell (*lChosenTravelSolution_ptr, lNbOfSeats);
+ } else {
+ // DEBUG
+ STDAIR_LOG_DEBUG ("No travel solution is chosen.");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-02-12 13:57:55
|
Revision: 65
http://dsim.svn.sourceforge.net/dsim/?rev=65&view=rev
Author: quannaus
Date: 2010-02-12 13:57:44 +0000 (Fri, 12 Feb 2010)
Log Message:
-----------
[dev] Added the request generation code into the simulator.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-02-10 10:13:15 UTC (rev 64)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-12 13:57:44 UTC (rev 65)
@@ -8,6 +8,12 @@
#include <exception>
// StdAir
#include <stdair/STDAIR_Types.hpp>
+#include <stdair/basic/DemandCharacteristics.hpp>
+#include <stdair/basic/DemandDistribution.hpp>
+#include <stdair/basic/CategoricalAttribute.hpp>
+#include <stdair/basic/ContinuousAttribute.hpp>
+#include <stdair/bom/EventStruct.hpp>
+#include <stdair/bom/EventQueue.hpp>
#include <stdair/bom/OutboundPathTypes.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
#include <stdair/bom/TravelSolutionStruct.hpp>
@@ -33,12 +39,190 @@
// DEBUG
STDAIR_LOG_DEBUG ("The simulation is starting");
- // Generate a booking request.
- stdair::BookingRequestStruct lBookingRequest =
- ioTRADEMGEN_Service.generateBookingRequest ();
+ // Hardcoded section for demand generation.
+ // Demand characteristics
+ stdair::DemandCharacteristics demandCharacteristics1;
+ stdair::DemandCharacteristics demandCharacteristics2;
+ // Demand distribution
+ stdair::DemandDistribution demandDistribution1;
+ stdair::DemandDistribution demandDistribution2;
+ // distribution of number of requests
+ demandDistribution1.setMeanNumberOfRequests (10.0);
+ demandDistribution1.setStandardDeviationNumberOfRequests (2.0);
+ demandDistribution2.setMeanNumberOfRequests (12.0);
+ demandDistribution2.setStandardDeviationNumberOfRequests (1.0);
+
+ // origin
+ demandCharacteristics1.setOrigin ("LHR");
+ demandCharacteristics2.setOrigin ("LHR");
+ // destination
+ demandCharacteristics1.setDestination ("JFK");
+ demandCharacteristics2.setDestination ("JFK");
+ // preferred departure date
+ demandCharacteristics1.setPreferredDepartureDate (boost::gregorian::date (2010,1,17));
+ demandCharacteristics2.setPreferredDepartureDate (boost::gregorian::date (2010,1,18));
+ // Passenger type
+ demandCharacteristics1.setPaxType ("L");
+ demandCharacteristics2.setPaxType ("B");
+
+ // arrival pattern
+ std::multimap<stdair::FloatDuration_T, stdair::Probability_T> arrivalPatternCumulativeDistribution1;
+ arrivalPatternCumulativeDistribution1.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-365.0, 0) );
+ arrivalPatternCumulativeDistribution1.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-67.0, 0.2) );
+ arrivalPatternCumulativeDistribution1.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-17.0, 0.5) );
+ arrivalPatternCumulativeDistribution1.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (0.0, 1.0) );
+
+ std::multimap<stdair::FloatDuration_T, stdair::Probability_T> arrivalPatternCumulativeDistribution2;
+ arrivalPatternCumulativeDistribution2.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-365.0, 0) );
+ arrivalPatternCumulativeDistribution2.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-300.0, 0.5) );
+ arrivalPatternCumulativeDistribution2.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-200.0, 0.9) );
+ arrivalPatternCumulativeDistribution2.
+ insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (0.0, 1.0) );
+
+ // When creating the ContinuousAttribute object, the mapping is
+ // inverted, i.e., the inverse cumulative distribution can be
+ // derived from the cumulative distribution
+ const stdair::ContinuousAttribute<stdair::FloatDuration_T> arrivalPattern1 (arrivalPatternCumulativeDistribution1);
+ demandCharacteristics1.setArrivalPattern (arrivalPattern1);
+ const stdair::ContinuousAttribute<stdair::FloatDuration_T> arrivalPattern2 (arrivalPatternCumulativeDistribution2);
+ demandCharacteristics2.setArrivalPattern (arrivalPattern2);
+
+ // Display
+ STDAIR_LOG_DEBUG ("Demand 1: " << demandCharacteristics1.display()
+ << demandDistribution1.display()
+ << std::endl << std::endl);
+
+ STDAIR_LOG_DEBUG ("Demand 2: " << demandCharacteristics2.display()
+ << demandDistribution2.display()
+ << std::endl << std::endl);
+
+ // Seeds
+ stdair::RandomSeed_T seed = 2;
+
+ // Key
+ stdair::DemandStreamKey_T key1 = 1;
+ stdair::DemandStreamKey_T key2 = 2;
+
+
+
+ // Initialize the demand stream
+ ioTRADEMGEN_Service.addDemandStream (key1, demandCharacteristics1,
+ demandDistribution1, seed, seed, seed);
+ ioTRADEMGEN_Service.addDemandStream (key2, demandCharacteristics2,
+ demandDistribution2, seed, seed, seed);
+
+ // Get the total number of requests to be generated
+ stdair::Count_T totalNumberOfRequestsToBeGenerated1 =
+ ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key1);
+ stdair::Count_T totalNumberOfRequestsToBeGenerated2 =
+ ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key2);
+
+ STDAIR_LOG_DEBUG ("Number of requests to be generated (demand 1): "
+ << totalNumberOfRequestsToBeGenerated1 << std::endl);
+ STDAIR_LOG_DEBUG ("Number of requests to be generated (demand 2): "
+ << totalNumberOfRequestsToBeGenerated2 << std::endl);
+
+ // /////////////////////////////////////////////////////
+ // Event queue
+ stdair::EventQueue lEventQueue = stdair::EventQueue ();
+
+ // Initialize by adding one request of each type
+ const bool stillHavingRequestsToBeGenerated1 =
+ ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated (key1);
+ if (stillHavingRequestsToBeGenerated1) {
+ stdair::BookingRequestPtr_T lRequest1 =
+ ioTRADEMGEN_Service.generateNextRequest (key1);
+ assert (lRequest1 != NULL);
+ stdair::DateTime_T lRequestDateTime = lRequest1->getRequestDateTime ();
+ stdair::EventStruct lEventStruct ("Request", lRequestDateTime, key1,
+ lRequest1);
+ lEventQueue.addEvent (lEventStruct);
+ }
+
+ const bool stillHavingRequestsToBeGenerated2 =
+ ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated (key2);
+ if (stillHavingRequestsToBeGenerated2) {
+ stdair::BookingRequestPtr_T lRequest2 =
+ ioTRADEMGEN_Service.generateNextRequest (key2);
+ assert (lRequest2 != NULL);
+ stdair::DateTime_T lRequestDateTime = lRequest2->getRequestDateTime ();
+ stdair::EventStruct lEventStruct("Request", lRequestDateTime, key2,
+ lRequest2);
+ lEventQueue.addEvent (lEventStruct);
+ }
+
+ // Pop requests, get type, and generate next request of same type
+ int i = 0;
+ while (lEventQueue.isQueueDone() == false && i < 20) {
+ // DEBUG
+ STDAIR_LOG_DEBUG ("Before popping (" << i << ")" );
+ STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize () );
+ STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone () );
+
+ stdair::EventStruct& lEventStruct = lEventQueue.popEvent ();
+
+ // DEBUG
+ STDAIR_LOG_DEBUG ("After popping" );
+ STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize ());
+ STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone ());
+
+ STDAIR_LOG_DEBUG ("Popped request " << i );
+
+ const stdair::BookingRequestStruct& lPoppedRequest =
+ lEventStruct.getBookingRequest ();
+
+ // DEBUG
+ STDAIR_LOG_DEBUG (lPoppedRequest.describe());
+
+ // Play booking request
+ playBookingRequest (ioSIMCRS_Service, lPoppedRequest);
+
+ // Retrieve the corresponding demand stream
+ const stdair::DemandStreamKey_T& lDemandStreamKey =
+ lEventStruct.getDemandStreamKey ();
+ // generate next request
+ bool stillHavingRequestsToBeGenerated =
+ ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated(lDemandStreamKey);
+ STDAIR_LOG_DEBUG ("stillHavingRequestsToBeGenerated: " << stillHavingRequestsToBeGenerated );
+ if (stillHavingRequestsToBeGenerated) {
+ stdair::BookingRequestPtr_T lNextRequest =
+ ioTRADEMGEN_Service.generateNextRequest (lDemandStreamKey);
+ assert (lNextRequest != NULL);
+ // DEBUG
+ STDAIR_LOG_DEBUG ("Added request: " << lNextRequest->describe());
+
+ stdair::DateTime_T lNextRequestDateTime =
+ lNextRequest->getRequestDateTime ();
+ stdair::EventStruct lNextEventStruct ("Request",
+ lNextRequestDateTime,
+ lDemandStreamKey,
+ lNextRequest);
+ lEventQueue.eraseLastUsedEvent ();
+ lEventQueue.addEvent (lNextEventStruct);
+
+ // DEBUG
+ STDAIR_LOG_DEBUG ("After adding");
+ STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize ());
+ STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone ());
+
+ }
+
+ // DEBUG
+ STDAIR_LOG_DEBUG (std::endl);
+
+ // Iterate
+ ++i;
+ }
// Play booking request
- playBookingRequest (ioSIMCRS_Service, lBookingRequest);
+ //playBookingRequest (ioSIMCRS_Service, lBookingRequest);
// DEBUG
STDAIR_LOG_DEBUG ("The simulation has ended");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-02-15 10:23:19
|
Revision: 67
http://dsim.svn.sourceforge.net/dsim/?rev=67&view=rev
Author: denis_arnaud
Date: 2010-02-15 10:23:12 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
[Dev] Fixed a compilation problem, with command/Simulator.cpp, due to TraDemGen interface change.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-02-12 14:04:38 UTC (rev 66)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-15 10:23:12 UTC (rev 67)
@@ -39,90 +39,99 @@
// DEBUG
STDAIR_LOG_DEBUG ("The simulation is starting");
- // Hardcoded section for demand generation.
+ // ////////// Hardcoded section for demand generation ///////////
+ /** Origin. */
+ const stdair::AirportCode_T lLHR ("LHR");
+ /** Destination. */
+ const stdair::AirportCode_T lJFK ("JFK");
+ /** Preferred departure date. */
+ const stdair::Date_T lPreferredDepartureDate1 (2010, 1, 17);
+ const stdair::Date_T lPreferredDepartureDate2 (2010, 1, 18);
+ /** Passenger type. */
+ const stdair::PassengerType lLeisurePax ('L');
+ const stdair::PassengerType lBusinessPax ('B');
+ /** Demand distribution parameters. */
+ const stdair::NbOfRequests_T lDemandMean1 (10.0);
+ const stdair::StandardDeviationValue_T lDemandStdDev1 (2.0);
+ const stdair::NbOfRequests_T lDemandMean2 (12.0);
+ const stdair::StandardDeviationValue_T lDemandStdDev2 (1.0);
+
// Demand characteristics
- stdair::DemandCharacteristics demandCharacteristics1;
- stdair::DemandCharacteristics demandCharacteristics2;
+ const stdair::DemandStreamKey_T key1 (lLHR, lJFK, lPreferredDepartureDate1,
+ lLeisurePax);
+ const stdair::DemandStreamKey_T key2 (lLHR, lJFK, lPreferredDepartureDate2,
+ lBusinessPax);
+
+ stdair::DemandCharacteristics demandCharacteristics1 (key1);
+ stdair::DemandCharacteristics demandCharacteristics2 (key2);
+
+
// Demand distribution
- stdair::DemandDistribution demandDistribution1;
- stdair::DemandDistribution demandDistribution2;
-
- // distribution of number of requests
- demandDistribution1.setMeanNumberOfRequests (10.0);
- demandDistribution1.setStandardDeviationNumberOfRequests (2.0);
- demandDistribution2.setMeanNumberOfRequests (12.0);
- demandDistribution2.setStandardDeviationNumberOfRequests (1.0);
+ stdair::DemandDistribution demandDistribution1 (lDemandMean1,
+ lDemandStdDev1);
+ stdair::DemandDistribution demandDistribution2 (lDemandMean2,
+ lDemandStdDev2);
- // origin
- demandCharacteristics1.setOrigin ("LHR");
- demandCharacteristics2.setOrigin ("LHR");
- // destination
- demandCharacteristics1.setDestination ("JFK");
- demandCharacteristics2.setDestination ("JFK");
- // preferred departure date
- demandCharacteristics1.setPreferredDepartureDate (boost::gregorian::date (2010,1,17));
- demandCharacteristics2.setPreferredDepartureDate (boost::gregorian::date (2010,1,18));
- // Passenger type
- demandCharacteristics1.setPaxType ("L");
- demandCharacteristics2.setPaxType ("B");
-
- // arrival pattern
- std::multimap<stdair::FloatDuration_T, stdair::Probability_T> arrivalPatternCumulativeDistribution1;
+
+ // Arrival pattern
+ stdair::ArrivalPatternCumulativeDistribution_T arrivalPatternCumulativeDistribution1;
arrivalPatternCumulativeDistribution1.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-365.0, 0) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-365.0,
+ 0) );
arrivalPatternCumulativeDistribution1.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-67.0, 0.2) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-67.0,
+ 0.2) );
arrivalPatternCumulativeDistribution1.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-17.0, 0.5) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-17.0,
+ 0.5) );
arrivalPatternCumulativeDistribution1.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (0.0, 1.0) );
-
- std::multimap<stdair::FloatDuration_T, stdair::Probability_T> arrivalPatternCumulativeDistribution2;
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (0.0,
+ 1.0) );
+
+ stdair::ArrivalPatternCumulativeDistribution_T arrivalPatternCumulativeDistribution2;
arrivalPatternCumulativeDistribution2.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-365.0, 0) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-365.0,
+ 0) );
arrivalPatternCumulativeDistribution2.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-300.0, 0.5) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-300.0,
+ 0.5) );
arrivalPatternCumulativeDistribution2.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (-200.0, 0.9) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-200.0,
+ 0.9) );
arrivalPatternCumulativeDistribution2.
- insert ( std::pair<stdair::FloatDuration_T, stdair::Probability_T> (0.0, 1.0) );
+ insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (0.0,
+ 1.0) );
// When creating the ContinuousAttribute object, the mapping is
// inverted, i.e., the inverse cumulative distribution can be
// derived from the cumulative distribution
- const stdair::ContinuousAttribute<stdair::FloatDuration_T> arrivalPattern1 (arrivalPatternCumulativeDistribution1);
+ const stdair::ContinuousFloatDuration_T arrivalPattern1 (arrivalPatternCumulativeDistribution1);
demandCharacteristics1.setArrivalPattern (arrivalPattern1);
- const stdair::ContinuousAttribute<stdair::FloatDuration_T> arrivalPattern2 (arrivalPatternCumulativeDistribution2);
+ const stdair::ContinuousFloatDuration_T arrivalPattern2 (arrivalPatternCumulativeDistribution2);
demandCharacteristics2.setArrivalPattern (arrivalPattern2);
-
+
// Display
- STDAIR_LOG_DEBUG ("Demand 1: " << demandCharacteristics1.display()
- << demandDistribution1.display()
- << std::endl << std::endl);
-
- STDAIR_LOG_DEBUG ("Demand 2: " << demandCharacteristics2.display()
- << demandDistribution2.display()
- << std::endl << std::endl);
-
+ STDAIR_LOG_DEBUG ("Demand 1: " << std::endl
+ << demandCharacteristics1.display()
+ << demandDistribution1.display());
+
+ STDAIR_LOG_DEBUG ("Demand 2: " << std::endl
+ << demandCharacteristics2.display()
+ << demandDistribution2.display());
+
// Seeds
stdair::RandomSeed_T seed = 2;
- // Key
- stdair::DemandStreamKey_T key1 = 1;
- stdair::DemandStreamKey_T key2 = 2;
-
-
-
- // Initialize the demand stream
+ // Initialise the demand stream
ioTRADEMGEN_Service.addDemandStream (key1, demandCharacteristics1,
demandDistribution1, seed, seed, seed);
ioTRADEMGEN_Service.addDemandStream (key2, demandCharacteristics2,
demandDistribution2, seed, seed, seed);
// Get the total number of requests to be generated
- stdair::Count_T totalNumberOfRequestsToBeGenerated1 =
+ stdair::NbOfRequests_T totalNumberOfRequestsToBeGenerated1 =
ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key1);
- stdair::Count_T totalNumberOfRequestsToBeGenerated2 =
+ stdair::NbOfRequests_T totalNumberOfRequestsToBeGenerated2 =
ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key2);
STDAIR_LOG_DEBUG ("Number of requests to be generated (demand 1): "
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-02-15 13:15:54
|
Revision: 68
http://dsim.svn.sourceforge.net/dsim/?rev=68&view=rev
Author: quannaus
Date: 2010-02-15 13:15:46 +0000 (Mon, 15 Feb 2010)
Log Message:
-----------
[dev] Adapted the code.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-02-15 10:23:12 UTC (rev 67)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-15 13:15:46 UTC (rev 68)
@@ -39,135 +39,14 @@
// DEBUG
STDAIR_LOG_DEBUG ("The simulation is starting");
- // ////////// Hardcoded section for demand generation ///////////
- /** Origin. */
- const stdair::AirportCode_T lLHR ("LHR");
- /** Destination. */
- const stdair::AirportCode_T lJFK ("JFK");
- /** Preferred departure date. */
- const stdair::Date_T lPreferredDepartureDate1 (2010, 1, 17);
- const stdair::Date_T lPreferredDepartureDate2 (2010, 1, 18);
- /** Passenger type. */
- const stdair::PassengerType lLeisurePax ('L');
- const stdair::PassengerType lBusinessPax ('B');
- /** Demand distribution parameters. */
- const stdair::NbOfRequests_T lDemandMean1 (10.0);
- const stdair::StandardDeviationValue_T lDemandStdDev1 (2.0);
- const stdair::NbOfRequests_T lDemandMean2 (12.0);
- const stdair::StandardDeviationValue_T lDemandStdDev2 (1.0);
-
- // Demand characteristics
- const stdair::DemandStreamKey_T key1 (lLHR, lJFK, lPreferredDepartureDate1,
- lLeisurePax);
- const stdair::DemandStreamKey_T key2 (lLHR, lJFK, lPreferredDepartureDate2,
- lBusinessPax);
-
- stdair::DemandCharacteristics demandCharacteristics1 (key1);
- stdair::DemandCharacteristics demandCharacteristics2 (key2);
-
-
- // Demand distribution
- stdair::DemandDistribution demandDistribution1 (lDemandMean1,
- lDemandStdDev1);
- stdair::DemandDistribution demandDistribution2 (lDemandMean2,
- lDemandStdDev2);
-
-
- // Arrival pattern
- stdair::ArrivalPatternCumulativeDistribution_T arrivalPatternCumulativeDistribution1;
- arrivalPatternCumulativeDistribution1.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-365.0,
- 0) );
- arrivalPatternCumulativeDistribution1.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-67.0,
- 0.2) );
- arrivalPatternCumulativeDistribution1.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-17.0,
- 0.5) );
- arrivalPatternCumulativeDistribution1.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (0.0,
- 1.0) );
-
- stdair::ArrivalPatternCumulativeDistribution_T arrivalPatternCumulativeDistribution2;
- arrivalPatternCumulativeDistribution2.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-365.0,
- 0) );
- arrivalPatternCumulativeDistribution2.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-300.0,
- 0.5) );
- arrivalPatternCumulativeDistribution2.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (-200.0,
- 0.9) );
- arrivalPatternCumulativeDistribution2.
- insert (stdair::ArrivalPatternCumulativeDistribution_T::value_type (0.0,
- 1.0) );
-
- // When creating the ContinuousAttribute object, the mapping is
- // inverted, i.e., the inverse cumulative distribution can be
- // derived from the cumulative distribution
- const stdair::ContinuousFloatDuration_T arrivalPattern1 (arrivalPatternCumulativeDistribution1);
- demandCharacteristics1.setArrivalPattern (arrivalPattern1);
- const stdair::ContinuousFloatDuration_T arrivalPattern2 (arrivalPatternCumulativeDistribution2);
- demandCharacteristics2.setArrivalPattern (arrivalPattern2);
-
- // Display
- STDAIR_LOG_DEBUG ("Demand 1: " << std::endl
- << demandCharacteristics1.display()
- << demandDistribution1.display());
-
- STDAIR_LOG_DEBUG ("Demand 2: " << std::endl
- << demandCharacteristics2.display()
- << demandDistribution2.display());
-
- // Seeds
- stdair::RandomSeed_T seed = 2;
-
- // Initialise the demand stream
- ioTRADEMGEN_Service.addDemandStream (key1, demandCharacteristics1,
- demandDistribution1, seed, seed, seed);
- ioTRADEMGEN_Service.addDemandStream (key2, demandCharacteristics2,
- demandDistribution2, seed, seed, seed);
-
- // Get the total number of requests to be generated
- stdair::NbOfRequests_T totalNumberOfRequestsToBeGenerated1 =
- ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key1);
- stdair::NbOfRequests_T totalNumberOfRequestsToBeGenerated2 =
- ioTRADEMGEN_Service.getTotalNumberOfRequestsToBeGenerated (key2);
-
- STDAIR_LOG_DEBUG ("Number of requests to be generated (demand 1): "
- << totalNumberOfRequestsToBeGenerated1 << std::endl);
- STDAIR_LOG_DEBUG ("Number of requests to be generated (demand 2): "
- << totalNumberOfRequestsToBeGenerated2 << std::endl);
-
// /////////////////////////////////////////////////////
// Event queue
stdair::EventQueue lEventQueue = stdair::EventQueue ();
+ // Browse the list of DemandStreams and Generate the first event for each
+ // DemandStream.
+ ioTRADEMGEN_Service.generateFirstRequests (lEventQueue);
- // Initialize by adding one request of each type
- const bool stillHavingRequestsToBeGenerated1 =
- ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated (key1);
- if (stillHavingRequestsToBeGenerated1) {
- stdair::BookingRequestPtr_T lRequest1 =
- ioTRADEMGEN_Service.generateNextRequest (key1);
- assert (lRequest1 != NULL);
- stdair::DateTime_T lRequestDateTime = lRequest1->getRequestDateTime ();
- stdair::EventStruct lEventStruct ("Request", lRequestDateTime, key1,
- lRequest1);
- lEventQueue.addEvent (lEventStruct);
- }
- const bool stillHavingRequestsToBeGenerated2 =
- ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated (key2);
- if (stillHavingRequestsToBeGenerated2) {
- stdair::BookingRequestPtr_T lRequest2 =
- ioTRADEMGEN_Service.generateNextRequest (key2);
- assert (lRequest2 != NULL);
- stdair::DateTime_T lRequestDateTime = lRequest2->getRequestDateTime ();
- stdair::EventStruct lEventStruct("Request", lRequestDateTime, key2,
- lRequest2);
- lEventQueue.addEvent (lEventStruct);
- }
-
// Pop requests, get type, and generate next request of same type
int i = 0;
while (lEventQueue.isQueueDone() == false && i < 20) {
@@ -195,7 +74,7 @@
playBookingRequest (ioSIMCRS_Service, lPoppedRequest);
// Retrieve the corresponding demand stream
- const stdair::DemandStreamKey_T& lDemandStreamKey =
+ const stdair::DemandStreamKeyStr_T& lDemandStreamKey =
lEventStruct.getDemandStreamKey ();
// generate next request
bool stillHavingRequestsToBeGenerated =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-02-18 15:43:40
|
Revision: 69
http://dsim.svn.sourceforge.net/dsim/?rev=69&view=rev
Author: quannaus
Date: 2010-02-18 15:43:34 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
[dev] Update the simulator with trademgen.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-02-15 13:15:46 UTC (rev 68)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-02-18 15:43:34 UTC (rev 69)
@@ -48,28 +48,15 @@
// Pop requests, get type, and generate next request of same type
- int i = 0;
- while (lEventQueue.isQueueDone() == false && i < 20) {
- // DEBUG
- STDAIR_LOG_DEBUG ("Before popping (" << i << ")" );
- STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize () );
- STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone () );
-
+ while (lEventQueue.isQueueDone() == false) {
stdair::EventStruct& lEventStruct = lEventQueue.popEvent ();
- // DEBUG
- STDAIR_LOG_DEBUG ("After popping" );
- STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize ());
- STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone ());
-
- STDAIR_LOG_DEBUG ("Popped request " << i );
-
const stdair::BookingRequestStruct& lPoppedRequest =
lEventStruct.getBookingRequest ();
-
+
// DEBUG
- STDAIR_LOG_DEBUG (lPoppedRequest.describe());
-
+ STDAIR_LOG_DEBUG ("Poped request: " << lPoppedRequest.describe());
+
// Play booking request
playBookingRequest (ioSIMCRS_Service, lPoppedRequest);
@@ -79,13 +66,11 @@
// generate next request
bool stillHavingRequestsToBeGenerated =
ioTRADEMGEN_Service.stillHavingRequestsToBeGenerated(lDemandStreamKey);
- STDAIR_LOG_DEBUG ("stillHavingRequestsToBeGenerated: " << stillHavingRequestsToBeGenerated );
+
if (stillHavingRequestsToBeGenerated) {
stdair::BookingRequestPtr_T lNextRequest =
ioTRADEMGEN_Service.generateNextRequest (lDemandStreamKey);
assert (lNextRequest != NULL);
- // DEBUG
- STDAIR_LOG_DEBUG ("Added request: " << lNextRequest->describe());
stdair::DateTime_T lNextRequestDateTime =
lNextRequest->getRequestDateTime ();
@@ -93,24 +78,11 @@
lNextRequestDateTime,
lDemandStreamKey,
lNextRequest);
- lEventQueue.eraseLastUsedEvent ();
lEventQueue.addEvent (lNextEventStruct);
-
- // DEBUG
- STDAIR_LOG_DEBUG ("After adding");
- STDAIR_LOG_DEBUG ("Queue size: " << lEventQueue.getQueueSize ());
- STDAIR_LOG_DEBUG ("Is queue done? " << lEventQueue.isQueueDone ());
-
}
- // DEBUG
- STDAIR_LOG_DEBUG (std::endl);
-
- // Iterate
- ++i;
+ lEventQueue.eraseLastUsedEvent ();
}
- // Play booking request
- //playBookingRequest (ioSIMCRS_Service, lBookingRequest);
// DEBUG
STDAIR_LOG_DEBUG ("The simulation has ended");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-05-03 12:01:44
|
Revision: 81
http://dsim.svn.sourceforge.net/dsim/?rev=81&view=rev
Author: quannaus
Date: 2010-05-03 12:01:37 +0000 (Mon, 03 May 2010)
Log Message:
-----------
[Dev] Changed the structure of list of travel solutions.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-05-03 09:45:23 UTC (rev 80)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-05-03 12:01:37 UTC (rev 81)
@@ -101,18 +101,13 @@
// booking request.
stdair::TravelSolutionList_T lTravelSolutionList =
ioSIMCRS_Service.getTravelSolutions (iBookingRequest);
-
- // Hardcode a travel solution choice.
if (lTravelSolutionList.empty() == false) {
- // DEBUG
- STDAIR_LOG_DEBUG ("A travel solution is chosen.");
-
- stdair::TravelSolutionStruct lChosenTravelSolution =
- lTravelSolutionList.at(0);
- // Get the number of seats in the request.
- const stdair::NbOfSeats_T& lNbOfSeats = iBookingRequest.getPartySize();
+ // Get the fare quote for each travel solution.
+ // Get the availability for each travel solution.
+ ioSIMCRS_Service.getAvailability (lTravelSolutionList);
+ // Hardcode a travel solution choice.
// Make a sale.
- ioSIMCRS_Service.sell (lChosenTravelSolution, lNbOfSeats);
+ // ioSIMCRS_Service.sell (lChosenTravelSolution, lNbOfSeats);
} else {
// DEBUG
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-07-07 15:11:32
|
Revision: 86
http://dsim.svn.sourceforge.net/dsim/?rev=86&view=rev
Author: quannaus
Date: 2010-07-07 15:11:26 +0000 (Wed, 07 Jul 2010)
Log Message:
-----------
[dev] Removed Network.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-06-13 19:41:59 UTC (rev 85)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-07-07 15:11:26 UTC (rev 86)
@@ -14,7 +14,6 @@
#include <stdair/basic/ContinuousAttribute.hpp>
#include <stdair/bom/EventStruct.hpp>
#include <stdair/bom/EventQueue.hpp>
-#include <stdair/bom/OutboundPathTypes.hpp>
#include <stdair/bom/BookingRequestStruct.hpp>
#include <stdair/bom/TravelSolutionStruct.hpp>
#include <stdair/service/Logger.hpp>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-07-08 15:25:06
|
Revision: 87
http://dsim.svn.sourceforge.net/dsim/?rev=87&view=rev
Author: quannaus
Date: 2010-07-08 15:25:00 +0000 (Thu, 08 Jul 2010)
Log Message:
-----------
[Dev] The (arbitrarily) chosen travel solution is displayed/logged.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-07-07 15:11:26 UTC (rev 86)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-07-08 15:25:00 UTC (rev 87)
@@ -103,10 +103,13 @@
if (lTravelSolutionList.empty() == false) {
// Get the fare quote for each travel solution.
// Get the availability for each travel solution.
- ioSIMCRS_Service.getAvailability (lTravelSolutionList);
+ //ioSIMCRS_Service.getAvailability (lTravelSolutionList);
// Hardcode a travel solution choice.
// Make a sale.
// ioSIMCRS_Service.sell (lChosenTravelSolution, lNbOfSeats);
+ stdair::TravelSolutionList_T::iterator itTS = lTravelSolutionList.begin();
+ const stdair::TravelSolutionStruct& lChosenTS = *itTS;
+ STDAIR_LOG_DEBUG ("Chosen TS: " << lChosenTS);
} else {
// DEBUG
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <qua...@us...> - 2010-07-08 15:35:33
|
Revision: 88
http://dsim.svn.sourceforge.net/dsim/?rev=88&view=rev
Author: quannaus
Date: 2010-07-08 15:35:27 +0000 (Thu, 08 Jul 2010)
Log Message:
-----------
[Dev] Just changed the log output for the simulator batch.
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-07-08 15:25:00 UTC (rev 87)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-07-08 15:35:27 UTC (rev 88)
@@ -113,7 +113,7 @@
} else {
// DEBUG
- STDAIR_LOG_DEBUG ("No travel solution is chosen.");
+ STDAIR_LOG_DEBUG ("No travel solution has been found/chosen.");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gsa...@us...> - 2010-11-02 15:04:37
|
Revision: 145
http://dsim.svn.sourceforge.net/dsim/?rev=145&view=rev
Author: gsabatier
Date: 2010-11-02 15:04:31 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Created parser of the simfqt module
Modified Paths:
--------------
trunk/dsim/dsim/command/Simulator.cpp
Modified: trunk/dsim/dsim/command/Simulator.cpp
===================================================================
--- trunk/dsim/dsim/command/Simulator.cpp 2010-10-20 15:55:11 UTC (rev 144)
+++ trunk/dsim/dsim/command/Simulator.cpp 2010-11-02 15:04:31 UTC (rev 145)
@@ -92,8 +92,10 @@
ioSIMCRS_Service.getTravelSolutions (iBookingRequest);
if (lTravelSolutionList.empty() == false) {
// Get the fare quote for each travel solution.
+ ioSIMCRS_Service.getFare(lTravelSolutionList);
+
// Get the availability for each travel solution.
- //ioSIMCRS_Service.getAvailability (lTravelSolutionList);
+ ioSIMCRS_Service.getAvailability (lTravelSolutionList);
// Hardcode a travel solution choice.
stdair::TravelSolutionList_T::iterator itTS = lTravelSolutionList.begin();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|