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 {
63 EXPECT_TRUE(input.
model->isCanonic());
67 return TestType::precision();
70 if (TestType::isExactModelChecking)
85 typedef typename TestFixture::ValueType ValueType;
87 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0");
91 ValueType expected = this->parseNumber(
"7/10");
92 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
101 typedef typename TestFixture::ValueType ValueType;
103 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0");
107 ValueType expected = this->parseNumber(
"3/10");
108 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
117 typedef typename TestFixture::ValueType ValueType;
119 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmax=? [F \"goal\" ]",
"slippery=0.4");
123 ValueType expected = this->parseNumber(
"7/10");
124 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
133 typedef typename TestFixture::ValueType ValueType;
135 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Pmin=? [F \"goal\" ]",
"slippery=0.4");
139 ValueType expected = this->parseNumber(
"3/10");
140 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
150 typedef typename TestFixture::ValueType ValueType;
152 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0");
156 ValueType expected = this->parseNumber(
"29/50");
157 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
166 typedef typename TestFixture::ValueType ValueType;
168 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0");
172 ValueType expected = this->parseNumber(
"19/50");
173 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
182 typedef typename TestFixture::ValueType ValueType;
184 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmax=? [F s>4 ]",
"slippery=0.4");
188 ValueType expected = this->parseNumber(
"29/30");
189 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
198 typedef typename TestFixture::ValueType ValueType;
200 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple.prism",
"Rmin=? [F s>4 ]",
"slippery=0.4");
204 ValueType expected = this->parseNumber(
"19/30");
205 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
214 typedef typename TestFixture::ValueType ValueType;
216 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0");
220 ValueType expected = this->parseNumber(
"74/91");
221 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
230 typedef typename TestFixture::ValueType ValueType;
232 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/maze2.prism",
"Rmin=? [F \"goal\"]",
"sl=0.075");
236 ValueType expected = this->parseNumber(
"80/91");
237 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
246 typedef typename TestFixture::ValueType ValueType;
248 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmax=?[\"notbad\" U \"goal\"]",
"N=4");
252 ValueType expected = this->parseNumber(
"38/155");
253 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
263 typedef typename TestFixture::ValueType ValueType;
265 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/refuel.prism",
"Pmin=?[\"notbad\" U \"goal\"]",
"N=4");
269 ValueType expected = this->parseNumber(
"0");
270 EXPECT_GE(result.upperBound, expected - this->modelcheckingPrecision());
279 typedef typename TestFixture::ValueType ValueType;
281 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple2.prism",
"Rmax=?[F \"goal\"]");
285 ValueType expected = this->parseNumber(
"59040588757/103747000000");
286 EXPECT_LE(result.lowerBound, expected + this->modelcheckingPrecision());
294 std::vector<std::unordered_map<uint64_t, ValueType>> obs0vals{{{0, 0}, {1, 0}}, {{0, 0.7}}, {{0, 1}, {1, 1}}};
295 std::vector<std::unordered_map<uint64_t, ValueType>> obs1vals{{{2, 1}}, {{2, 1}}};
296 std::vector<std::vector<std::unordered_map<uint64_t, ValueType>>> additionalVals{obs0vals, obs1vals};
304 typedef typename TestFixture::ValueType ValueType;
306 auto data = this->buildPrism(STORM_TEST_RESOURCES_DIR
"/pomdp/simple2.prism",
"Rmax=?[F \"goal\"]");
309 std::vector<std::unordered_map<uint64_t, ValueType>> obs0vals{{{0, 0}, {1, 0}}, {{0, 0.7}}, {{0, 1}, {1, 1}}};
310 std::vector<std::unordered_map<uint64_t, ValueType>> obs1vals{{{2, 1}}, {{2, 1}}};
311 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.
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
std::shared_ptr< storm::models::sparse::Model< ValueType > > buildSparseModel(storm::storage::SymbolicModelDescription const &model, storm::builder::BuilderOptions const &options)
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)
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.
storm::prism::Program preprocess(storm::prism::Program const &program, std::map< storm::expressions::Variable, storm::expressions::Expression > const &constantDefinitions)
TargetType convertNumber(SourceType const &number)
::testing::Types< Cudd, Sylvan > TestingTypes