1#include "storm-config.h"
29template<
typename TestType>
37 GTEST_SKIP() <<
"Z3 not available.";
49 std::shared_ptr<storm::models::sparse::Pomdp<ValueType>>
model;
50 std::shared_ptr<storm::logic::Formula const>
formula;
52 Input buildPrism(std::string
const& programFile, std::string
const& formulaAsString, std::string
const& constantsAsString =
"")
const {
55 program = program.
preprocess(constantsAsString);
63 EXPECT_TRUE(input.
model->isCanonic());
67 return TestType::precision();
70 if (TestType::isExactModelChecking) {
86 typedef typename TestFixture::ValueType ValueType;
88 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
92 ValueType expected = this->parseNumber(
"7/10");
93 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
102 typedef typename TestFixture::ValueType ValueType;
104 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
108 ValueType expected = this->parseNumber(
"3/10");
109 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
118 typedef typename TestFixture::ValueType ValueType;
120 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
124 ValueType expected = this->parseNumber(
"7/10");
125 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
134 typedef typename TestFixture::ValueType ValueType;
136 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
140 ValueType expected = this->parseNumber(
"3/10");
141 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
151 typedef typename TestFixture::ValueType ValueType;
153 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
157 ValueType expected = this->parseNumber(
"29/50");
158 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
167 typedef typename TestFixture::ValueType ValueType;
169 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
173 ValueType expected = this->parseNumber(
"19/50");
174 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
183 typedef typename TestFixture::ValueType ValueType;
185 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
189 ValueType expected = this->parseNumber(
"29/30");
190 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
199 typedef typename TestFixture::ValueType ValueType;
201 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
205 ValueType expected = this->parseNumber(
"19/30");
206 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
215 typedef typename TestFixture::ValueType ValueType;
217 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
221 ValueType expected = this->parseNumber(
"74/91");
222 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
231 typedef typename TestFixture::ValueType ValueType;
233 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
237 ValueType expected = this->parseNumber(
"80/91");
238 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
247 typedef typename TestFixture::ValueType ValueType;
249 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
253 ValueType expected = this->parseNumber(
"38/155");
254 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
264 typedef typename TestFixture::ValueType ValueType;
266 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
270 ValueType expected = this->parseNumber(
"0");
271 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
280 typedef typename TestFixture::ValueType ValueType;
282 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple2.prism",
"Rmax=?[F \"goal\"]");
286 ValueType expected = this->parseNumber(
"59040588757/103747000000");
287 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
295 std::vector<std::unordered_map<uint64_t, ValueType>> obs0vals{{{0, 0}, {1, 0}}, {{0, 0.7}}, {{0, 1}, {1, 1}}};
296 std::vector<std::unordered_map<uint64_t, ValueType>> obs1vals{{{2, 1}}, {{2, 1}}};
297 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> additionalVals{obs0vals, obs1vals};
305 typedef typename TestFixture::ValueType ValueType;
307 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple2.prism",
"Rmax=?[F \"goal\"]");
310 std::vector<std::unordered_map<uint64_t, ValueType>> obs0vals{{{0, 0}, {1, 0}}, {{0, 0.7}}, {{0, 1}, {1, 1}}};
311 std::vector<std::unordered_map<uint64_t, ValueType>> obs1vals{{{2, 1}}, {{2, 1}}};
312 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> additionalVals{obs0vals, obs1vals};
TYPED_TEST_SUITE(BeliefExplorationAPITest, TestingTypes,)
TYPED_TEST(BeliefExplorationAPITest, simple_Pmax)
ValueType modelcheckingPrecision() const
storm::Environment const & env() const
ValueType precision() const
Input buildPrism(std::string const &programFile, std::string const &formulaAsString, std::string const &constantsAsString="") const
ValueType parseNumber(std::string const &str)
TestType::ValueType ValueType
BeliefExplorationAPITest()
static void adaptOptions(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions< ValueType > &)
static ValueType precision()
static storm::Environment createEnvironment()
static bool const isExactModelChecking
SolverEnvironment & solver()
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
This class represents a partially observable Markov decision process.
Program preprocess(std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions) const
Preprocesses the program by defining the given constant definitions, substituting constants and formu...
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > createTask(std::shared_ptr< const storm::logic::Formula > const &formula, bool onlyInitialStatesRelevant=false)
storm::prism::Program parseProgram(std::string const &filename, bool prismCompatibility, bool simplify)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options, typename storm::builder::ExplicitModelBuilder< ValueType >::Options const &explorationOptions=typename storm::builder::ExplicitModelBuilder< ValueType >::Options())
storm::storage::Scheduler< ValueType > getCutoffScheduler(typename storm::pomdp::modelchecker::BeliefExplorationPomdpModelChecker< storm::models::sparse::Pomdp< ValueType > >::Result modelcheckingResult, uint64_t schedId)
Get a specific scheduler used to generate cut-off values from the result struct.
uint64_t getNumberOfPreprocessingSchedulers(typename storm::pomdp::modelchecker::BeliefExplorationPomdpModelChecker< storm::models::sparse::Pomdp< ValueType > >::Result modelcheckingResult)
Get the overall number of schedulers generated by the pre-processing for the under-approximation from...
storm::pomdp::modelchecker::BeliefExplorationPomdpModelChecker< storm::models::sparse::Pomdp< ValueType > >::Result underapproximateWithoutHeuristicValues(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > pomdp, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task, uint64_t sizeThreshold, std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > pomdpStateValues)
Uses the belief exploration with cut-offs without the pre-processing to generate cut-off values to un...
storm::pomdp::modelchecker::BeliefExplorationPomdpModelChecker< storm::models::sparse::Pomdp< ValueType > >::Result underapproximateWithCutoffs(std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > pomdp, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task, uint64_t sizeThreshold, std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > > additionalPomdpStateValues=std::vector< std::vector< std::unordered_map< uint64_t, ValueType > > >())
Uses the belief exploration with cut-offs to under-approximate the given objective on a POMDP.
std::shared_ptr< storm::models::sparse::Model< ValueType > > extractSchedulerAsMarkovChain(typename storm::pomdp::modelchecker::BeliefExplorationPomdpModelChecker< storm::models::sparse::Pomdp< ValueType > >::Result modelcheckingResult)
Extract the scheduler generated by an under-approximation from the given result struct.
TargetType convertNumber(SourceType const &number)
::testing::Types< Cudd, Sylvan > TestingTypes