4 changed files with 38 additions and 57 deletions
			
			
		- 
					34src/storm-pars/api/export.h
 - 
					1src/storm-pars/api/storm-pars.h
 - 
					27src/storm/api/export.h
 - 
					31src/storm/utility/export.h
 
@ -0,0 +1,34 @@ | 
			
		|||||
 | 
				#include "storm/utility/file.h" | 
			
		||||
 | 
				#include "storm/utility/macros.h" | 
			
		||||
 | 
				#include "storm/exceptions/NotSupportedException.h" | 
			
		||||
 | 
				#include "storm/analysis/GraphConditions.h" | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				namespace storm { | 
			
		||||
 | 
				    namespace api { | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        template <typename ValueType> | 
			
		||||
 | 
				        void exportParametricResultToFile(ValueType const& result, storm::analysis::ConstraintCollector<ValueType> const& constraintCollector, std::string const& path) { | 
			
		||||
 | 
				            STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Cannot export non-parametric result."); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				
 | 
			
		||||
 | 
				        template <> | 
			
		||||
 | 
				        inline void exportParametricResultToFile(storm::RationalFunction const& result, storm::analysis::ConstraintCollector<storm::RationalFunction> const& constraintCollector, std::string const& path) { | 
			
		||||
 | 
				            std::ofstream filestream; | 
			
		||||
 | 
				            storm::utility::openFile(path, filestream); | 
			
		||||
 | 
				            filestream << "$Parameters: "; | 
			
		||||
 | 
				            std::set<storm::RationalFunctionVariable> vars = result.gatherVariables(); | 
			
		||||
 | 
				            std::copy(vars.begin(), vars.end(), std::ostream_iterator<storm::RationalFunctionVariable>(filestream, "; ")); | 
			
		||||
 | 
				            filestream << std::endl; | 
			
		||||
 | 
				            filestream << "$Result: " << result.toString(false, true) << std::endl; | 
			
		||||
 | 
				            filestream << "$Well-formed Constraints: " << std::endl; | 
			
		||||
 | 
				            std::vector<std::string> stringConstraints; | 
			
		||||
 | 
				            std::transform(constraintCollector.getWellformedConstraints().begin(), constraintCollector.getWellformedConstraints().end(), std::back_inserter(stringConstraints), [](carl::Formula<typename storm::Polynomial::PolyType> const& c) ->  std::string { return c.toString();}); | 
			
		||||
 | 
				            std::copy(stringConstraints.begin(), stringConstraints.end(), std::ostream_iterator<std::string>(filestream, "\n")); | 
			
		||||
 | 
				            filestream << "$Graph-preserving Constraints: " << std::endl; | 
			
		||||
 | 
				            stringConstraints.clear(); | 
			
		||||
 | 
				            std::transform(constraintCollector.getGraphPreservingConstraints().begin(), constraintCollector.getGraphPreservingConstraints().end(), std::back_inserter(stringConstraints), [](carl::Formula<typename storm::Polynomial::PolyType> const& c) ->  std::string { return c.toString();}); | 
			
		||||
 | 
				            std::copy(stringConstraints.begin(), stringConstraints.end(), std::ostream_iterator<std::string>(filestream, "\n")); | 
			
		||||
 | 
				            storm::utility::closeFile(filestream); | 
			
		||||
 | 
				        } | 
			
		||||
 | 
				    } | 
			
		||||
 | 
				} | 
			
		||||
@ -1,3 +1,4 @@ | 
			
		|||||
#pragma once | 
				#pragma once | 
			
		||||
 | 
				
 | 
			
		||||
#include "storm-pars/api/region.h" | 
				#include "storm-pars/api/region.h" | 
			
		||||
 | 
				#include "storm-pars/api/export.h" | 
			
		||||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue