1#include "storm-config.h"
10struct DftAnalysisConfig {
15class ApproxDepthConfig {
19 static DftAnalysisConfig createConfig() {
24class ApproxProbabilityConfig {
28 static DftAnalysisConfig createConfig() {
33class ApproxBoundDifferenceConfig {
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 =
56 storm::dft::api::prepareForMarkovAnalysis<double>(*storm::dft::api::loadDFTGalileoFile<double>(file));
58 std::string
property =
"T=? [F \"failed\"]";
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 =
67 storm::dft::api::prepareForMarkovAnalysis<double>(*storm::dft::api::loadDFTGalileoFile<double>(file));
69 std::stringstream propertyStream;
70 propertyStream <<
"P=? [F<=" << timeBound <<
" \"failed\"]";
71 std::vector<std::shared_ptr<storm::logic::Formula const>> properties =
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)
std::pair< bool, std::string > isWellFormed(storm::dft::storage::DFT< ValueType > const &dft, bool validForMarkovianAnalysis=true)
Check whether the DFT is well-formed.
ApproximationHeuristic
Enum representing the heuristic used for deciding which states to expand.
SFTBDDChecker::ValueType ValueType
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes