Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
IntervalEndComponentPreserverTest.cpp
Go to the documentation of this file.
1#include <carl/formula/Constraint.h>
2#include <memory>
3#include <string>
4#include "gtest/gtest.h"
5#include "storm-config.h"
21#include "storm/api/builder.h"
37#include "storm/utility/prism.h"
39#include "test/storm_gtest.h"
40
45
46class IntervalEndComponentPreserverTest : public ::testing::Test {
47 protected:
48 void SetUp() override {
49#ifndef STORM_HAVE_Z3
50 GTEST_SKIP() << "Z3 not available.";
51#endif
52 }
53};
54
57 // 0 1 2
58 // ---- group 0/2 ----
59 // 0 ( [0, 1] [0, 1] 0 ) 0
60 // ---- group 1/2 ----
61 // 1 ( 0 0 [1, 1] ) 1
62 // ---- group 2/2 ----
63 // 2 ( 0 0 0 ) 2
64 // 0 1 2
65 builder.addNextValue(0, 0, storm::Interval(0, 1));
66 builder.addNextValue(0, 1, storm::Interval(0, 1));
67 builder.addNextValue(1, 2, storm::Interval(1, 1));
69
70 std::vector<storm::Interval> vector = {storm::Interval(0, 0), storm::Interval(1, 1), storm::Interval(0, 0)};
71
73 auto newMatrix = preserver.eliminateMECs(matrix, vector);
74
75 // Should be this now
76 // 0 1 2 3
77 // ---- group 0/3 ----
78 // 0 ( 0 [0, 1] 0 [0, 1] ) 0
79 // ---- group 1/3 ----
80 // 1 ( 0 0 [1, 1] 0 ) 1
81 // ---- group 2/3 ----
82 // 2 ( 0 0 0 0 ) 2
83 // ---- group 3/3 ----
84 // 3 ( 0 0 0 0 ) 3
85 // 0 1 2 3
86
87 ASSERT_EQ(newMatrix->getRowCount(), 4);
88 ASSERT_EQ(newMatrix->getColumnCount(), 4);
89 ASSERT_EQ(newMatrix->getEntryCount(), 3);
90
91 ASSERT_EQ(newMatrix->getRow(0).getNumberOfEntries(), 2);
92 ASSERT_EQ(newMatrix->getRow(0).begin()->getColumn(), 1);
93 ASSERT_EQ(newMatrix->getRow(0).begin()->getValue(), storm::Interval(0, 1));
94 ASSERT_EQ((newMatrix->getRow(0).begin() + 1)->getColumn(), 3);
95 ASSERT_EQ((newMatrix->getRow(0).begin() + 1)->getValue(), storm::Interval(0, 1));
96
97 ASSERT_EQ(newMatrix->getRow(1).getNumberOfEntries(), 1);
98 ASSERT_EQ(newMatrix->getRow(1).begin()->getColumn(), 2);
99 ASSERT_EQ(newMatrix->getRow(1).begin()->getValue(), storm::Interval(1, 1));
100
101 ASSERT_EQ(newMatrix->getRow(2).getNumberOfEntries(), 0);
102 ASSERT_EQ(newMatrix->getRow(3).getNumberOfEntries(), 0);
103}
TEST_F(IntervalEndComponentPreserverTest, Simple)
A class that can be used to build a sparse matrix by adding value by value.
void addNextValue(index_type row, index_type column, value_type const &value)
Sets the matrix entry at the given row and column to the given value.
SparseMatrix< value_type > build(index_type overriddenRowCount=0, index_type overriddenColumnCount=0, index_type overriddenRowGroupCount=0)
A class that holds a possibly non-square matrix in the compressed row storage format.
std::optional< storage::SparseMatrix< Interval > > eliminateMECs(storm::storage::SparseMatrix< Interval > const &matrix, std::vector< Interval > const &vector)
carl::Interval< double > Interval
Interval type.