diff --git a/src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp b/src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp index 59e6a1ff1..8dcfb1f5b 100644 --- a/src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp +++ b/src/storm/modelchecker/multiobjective/pcaa/SparseMdpRewardBoundedPcaaWeightVectorChecker.cpp @@ -70,7 +70,7 @@ namespace storm { for (uint64_t i = 0; i < this->objectives.size(); ++i) { headers.push_back("obj" + std::to_string(i)); } - storm::utility::exportDataToCSVFile("cdf" + std::to_string(numChecks) + ".csv", cdfData, headers); + storm::utility::exportDataToCSVFile("cdf" + std::to_string(numChecks) + ".csv", cdfData, weightVector, headers); } auto solution = rewardUnfolding.getInitialStateResult(initEpoch); // Todo: we currently assume precise results... diff --git a/src/storm/modelchecker/multiobjective/pcaa/SparsePcaaQuery.cpp b/src/storm/modelchecker/multiobjective/pcaa/SparsePcaaQuery.cpp index eb888c92c..e230d838b 100644 --- a/src/storm/modelchecker/multiobjective/pcaa/SparsePcaaQuery.cpp +++ b/src/storm/modelchecker/multiobjective/pcaa/SparsePcaaQuery.cpp @@ -228,7 +228,7 @@ namespace storm { for(auto const& v : underApproxVertices) { pointsForPlotting.push_back(storm::utility::vector::convertNumericVector(v)); } - storm::utility::exportDataToCSVFile(destinationDir + "underapproximation.csv", pointsForPlotting, columnHeaders); + storm::utility::exportDataToCSVFile(destinationDir + "underapproximation.csv", pointsForPlotting, columnHeaders); pointsForPlotting.clear(); overApproxVertices = transformedOverApprox->intersection(boundariesAsPolytope)->getVerticesInClockwiseOrder(); @@ -236,14 +236,14 @@ namespace storm { for(auto const& v : overApproxVertices) { pointsForPlotting.push_back(storm::utility::vector::convertNumericVector(v)); } - storm::utility::exportDataToCSVFile(destinationDir + "overapproximation.csv", pointsForPlotting, columnHeaders); + storm::utility::exportDataToCSVFile(destinationDir + "overapproximation.csv", pointsForPlotting, columnHeaders); pointsForPlotting.clear(); pointsForPlotting.reserve(paretoPoints.size()); for(auto const& v : paretoPoints) { pointsForPlotting.push_back(storm::utility::vector::convertNumericVector(v)); } - storm::utility::exportDataToCSVFile(destinationDir + "paretopoints.csv", pointsForPlotting, columnHeaders); + storm::utility::exportDataToCSVFile(destinationDir + "paretopoints.csv", pointsForPlotting, columnHeaders); pointsForPlotting.clear(); auto boundVertices = boundariesAsPolytope->getVerticesInClockwiseOrder(); @@ -251,7 +251,7 @@ namespace storm { for(auto const& v : boundVertices) { pointsForPlotting.push_back(storm::utility::vector::convertNumericVector(v)); } - storm::utility::exportDataToCSVFile(destinationDir + "boundaries.csv", pointsForPlotting, columnHeaders); + storm::utility::exportDataToCSVFile(destinationDir + "boundaries.csv", pointsForPlotting, columnHeaders); } #ifdef STORM_HAVE_CARL diff --git a/src/storm/utility/export.h b/src/storm/utility/export.h index 61fb9e46f..babf90d63 100644 --- a/src/storm/utility/export.h +++ b/src/storm/utility/export.h @@ -14,14 +14,24 @@ namespace storm { - template - inline void exportDataToCSVFile(std::string filepath, std::vector> const& data, boost::optional> const& columnHeaders) { + template + inline void exportDataToCSVFile(std::string filepath, std::vector> const& data, boost::optional> const& header1 = boost::none, boost::optional> const& header2 = boost::none) { std::ofstream filestream; storm::utility::openFile(filepath, filestream); - if(columnHeaders) { - for(auto columnIt = columnHeaders->begin(); columnIt != columnHeaders->end(); ++columnIt) { - if(columnIt != columnHeaders->begin()) { + if (header1) { + for(auto columnIt = header1->begin(); columnIt != header1->end(); ++columnIt) { + if(columnIt != header1->begin()) { + filestream << ","; + } + filestream << *columnIt; + } + filestream << std::endl; + } + + if (header2) { + for(auto columnIt = header2->begin(); columnIt != header2->end(); ++columnIt) { + if(columnIt != header2->begin()) { filestream << ","; } filestream << *columnIt;