44 manager->execute([&]() {
45 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
48 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 1.89999999));
53 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
54 metaVariableToValueMap.emplace(x.first, 4);
57 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
60 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
67 manager->execute([&]() {
68 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
71 ASSERT_NO_THROW(dd.
setValue(x.first, 4, storm::utility::convertNumber<storm::RationalNumber>(1.89999999)));
76 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
77 metaVariableToValueMap.emplace(x.first, 4);
80 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
83 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
90 manager->execute([&]() {
91 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
94 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 0.4));
99 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
100 metaVariableToValueMap.emplace(x.first, 4);
102 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"3602879701896397/9007199254740992")),
103 rationalDd.
getValue(metaVariableToValueMap));
110 manager->execute([&]() {
112 ASSERT_NO_THROW(zero = manager->template getAddZero<storm::RationalFunction>());
114 EXPECT_EQ(0ul, zero.getNonZeroCount());
115 EXPECT_EQ(1ul, zero.getLeafCount());
116 EXPECT_EQ(1ul, zero.getNodeCount());
119 ASSERT_NO_THROW(one = manager->template getAddOne<storm::RationalFunction>());
121 EXPECT_EQ(0ul, one.getNonZeroCount());
122 EXPECT_EQ(1ul, one.getLeafCount());
123 EXPECT_EQ(1ul, one.getNodeCount());
128 ASSERT_NO_THROW(two = manager->template getConstant<storm::RationalFunction>(constantTwo));
135 std::shared_ptr<storm::RawPolynomialCache> cache = std::make_shared<storm::RawPolynomialCache>();
136 carl::StringParser parser;
137 parser.setVariables({
"x",
"y",
"z"});
143 storm::Polynomial(parser.template parseMultivariatePolynomial<storm::RationalFunctionCoefficient>(
"2*y"), cache));
147 ASSERT_NO_THROW(function = manager->template getConstant<storm::RationalFunction>(rationalFunction));
159 manager->execute([&]() {
160 std::pair<storm::expressions::Variable, storm::expressions::Variable> xExpr;
161 std::pair<storm::expressions::Variable, storm::expressions::Variable> yExpr;
162 std::pair<storm::expressions::Variable, storm::expressions::Variable> zExpr;
163 ASSERT_NO_THROW(xExpr = manager->addMetaVariable(
"x", 0, 1));
164 ASSERT_NO_THROW(yExpr = manager->addMetaVariable(
"y", 0, 1));
165 ASSERT_NO_THROW(zExpr = manager->addMetaVariable(
"z", 0, 1));
175 ((bddX0 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
176 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(-1)))) +
177 ((bddX0 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
178 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0)))) +
179 ((bddX0 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
180 manager->template getConstant<storm::RationalFunction>(
182 ((bddX0 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
183 manager->template getConstant<storm::RationalFunction>(
185 ((bddX1 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
186 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(100000)))) +
187 ((bddX1 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
188 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(3)))) +
189 ((bddX1 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
190 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(4)))) +
191 ((bddX1 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
192 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0))));
204 ((bddX0 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(-1.0)) +
205 ((bddX0 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0)) +
206 ((bddX0 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(0.5)) +
207 ((bddX0 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.33333333333333333333)) +
208 ((bddX1 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(100000.0)) +
209 ((bddX1 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(3.0)) +
210 ((bddX1 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(4.0)) +
211 ((bddX1 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0));
213 EXPECT_TRUE(comparisonAdd == doubleAdd);
220 manager->execute([&]() {
221 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
226 ASSERT_NO_THROW(encoding = manager->getEncoding(x.first, 4));
235 ASSERT_NO_THROW(add = encoding.template toAdd<storm::RationalFunction>());