|
From: <den...@us...> - 2010-10-20 15:55:17
|
Revision: 144
http://dsim.svn.sourceforge.net/dsim/?rev=144&view=rev
Author: denis_arnaud
Date: 2010-10-20 15:55:11 +0000 (Wed, 20 Oct 2010)
Log Message:
-----------
[Dev] Added missing input files as option of the batch.
Modified Paths:
--------------
trunk/dsim/dsim/batches/simulate.cpp
Modified: trunk/dsim/dsim/batches/simulate.cpp
===================================================================
--- trunk/dsim/dsim/batches/simulate.cpp 2010-10-15 09:59:36 UTC (rev 143)
+++ trunk/dsim/dsim/batches/simulate.cpp 2010-10-20 15:55:11 UTC (rev 144)
@@ -32,6 +32,12 @@
/** Default name and location for the (CSV) schedule input file. */
const std::string K_DSIM_DEFAULT_SCHEDULE_INPUT_FILENAME ("../../test/samples/schedule01.csv");
+/** Default name and location for the (CSV) O&D input file. */
+const std::string K_DSIM_DEFAULT_OND_INPUT_FILENAME ("../../test/samples/ond01.csv");
+
+/** Default name and location for the (CSV) fare input file. */
+const std::string K_DSIM_DEFAULT_FARE_INPUT_FILENAME ("../../test/samples/fare01.csv");
+
/** Default query string. */
const std::string K_DSIM_DEFAULT_QUERY_STRING ("my good old query");
@@ -97,8 +103,10 @@
/** Read and parse the command line options. */
int readConfiguration (int argc, char* argv[],
std::string& ioQueryString,
+ stdair::Filename_T& ioDemandInputFilename,
stdair::Filename_T& ioScheduleInputFilename,
- stdair::Filename_T& ioDemandInputFilename,
+ stdair::Filename_T& ioOnDInputFilename,
+ stdair::Filename_T& ioFareInputFilename,
std::string& ioLogFilename,
std::string& ioDBUser, std::string& ioDBPasswd,
std::string& ioDBHost, std::string& ioDBPort,
@@ -125,11 +133,17 @@
boost::program_options::options_description config ("Configuration");
config.add_options()
("demand,d",
- boost::program_options::value< std::string >(&ioScheduleInputFilename)->default_value(K_DSIM_DEFAULT_DEMAND_INPUT_FILENAME),
+ boost::program_options::value< std::string >(&ioDemandInputFilename)->default_value(K_DSIM_DEFAULT_DEMAND_INPUT_FILENAME),
"(CVS) input file for the demand distributions")
("schedule,s",
- boost::program_options::value< std::string >(&ioDemandInputFilename)->default_value(K_DSIM_DEFAULT_SCHEDULE_INPUT_FILENAME),
+ boost::program_options::value< std::string >(&ioScheduleInputFilename)->default_value(K_DSIM_DEFAULT_SCHEDULE_INPUT_FILENAME),
"(CVS) input file for the schedules")
+ ("ond,o",
+ boost::program_options::value< std::string >(&ioOnDInputFilename)->default_value(K_DSIM_DEFAULT_OND_INPUT_FILENAME),
+ "(CVS) input file for the O&D definitions")
+ ("fare,f",
+ boost::program_options::value< std::string >(&ioFareInputFilename)->default_value(K_DSIM_DEFAULT_FARE_INPUT_FILENAME),
+ "(CVS) input file for the fares")
("log,l",
boost::program_options::value< std::string >(&ioLogFilename)->default_value(K_DSIM_DEFAULT_LOG_FILENAME),
"Filepath for the logs")
@@ -198,18 +212,28 @@
return K_DSIM_EARLY_RETURN_STATUS;
}
+ if (vm.count ("demand")) {
+ ioDemandInputFilename = vm["demand"].as< std::string >();
+ std::cout << "Demand input filename is: " << ioDemandInputFilename
+ << std::endl;
+ }
+
+ if (vm.count ("ond")) {
+ ioOnDInputFilename = vm["ond"].as< std::string >();
+ std::cout << "O&D input filename is: " << ioOnDInputFilename << std::endl;
+ }
+
+ if (vm.count ("fare")) {
+ ioFareInputFilename = vm["fare"].as< std::string >();
+ std::cout << "Fare input filename is: " << ioFareInputFilename << std::endl;
+ }
+
if (vm.count ("schedule")) {
ioScheduleInputFilename = vm["schedule"].as< std::string >();
std::cout << "Schedule input filename is: " << ioScheduleInputFilename
<< std::endl;
}
- if (vm.count ("demand")) {
- ioDemandInputFilename = vm["demand"].as< std::string >();
- std::cout << "Demand input filename is: " << ioDemandInputFilename
- << std::endl;
- }
-
if (vm.count ("log")) {
ioLogFilename = vm["log"].as< std::string >();
std::cout << "Log filename is: " << ioLogFilename << std::endl;
@@ -254,12 +278,18 @@
// Query
std::string lQuery;
+ // Demand input file name
+ stdair::Filename_T lDemandInputFilename;
+
// Schedule input file name
stdair::Filename_T lScheduleInputFilename;
- // Demand input file name
- stdair::Filename_T lDemandInputFilename;
-
+ // O&D input filename
+ std::string lOnDInputFilename;
+
+ // Fare input filename
+ std::string lFareInputFilename;
+
// Output log File
std::string lLogFilename;
@@ -275,8 +305,9 @@
// Call the command-line option parser
const int lOptionParserStatus =
- readConfiguration (argc, argv, lQuery, lScheduleInputFilename,
- lDemandInputFilename, lLogFilename,
+ readConfiguration (argc, argv, lQuery, lDemandInputFilename,
+ lScheduleInputFilename, lOnDInputFilename,
+ lFareInputFilename, lLogFilename,
lDBUser, lDBPasswd, lDBHost, lDBPort, lDBDBName);
if (lOptionParserStatus == K_DSIM_EARLY_RETURN_STATUS) {
@@ -296,8 +327,8 @@
// Initialise the simulation context
const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
DSIM::DSIM_Service dsimService (lLogParams, lDBParams,
- lScheduleInputFilename,
- lDemandInputFilename);
+ lScheduleInputFilename, lOnDInputFilename,
+ lFareInputFilename, lDemandInputFilename);
// Perform a simulation
dsimService.simulate();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <den...@us...> - 2010-11-02 17:45:58
|
Revision: 146
http://dsim.svn.sourceforge.net/dsim/?rev=146&view=rev
Author: denis_arnaud
Date: 2010-11-02 17:45:52 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
[Dev] Removed the exception try-catch clause, as it was hindering to get the call stack in case of exception.
Modified Paths:
--------------
trunk/dsim/dsim/batches/simulate.cpp
Modified: trunk/dsim/dsim/batches/simulate.cpp
===================================================================
--- trunk/dsim/dsim/batches/simulate.cpp 2010-11-02 15:04:31 UTC (rev 145)
+++ trunk/dsim/dsim/batches/simulate.cpp 2010-11-02 17:45:52 UTC (rev 146)
@@ -273,72 +273,68 @@
// ///////// M A I N ////////////
int main (int argc, char* argv[]) {
- try {
+ // Query
+ std::string lQuery;
- // Query
- std::string lQuery;
+ // Demand input file name
+ stdair::Filename_T lDemandInputFilename;
- // Demand input file name
- stdair::Filename_T lDemandInputFilename;
+ // Schedule input file name
+ stdair::Filename_T lScheduleInputFilename;
- // Schedule input file name
- stdair::Filename_T lScheduleInputFilename;
-
- // O&D input filename
- std::string lOnDInputFilename;
+ // O&D input filename
+ std::string lOnDInputFilename;
- // Fare input filename
- std::string lFareInputFilename;
+ // Fare input filename
+ std::string lFareInputFilename;
- // Output log File
- std::string lLogFilename;
+ // Output log File
+ std::string lLogFilename;
- // SQL database parameters
- std::string lDBUser;
- std::string lDBPasswd;
- std::string lDBHost;
- std::string lDBPort;
- std::string lDBDBName;
+ // SQL database parameters
+ std::string lDBUser;
+ std::string lDBPasswd;
+ std::string lDBHost;
+ std::string lDBPort;
+ std::string lDBDBName;
- // Airline code
- stdair::AirlineCode_T lAirlineCode ("BA");
+ // Airline code
+ stdair::AirlineCode_T lAirlineCode ("BA");
- // Call the command-line option parser
- const int lOptionParserStatus =
- readConfiguration (argc, argv, lQuery, lDemandInputFilename,
- lScheduleInputFilename, lOnDInputFilename,
- lFareInputFilename, lLogFilename,
- lDBUser, lDBPasswd, lDBHost, lDBPort, lDBDBName);
+ // Call the command-line option parser
+ const int lOptionParserStatus =
+ readConfiguration (argc, argv, lQuery, lDemandInputFilename,
+ lScheduleInputFilename, lOnDInputFilename,
+ lFareInputFilename, lLogFilename,
+ lDBUser, lDBPasswd, lDBHost, lDBPort, lDBDBName);
- if (lOptionParserStatus == K_DSIM_EARLY_RETURN_STATUS) {
- return 0;
- }
+ if (lOptionParserStatus == K_DSIM_EARLY_RETURN_STATUS) {
+ return 0;
+ }
- // Set the database parameters
- stdair::BasDBParams lDBParams (lDBUser, lDBPasswd, lDBHost, lDBPort,
- lDBDBName);
+ // Set the database parameters
+ stdair::BasDBParams lDBParams (lDBUser, lDBPasswd, lDBHost, lDBPort,
+ lDBDBName);
- // Set the log parameters
- std::ofstream logOutputFile;
- // open and clean the log outputfile
- logOutputFile.open (lLogFilename.c_str());
- logOutputFile.clear();
+ // Set the log parameters
+ std::ofstream logOutputFile;
+ // open and clean the log outputfile
+ logOutputFile.open (lLogFilename.c_str());
+ logOutputFile.clear();
- // Initialise the simulation context
- const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
- DSIM::DSIM_Service dsimService (lLogParams, lDBParams,
- lScheduleInputFilename, lOnDInputFilename,
- lFareInputFilename, lDemandInputFilename);
+ // Initialise the simulation context
+ const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
+ DSIM::DSIM_Service dsimService (lLogParams, lDBParams,
+ lScheduleInputFilename, lOnDInputFilename,
+ lFareInputFilename, lDemandInputFilename);
- // Perform a simulation
- dsimService.simulate();
+ // Perform a simulation
+ dsimService.simulate();
- // DEBUG
- // Display the airlines stored in the database
- dsimService.displayAirlineListFromDB();
+ // DEBUG
+ // Display the airlines stored in the database
+ dsimService.displayAirlineListFromDB();
- } CATCH_ALL_EXCEPTIONS
-
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|