38 std::string
rmol (
const int& iRandomDraws,
const short& iMethod,
39 const double& iCapacity) {
40 std::ostringstream oStream;
43 if (_logOutputStream == NULL) {
44 oStream <<
"The log filepath is not valid." << std::endl;
47 assert (_logOutputStream != NULL);
52 *_logOutputStream <<
"Optimisation for " << iRandomDraws <<
" draws, "
53 <<
"capacity of " << iCapacity
54 <<
", and with the following method: "
55 << iMethod << std::endl;
57 if (_rmolService == NULL) {
58 oStream <<
"The RMOL service has not been initialised, "
59 <<
"i.e., the init() method has not been called "
60 <<
"correctly on the RMOLer object. Please "
61 <<
"check that all the parameters are not empty and "
62 <<
"point to actual files.";
63 *_logOutputStream << oStream.str();
66 assert (_rmolService != NULL);
101 *_logOutputStream <<
"End of the optimisation." << std::endl;
104 *_logOutputStream <<
"RMOL output: "
105 << oStream.str() << std::endl;
107 }
catch (
const stdair::RootException& eRMOLError) {
108 oStream <<
"RMOL error: " << eRMOLError.what() << std::endl;
110 }
catch (
const std::exception& eStdError) {
111 oStream <<
"Error: " << eStdError.what() << std::endl;
114 oStream <<
"Unknown error" << std::endl;
118 oStream <<
"RMOL has completed the generation of the booking "
119 <<
"requests. See the log file for more details." << std::endl;
121 return oStream.str();
144 bool init (
const std::string& iLogFilepath,
145 const short& iCapacity,
const bool isBuiltin,
146 const stdair::Filename_T& iInputFilename) {
147 bool isEverythingOK =
true;
152 const bool isWriteable = (iLogFilepath.empty() ==
false);
154 if (isWriteable ==
false) {
155 isEverythingOK =
false;
156 return isEverythingOK;
160 _logOutputStream =
new std::ofstream;
161 assert (_logOutputStream != NULL);
164 _logOutputStream->open (iLogFilepath.c_str());
165 _logOutputStream->clear();
168 *_logOutputStream <<
"Python wrapper initialisation" << std::endl;
169 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG,
174 assert (_rmolService != NULL);
177 if (isBuiltin ==
true) {
187 *_logOutputStream <<
"Python wrapper initialised" << std::endl;
189 }
catch (
const stdair::RootException& eRMOLError) {
190 *_logOutputStream <<
"RMOL error: " << eRMOLError.what()
193 }
catch (
const std::exception& eStdError) {
194 *_logOutputStream <<
"Error: " << eStdError.what() << std::endl;
197 *_logOutputStream <<
"Unknown error" << std::endl;
200 return isEverythingOK;