Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BeliefSupportTrackingTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
9#include "storm/api/storm.h"
13
14// TODO
15// These tests depend on the interpretation of action and observation numbers and those may change.
16// A more robust test would take the high-level actions and observations and track on those.
17
18TEST(BeliefSupportTracking, Maze) {
19#ifndef STORM_HAVE_Z3
20 GTEST_SKIP() << "Z3 not available.";
21#endif
22 storm::prism::Program program = storm::parser::PrismParser::parse(STORM_TEST_RESOURCES_DIR "/pomdp/maze2.prism");
23 program = program.preprocess("sl=0.4");
24 std::shared_ptr<storm::logic::Formula const> formula = storm::api::parsePropertiesForPrismProgram("Pmax=? [F \"goal\" ]", program).front().getRawFormula();
25 std::shared_ptr<storm::models::sparse::Pomdp<double>> pomdp =
28 pomdp = makeCanonic.transform();
29
31 EXPECT_EQ(pomdp->getInitialStates(), tracker.getCurrentBeliefSupport());
32 tracker.track(0, 0);
33 auto beliefsup = tracker.getCurrentBeliefSupport();
34 EXPECT_EQ(6ul, beliefsup.getNumberOfSetBits());
35 tracker.track(0, 0);
36 EXPECT_EQ(beliefsup, tracker.getCurrentBeliefSupport());
37 tracker.track(0, 1);
38 EXPECT_TRUE(tracker.getCurrentBeliefSupport().empty());
39 tracker.reset();
40 EXPECT_EQ(pomdp->getInitialStates(), tracker.getCurrentBeliefSupport());
41 tracker.track(0, 0);
42 EXPECT_EQ(beliefsup, tracker.getCurrentBeliefSupport());
43 tracker.track(1, 0);
44 EXPECT_EQ(beliefsup, tracker.getCurrentBeliefSupport());
45 tracker.track(2, 1);
46 EXPECT_EQ(1ul, tracker.getCurrentBeliefSupport().getNumberOfSetBits());
47 tracker.track(3, 0);
48 EXPECT_EQ(1ul, tracker.getCurrentBeliefSupport().getNumberOfSetBits());
49 tracker.track(3, 0);
50 EXPECT_EQ(2ul, tracker.getCurrentBeliefSupport().getNumberOfSetBits());
51}
TEST(BeliefSupportTracking, Maze)
storm::storage::BitVector const & getCurrentBeliefSupport() const
The current belief support according to the tracker.
void track(uint64_t action, uint64_t observation)
Update current belief support state.
This class represents a partially observable Markov decision process.
Definition Pomdp.h:13
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.
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...
Definition Program.cpp:1170
bool empty() const
Retrieves whether no bits are set to true in this bit vector.
uint64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
std::shared_ptr< storm::models::sparse::Pomdp< ValueType > > transform() const
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, typename storm::builder::ExplicitModelBuilder< ValueType >::Options const &explorationOptions=typename storm::builder::ExplicitModelBuilder< ValueType >::Options())
Definition builder.h:117