1#include "storm-config.h"
18class ApproxDepthConfig {
20 typedef double ValueType;
22 static storm::dft::DftEnvironment createEnvironment() {
23 storm::dft::DftEnvironment env;
33class ApproxProbabilityConfig {
35 typedef double ValueType;
37 static storm::dft::DftEnvironment createEnvironment() {
38 storm::dft::DftEnvironment env;
48class ApproxBoundDifferenceConfig {
50 typedef double ValueType;
52 static storm::dft::DftEnvironment createEnvironment() {
53 storm::dft::DftEnvironment env;
64template<
typename TestType>
65class DftApproximationTest :
public ::testing::Test {
67 typedef typename TestType::ValueType ValueType;
69 DftApproximationTest() : _environment(TestType::createEnvironment()) {}
71 std::pair<double, double> analyzeMTTF(std::string
const& file,
double errorBound)
const {
72 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
75 std::string
property =
"T=? [F \"failed\"]";
77 storm::dft::DftEnvironment env = this->env();
81 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
84 std::pair<double, double> analyzeTimebound(std::string
const& file,
double timeBound,
double errorBound)
const {
85 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
88 std::stringstream propertyStream;
89 propertyStream <<
"P=? [F<=" << timeBound <<
" \"failed\"]";
90 std::vector<std::shared_ptr<storm::logic::Formula const>> properties =
92 storm::dft::DftEnvironment env = this->env();
96 return boost::get<storm::dft::modelchecker::DFTModelChecker<double>::approximation_result>(results[0]);
99 storm::dft::DftEnvironment
const& env()
const {
104 storm::dft::DftEnvironment _environment;
107typedef ::testing::Types<ApproxDepthConfig, ApproxProbabilityConfig, ApproxBoundDifferenceConfig>
TestingTypes;
112 double errorBound = 2;
113 std::pair<double, double> approxResult = this->analyzeMTTF(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", errorBound);
114 EXPECT_LE(approxResult.first, 417.9436693);
115 EXPECT_GE(approxResult.second, 417.9436693);
116 EXPECT_LE(2 * (approxResult.second - approxResult.first) / (approxResult.first + approxResult.second), errorBound);
118 EXPECT_GE(approxResult.second - approxResult.first, errorBound * approxResult.first / 10);
121TYPED_TEST(DftApproximationTest, HecsTimebound) {
123 double errorBound = 0.1;
124 double timeBound = 100;
125 std::pair<double, double> approxResult = this->analyzeTimebound(STORM_TEST_RESOURCES_DIR
"/dft/hecs_3_2_2_np.dft", timeBound, errorBound);
126 EXPECT_LE(approxResult.first, 0.0410018417);
127 EXPECT_GE(approxResult.second, 0.0410018417);
128 EXPECT_LE(approxResult.second - approxResult.first, errorBound);
130 EXPECT_GE(approxResult.second - approxResult.first, errorBound / 10);
void setUseModularisation(bool value)
void setApproximationHeuristic(storm::dft::builder::ApproximationHeuristic value)
void setApproximationError(double value)
AnalysisEnvironment & analysis()
ModelBuilderEnvironment & modelBuilder()
TransformationEnvironment & transformation()
void setUseSymmetryReduction(bool value)
void setAllowDCForRelevantEvents(bool value)
std::vector< boost::variant< ExtendedValueType, approximation_result > > dft_results
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
std::vector< storm::jani::Property > parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional< std::set< std::string > > const &propertyFilter)
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::DftEnvironment const &env, storm::dft::storage::DFT< ValueType > const &dft, std::vector< std::shared_ptr< storm::logic::Formula const > > const &properties, storm::dft::utility::RelevantEvents const &relevantEvents, bool printOutput, typename storm::dft::modelchecker::DFTModelChecker< ValueType >::ModelExportCallback const &exportCallback)
Compute the exact or approximate analysis result of the given DFT according to the given properties.
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes