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 "storm-config.h"
2#include "test/storm_gtest.h"
3
4#include <carl/formula/Constraint.h>
5#include <string>
6
12#include "storm/api/builder.h"
16
17class IntervalEndComponentPreserverTest : public ::testing::Test {
18 protected:
19 void SetUp() override {
20#ifndef STORM_HAVE_Z3
21 GTEST_SKIP() << "Z3 not available.";
22#endif
23 }
24};
25
28 // 0 1 2
29 // ---- group 0/2 ----
30 // 0 ( [0, 1] [0, 1] 0 ) 0
31 // ---- group 1/2 ----
32 // 1 ( 0 0 [1, 1] ) 1
33 // ---- group 2/2 ----
34 // 2 ( 0 0 0 ) 2
35 // 0 1 2
36 builder.addNextValue(0, 0, storm::Interval(0, 1));
37 builder.addNextValue(0, 1, storm::Interval(0, 1));
38 builder.addNextValue(1, 2, storm::Interval(1, 1));
40
41 std::vector<storm::Interval> vector = {storm::Interval(0, 0), storm::Interval(1, 1), storm::Interval(0, 0)};
42
44 auto newMatrix = preserver.eliminateMECs(matrix, vector);
45
46 // Should be this now
47 // 0 1 2 3
48 // ---- group 0/3 ----
49 // 0 ( 0 [0, 1] 0 [0, 1] ) 0
50 // ---- group 1/3 ----
51 // 1 ( 0 0 [1, 1] 0 ) 1
52 // ---- group 2/3 ----
53 // 2 ( 0 0 0 0 ) 2
54 // ---- group 3/3 ----
55 // 3 ( 0 0 0 0 ) 3
56 // 0 1 2 3
57
58 ASSERT_EQ(newMatrix->getRowCount(), 4);
59 ASSERT_EQ(newMatrix->getColumnCount(), 4);
60 ASSERT_EQ(newMatrix->getEntryCount(), 3);
61
62 ASSERT_EQ(newMatrix->getRow(0).getNumberOfEntries(), 2);
63 ASSERT_EQ(newMatrix->getRow(0).begin()->getColumn(), 1);
64 ASSERT_EQ(newMatrix->getRow(0).begin()->getValue(), storm::Interval(0, 1));
65 ASSERT_EQ((newMatrix->getRow(0).begin() + 1)->getColumn(), 3);
66 ASSERT_EQ((newMatrix->getRow(0).begin() + 1)->getValue(), storm::Interval(0, 1));
67
68 ASSERT_EQ(newMatrix->getRow(1).getNumberOfEntries(), 1);
69 ASSERT_EQ(newMatrix->getRow(1).begin()->getColumn(), 2);
70 ASSERT_EQ(newMatrix->getRow(1).begin()->getValue(), storm::Interval(1, 1));
71
72 ASSERT_EQ(newMatrix->getRow(2).getNumberOfEntries(), 0);
73 ASSERT_EQ(newMatrix->getRow(3).getNumberOfEntries(), 0);
74}
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.