1#include "storm-config.h"
10struct DftAnalysisConfig {
15class ApproxDepthConfig {
17 typedef double ValueType;
19 static DftAnalysisConfig createConfig() {
24class ApproxProbabilityConfig {
26 typedef double ValueType;
28 static DftAnalysisConfig createConfig() {
33class ApproxBoundDifferenceConfig {
35 typedef double ValueType;
37 static DftAnalysisConfig createConfig() {
43template<
typename TestType>
44class DftApproximationTest :
public ::testing::Test {
46 typedef typename TestType::ValueType ValueType;
48 DftApproximationTest() : config(TestType::createConfig()) {}
50 DftApproximationTest
const& getConfig()
const {
54 std::pair<double, double> analyzeMTTF(std::string
const& file,
double errorBound) {
55 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
58 std::string
property =
"T=? [F \"failed\"]";
61 *dft, properties, config.useSR,
false, storm::dft::utility::RelevantEvents(),
false, errorBound, config.heuristic,
false);
62 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
65 std::pair<double, double> analyzeTimebound(std::string
const& file,
double timeBound,
double errorBound) {
66 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
69 std::stringstream propertyStream;
70 propertyStream <<
"P=? [F<=" << timeBound <<
" \"failed\"]";
71 std::vector<std::shared_ptr<storm::logic::Formula const>> properties =
74 *dft, properties, config.useSR,
false, storm::dft::utility::RelevantEvents(),
false, errorBound, config.heuristic,
false);
75 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
79 DftAnalysisConfig config;
82typedef ::testing::Types<ApproxDepthConfig, ApproxProbabilityConfig, ApproxBoundDifferenceConfig>
TestingTypes;
87 double errorBound = 2;
88 std::pair<double, double> approxResult = this->analyzeMTTF(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", errorBound);
89 EXPECT_LE(approxResult.first, 417.9436693);
90 EXPECT_GE(approxResult.second, 417.9436693);
91 EXPECT_LE(2 * (approxResult.second - approxResult.first) / (approxResult.first + approxResult.second), errorBound);
93 EXPECT_GE(approxResult.second - approxResult.first, errorBound * approxResult.first / 10);
96TYPED_TEST(DftApproximationTest, HecsTimebound) {
98 double errorBound = 0.1;
99 double timeBound = 100;
100 std::pair<double, double> approxResult = this->analyzeTimebound(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", timeBound, errorBound);
101 EXPECT_LE(approxResult.first, 0.0410018417);
102 EXPECT_GE(approxResult.second, 0.0410018417);
103 EXPECT_LE(approxResult.second - approxResult.first, errorBound);
105 EXPECT_GE(approxResult.second - approxResult.first, errorBound / 10);
std::vector< boost::variant< ValueType, approximation_result > > dft_results
std::vector< storm::jani::Property > parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional< std::set< std::string > > const &propertyFilter)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
storm::dft::modelchecker::DFTModelChecker< ValueType >::dft_results analyzeDFT(storm::dft::storage::DFT< ValueType > const &dft, std::vector< std::shared_ptr< storm::logic::Formula const > > const &properties, bool symred=true, bool allowModularisation=true, storm::dft::utility::RelevantEvents const &relevantEvents={}, bool allowDCForRelevant=false, double approximationError=0.0, storm::dft::builder::ApproximationHeuristic approximationHeuristic=storm::dft::builder::ApproximationHeuristic::DEPTH, bool eliminateChains=false, storm::transformer::EliminationLabelBehavior labelBehavior=storm::transformer::EliminationLabelBehavior::KeepLabels, bool printOutput=false)
Compute the exact or approximate analysis result of the given DFT according to the given properties.
std::shared_ptr< storm::dft::storage::DFT< ValueType > > prepareForMarkovAnalysis(storm::dft::storage::DFT< ValueType > const &dft)
Apply transformations to make DFT feasible for Markovian analysis.
std::pair< bool, std::string > isWellFormed(storm::dft::storage::DFT< ValueType > const &dft, bool validForMarkovianAnalysis=true)
Check whether the DFT is well-formed.
std::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTGalileoFile(std::string const &file)
Load DFT from Galileo file.
ApproximationHeuristic
Enum representing the heuristic used for deciding which states to expand.
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes