41 manager->execute([&]() {
42 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
45 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 1.89999999));
50 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
51 metaVariableToValueMap.emplace(x.first, 4);
54 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
57 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
64 manager->execute([&]() {
65 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
68 ASSERT_NO_THROW(dd.
setValue(x.first, 4, storm::utility::convertNumber<storm::RationalNumber>(1.89999999)));
73 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
74 metaVariableToValueMap.emplace(x.first, 4);
77 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
80 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
87 manager->execute([&]() {
88 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
91 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 0.4));
96 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
97 metaVariableToValueMap.emplace(x.first, 4);
99 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"3602879701896397/9007199254740992")),
100 rationalDd.
getValue(metaVariableToValueMap));
107 manager->execute([&]() {
109 ASSERT_NO_THROW(zero = manager->template getAddZero<storm::RationalFunction>());
111 EXPECT_EQ(0ul, zero.getNonZeroCount());
112 EXPECT_EQ(1ul, zero.getLeafCount());
113 EXPECT_EQ(1ul, zero.getNodeCount());
116 ASSERT_NO_THROW(one = manager->template getAddOne<storm::RationalFunction>());
118 EXPECT_EQ(0ul, one.getNonZeroCount());
119 EXPECT_EQ(1ul, one.getLeafCount());
120 EXPECT_EQ(1ul, one.getNodeCount());
125 ASSERT_NO_THROW(two = manager->template getConstant<storm::RationalFunction>(constantTwo));
132 std::shared_ptr<storm::RawPolynomialCache> cache = std::make_shared<storm::RawPolynomialCache>();
133 carl::StringParser parser;
134 parser.setVariables({
"x",
"y",
"z"});
140 storm::Polynomial(parser.template parseMultivariatePolynomial<storm::RationalFunctionCoefficient>(
"2*y"), cache));
144 ASSERT_NO_THROW(function = manager->template getConstant<storm::RationalFunction>(rationalFunction));
156 manager->execute([&]() {
157 std::pair<storm::expressions::Variable, storm::expressions::Variable> xExpr;
158 std::pair<storm::expressions::Variable, storm::expressions::Variable> yExpr;
159 std::pair<storm::expressions::Variable, storm::expressions::Variable> zExpr;
160 ASSERT_NO_THROW(xExpr = manager->addMetaVariable(
"x", 0, 1));
161 ASSERT_NO_THROW(yExpr = manager->addMetaVariable(
"y", 0, 1));
162 ASSERT_NO_THROW(zExpr = manager->addMetaVariable(
"z", 0, 1));
172 ((bddX0 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
173 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(-1)))) +
174 ((bddX0 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
175 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0)))) +
176 ((bddX0 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
177 manager->template getConstant<storm::RationalFunction>(
179 ((bddX0 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
180 manager->template getConstant<storm::RationalFunction>(
182 ((bddX1 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
183 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(100000)))) +
184 ((bddX1 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
185 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(3)))) +
186 ((bddX1 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
187 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(4)))) +
188 ((bddX1 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
189 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0))));
201 ((bddX0 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(-1.0)) +
202 ((bddX0 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0)) +
203 ((bddX0 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(0.5)) +
204 ((bddX0 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.33333333333333333333)) +
205 ((bddX1 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(100000.0)) +
206 ((bddX1 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(3.0)) +
207 ((bddX1 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(4.0)) +
208 ((bddX1 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0));
210 EXPECT_TRUE(comparisonAdd == doubleAdd);
217 manager->execute([&]() {
218 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
223 ASSERT_NO_THROW(encoding = manager->getEncoding(x.first, 4));
232 ASSERT_NO_THROW(add = encoding.template toAdd<storm::RationalFunction>());