1#include "storm-config.h"
20class GmmxxDoubleGmresEnvironment {
23 static const bool isExact =
false;
24 static storm::Environment createEnvironment() {
25 storm::Environment env;
34class EigenDoubleDGmresEnvironment {
37 static const bool isExact =
false;
38 static storm::Environment createEnvironment() {
39 storm::Environment env;
49class EigenRationalLUEnvironment {
51 typedef storm::RationalNumber ValueType;
52 static const bool isExact =
true;
53 static storm::Environment createEnvironment() {
54 storm::Environment env;
61class NativeSorEnvironment {
63 typedef double ValueType;
64 static const bool isExact =
false;
65 static storm::Environment createEnvironment() {
66 storm::Environment env;
75class NativePowerEnvironment {
77 typedef double ValueType;
78 static const bool isExact =
false;
79 static storm::Environment createEnvironment() {
80 storm::Environment env;
88class NativeWalkerChaeEnvironment {
90 typedef double ValueType;
91 static const bool isExact =
false;
92 static storm::Environment createEnvironment() {
93 storm::Environment env;
102template<
typename TestType>
103class ConditionalDtmcPrctlModelCheckerTest :
public ::testing::Test {
105 typedef typename TestType::ValueType ValueType;
106 ConditionalDtmcPrctlModelCheckerTest() : _environment(TestType::createEnvironment()) {}
108 void SetUp()
override {
110 GTEST_SKIP() <<
"Z3 not available.";
114 storm::Environment
const& env()
const {
117 ValueType
parseNumber(std::string
const& input)
const {
120 ValueType precision()
const {
125 storm::Environment _environment;
128typedef ::testing::Types<
130 GmmxxDoubleGmresEnvironment, EigenDoubleDGmresEnvironment,
132 EigenRationalLUEnvironment, NativeSorEnvironment, NativePowerEnvironment, NativeWalkerChaeEnvironment>
137TYPED_TEST(ConditionalDtmcPrctlModelCheckerTest, Conditional) {
138 typedef typename TestFixture::ValueType
ValueType;
146 ASSERT_EQ(4ul, model->getNumberOfStates());
147 ASSERT_EQ(5ul, model->getNumberOfTransitions());
149 std::shared_ptr<storm::models::sparse::Dtmc<ValueType>> dtmc = model->template as<storm::models::sparse::Dtmc<ValueType>>();
155 auto expManager = std::make_shared<storm::expressions::ExpressionManager>();
157 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString(
"P=? [F \"target\"]");
159 std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(this->env(), *formula);
161 EXPECT_NEAR(this->
parseNumber(
"0.5"), quantitativeResult1[0], this->precision());
163 formula = formulaParser.parseSingleFormulaFromString(
"P=? [F \"target\" || F \"condition\"]");
165 result = checker.check(this->env(), *formula);
169 formula = formulaParser.parseSingleFormulaFromString(
"P=? [F \"target\" || F \"unreachable\"]");
173 formula = formulaParser.parseSingleFormulaFromString(
"R=? [F \"target\"]");
175 result = checker.check(this->env(), *formula);
179 formula = formulaParser.parseSingleFormulaFromString(
"R=? [F \"target\" || F \"condition\"]");
181 result = checker.check(this->env(), *formula);
185 formula = formulaParser.parseSingleFormulaFromString(
"R=? [F \"target\" || F \"unreachable\"]");
190TYPED_TEST(ConditionalDtmcPrctlModelCheckerTest, ConditionalUnreachableFromInitialState) {
191 typedef typename TestFixture::ValueType
ValueType;
200 ASSERT_EQ(4ul, model->getNumberOfStates());
202 std::shared_ptr<storm::models::sparse::Dtmc<ValueType>> dtmc = model->template as<storm::models::sparse::Dtmc<ValueType>>();
203 ASSERT_EQ(2ul, dtmc->getInitialStates().getNumberOfSetBits());
209 auto expManager = std::make_shared<storm::expressions::ExpressionManager>();
212 std::shared_ptr<storm::logic::Formula const> formula = formulaParser.parseSingleFormulaFromString(
"P=? [F \"target\" || F \"condition\"]");
216 storm::exceptions::InvalidPropertyException);
219 std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(this->env(), *formula);
224 formula = formulaParser.parseSingleFormulaFromString(
"R=? [F \"target\" || F \"condition\"]");
227 storm::exceptions::InvalidPropertyException);
229 result = checker.check(this->env(), *formula);
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::EigenLinearEquationSolverMethod value, bool isSetFromDefault=false)
void setPreconditioner(storm::solver::EigenLinearEquationSolverPreconditioner value)
SolverEnvironment & solver()
void setMethod(storm::solver::GmmxxLinearEquationSolverMethod value)
void setPrecision(storm::RationalNumber value)
void setPreconditioner(storm::solver::GmmxxLinearEquationSolverPreconditioner value)
void setSorOmega(storm::RationalNumber const &value)
void setMaximalNumberOfIterations(uint64_t value)
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::NativeLinearEquationSolverMethod value, bool isSetFromDefault=false)
void setLinearEquationSolverType(storm::solver::EquationSolverType const &value, bool isSetFromDefault=false)
EigenSolverEnvironment & eigen()
NativeSolverEnvironment & native()
GmmxxSolverEnvironment & gmmxx()
BuilderOptions & setBuildAllLabels(bool newValue=true)
Should all reward models be built?
BuilderOptions & setBuildAllRewardModels(bool newValue=true)
Should all reward models be built?
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
Convert the program given at construction time to an abstract model.
ExplicitQuantitativeCheckResult< ValueType > & asExplicitQuantitativeCheckResult()
A quantitative check result over the states of a sparse model.
static storm::prism::Program parse(std::string const &filename, bool prismCompatability=false)
Parses the given file into the PRISM storage classes assuming it complies with the PRISM syntax.
A bit vector that is internally represented as a vector of 64-bit values.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
const_iterator begin() const
Returns an iterator to the indices of the set bits in the bit vector.
SFTBDDChecker::ValueType ValueType
storm::builder::BuilderOptions NextStateGeneratorOptions
NumberType parseNumber(std::string const &value)
Parse number from string.
ExtendedValueType< ValueType > positiveInfinity()
TargetType convertNumber(SourceType const &number)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes
#define STORM_SILENT_EXPECT_THROW(statement, expected_exception)