1#include "storm-config.h"
12class StatePermuterTest :
public ::testing::Test {
14 void SetUp()
override {
16 GTEST_SKIP() <<
"Z3 not available.";
21void testStatePermuter(std::string
const& prismModelFile, std::string
const& formulaString) {
24 auto model = storm::api::buildSparseModel<double>(program, formulas);
25 auto task = storm::api::createTask<double>(formulas.front(),
false);
26 ASSERT_EQ(1ull, model->getInitialStates().getNumberOfSetBits()) <<
"For model " << prismModelFile <<
".";
28 auto computeValue = [&task](
auto m) {
30 return result->template asExplicitQuantitativeCheckResult<double>()[*m->getInitialStates().begin()];
32 auto const modelVal = computeValue(model);
37 EXPECT_EQ(permutedModel->getNumberOfStates(), model->getNumberOfStates())
39 EXPECT_EQ(permutedModel->getNumberOfTransitions(), model->getNumberOfTransitions())
41 auto permVal = computeValue(permutedModel);
42 EXPECT_LE(std::abs(permVal - modelVal) / modelVal, 1e-4)
43 <<
"Relative difference between original model result (" << modelVal <<
") and permuted model result (" << permVal
50 EXPECT_EQ(0ull, *permutedModel->getInitialStates().begin()) <<
"Failed for model " << prismModelFile;
52 EXPECT_EQ(0ull, *permutedModel->getInitialStates().begin()) <<
"Failed for model " << prismModelFile;
54 EXPECT_EQ(permutedModel->getNumberOfStates() - 1, *permutedModel->getInitialStates().begin()) <<
"Failed for model " << prismModelFile;
56 EXPECT_EQ(permutedModel->getNumberOfStates() - 1, *permutedModel->getInitialStates().begin()) <<
"Failed for model " << prismModelFile;
58TEST_F(StatePermuterTest, BrpTest) {
59 testStatePermuter(STORM_TEST_RESOURCES_DIR
"/dtmc/brp-16-2.pm",
"P=? [ F \"target\"]");
62TEST_F(StatePermuterTest, ClusterTest) {
63 testStatePermuter(STORM_TEST_RESOURCES_DIR
"/ctmc/cluster2.sm",
" R{\"num_repairs\"}=? [C<=200]");
66TEST_F(StatePermuterTest, Coin22Test) {
67 testStatePermuter(STORM_TEST_RESOURCES_DIR
"/mdp/coin2-2.nm",
"Rmax=? [ F \"finished\"]");
70TEST_F(StatePermuterTest, StreamTest) {
71 testStatePermuter(STORM_TEST_RESOURCES_DIR
"/ma/stream2.ma",
"R{\"buffering\"}max=? [ F \"done\"]");
TEST_F(AssumptionCheckerTest, Brp_no_bisimulation)
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.
std::vector< storm::jani::Property > parsePropertiesForPrismProgram(std::string const &inputString, storm::prism::Program const &program, boost::optional< std::set< std::string > > const &propertyFilter)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
std::unique_ptr< storm::modelchecker::CheckResult > verifyWithSparseEngine(storm::Environment const &env, std::shared_ptr< storm::models::sparse::Dtmc< ValueType > > const &dtmc, storm::modelchecker::CheckTask< storm::logic::Formula, ValueType > const &task)
OrderKind
The order in which the states of a matrix are visited in a depth-first search or breadth-first search...
std::string orderKindtoString(OrderKind order)
Converts the given order to a string.
std::vector< index_type > createPermutation(OrderKind order, storm::storage::SparseMatrix< ValueType > const &transitionMatrix, storm::storage::BitVector const &initialStates)
Creates a permutation that orders the states of the given matrix in the given exploration order.