1#include "storm-config.h"
14struct DftAnalysisConfig {
19class ApproxDepthConfig {
21 typedef double ValueType;
23 static DftAnalysisConfig createConfig() {
28class ApproxProbabilityConfig {
30 typedef double ValueType;
32 static DftAnalysisConfig createConfig() {
37class ApproxBoundDifferenceConfig {
39 typedef double ValueType;
41 static DftAnalysisConfig createConfig() {
47template<
typename TestType>
48class DftApproximationTest :
public ::testing::Test {
50 typedef typename TestType::ValueType ValueType;
52 DftApproximationTest() : config(TestType::createConfig()) {}
54 DftApproximationTest
const& getConfig()
const {
58 std::pair<double, double> analyzeMTTF(std::string
const& file,
double errorBound)
const {
59 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
62 std::string
property =
"T=? [F \"failed\"]";
65 *dft, properties, config.useSR,
false, storm::dft::utility::RelevantEvents(),
false, errorBound, config.heuristic,
false);
66 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
69 std::pair<double, double> analyzeTimebound(std::string
const& file,
double timeBound,
double errorBound)
const {
70 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
73 std::stringstream propertyStream;
74 propertyStream <<
"P=? [F<=" << timeBound <<
" \"failed\"]";
75 std::vector<std::shared_ptr<storm::logic::Formula const>> properties =
78 *dft, properties, config.useSR,
false, storm::dft::utility::RelevantEvents(),
false, errorBound, config.heuristic,
false);
79 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
83 DftAnalysisConfig config;
86typedef ::testing::Types<ApproxDepthConfig, ApproxProbabilityConfig, ApproxBoundDifferenceConfig>
TestingTypes;
91 double errorBound = 2;
92 std::pair<double, double> approxResult = this->analyzeMTTF(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", errorBound);
93 EXPECT_LE(approxResult.first, 417.9436693);
94 EXPECT_GE(approxResult.second, 417.9436693);
95 EXPECT_LE(2 * (approxResult.second - approxResult.first) / (approxResult.first + approxResult.second), errorBound);
97 EXPECT_GE(approxResult.second - approxResult.first, errorBound * approxResult.first / 10);
100TYPED_TEST(DftApproximationTest, HecsTimebound) {
102 double errorBound = 0.1;
103 double timeBound = 100;
104 std::pair<double, double> approxResult = this->analyzeTimebound(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", timeBound, errorBound);
105 EXPECT_LE(approxResult.first, 0.0410018417);
106 EXPECT_GE(approxResult.second, 0.0410018417);
107 EXPECT_LE(approxResult.second - approxResult.first, errorBound);
109 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)
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::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTGalileoFile(std::string const &file)
Load DFT from Galileo file.
std::pair< bool, std::string > isWellFormed(storm::dft::storage::DFT< ValueType > const &dft, bool validForMarkovianAnalysis)
Check whether the DFT is well-formed.
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, bool allowModularisation, storm::dft::utility::RelevantEvents const &relevantEvents, bool allowDCForRelevant, double approximationError, storm::dft::builder::ApproximationHeuristic approximationHeuristic, bool eliminateChains, storm::transformer::EliminationLabelBehavior labelBehavior, bool printOutput)
Compute the exact or approximate analysis result of the given DFT according to the given properties.
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