diff --git a/trunk/paradiseo-mo/src/sampling/moSampling.h b/trunk/paradiseo-mo/src/sampling/moSampling.h index 765652ee4..b118b9d48 100644 --- a/trunk/paradiseo-mo/src/sampling/moSampling.h +++ b/trunk/paradiseo-mo/src/sampling/moSampling.h @@ -74,6 +74,8 @@ public: { checkpoint = new moCheckpoint(*continuator); add(_stat, _monitoring); + // precision of the output by default + precisionOutput = std::cout.precision(); } /** @@ -128,6 +130,14 @@ public: localSearch->setContinuator(*continuator); } + /** + * to set the precision of the output file + * @param _precision precision of the output (number of digit) + */ + void precision(unsigned int _precision) { + precisionOutput = _precision; + } + /** * to export the vectors of values into one file * @param _filename file name @@ -149,6 +159,11 @@ public: throw std::runtime_error(str); } + // set the precision of the output + os.precision(precisionOutput); + for (unsigned int j = 0; j < monitorVec.size(); j++) + monitorVec[j]->precision(precisionOutput); + // all vector have the same size unsigned vecSize = monitorVec[0]->size(); @@ -176,6 +191,7 @@ public: throw std::runtime_error(str); } + monitorVec[_col]->precision(precisionOutput); monitorVec[_col]->fileExport(_filename, _openFile); } @@ -214,6 +230,9 @@ protected: std::vector< moVectorMonitor *> monitorVec; + // precision of the output + unsigned int precisionOutput; + };