34 manager->execute([&]() {
35 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
38 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 1.89999999));
43 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
44 metaVariableToValueMap.emplace(x.first, 4);
47 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
50 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
57 manager->execute([&]() {
58 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
61 ASSERT_NO_THROW(dd.
setValue(x.first, 4, storm::utility::convertNumber<storm::RationalNumber>(1.89999999)));
66 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
67 metaVariableToValueMap.emplace(x.first, 4);
70 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
73 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
80 manager->execute([&]() {
81 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
84 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 0.4));
89 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
90 metaVariableToValueMap.emplace(x.first, 4);
92 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"3602879701896397/9007199254740992")),
93 rationalDd.
getValue(metaVariableToValueMap));
100 manager->execute([&]() {
102 ASSERT_NO_THROW(zero = manager->template getAddZero<storm::RationalFunction>());
104 EXPECT_EQ(0ul, zero.getNonZeroCount());
105 EXPECT_EQ(1ul, zero.getLeafCount());
106 EXPECT_EQ(1ul, zero.getNodeCount());
109 ASSERT_NO_THROW(one = manager->template getAddOne<storm::RationalFunction>());
111 EXPECT_EQ(0ul, one.getNonZeroCount());
112 EXPECT_EQ(1ul, one.getLeafCount());
113 EXPECT_EQ(1ul, one.getNodeCount());
118 ASSERT_NO_THROW(two = manager->template getConstant<storm::RationalFunction>(constantTwo));
125 std::shared_ptr<storm::RawPolynomialCache> cache = std::make_shared<storm::RawPolynomialCache>();
126 carl::StringParser parser;
127 parser.setVariables({
"x",
"y",
"z"});
133 storm::Polynomial(parser.template parseMultivariatePolynomial<storm::RationalFunctionCoefficient>(
"2*y"), cache));
137 ASSERT_NO_THROW(function = manager->template getConstant<storm::RationalFunction>(rationalFunction));
149 manager->execute([&]() {
150 std::pair<storm::expressions::Variable, storm::expressions::Variable> xExpr;
151 std::pair<storm::expressions::Variable, storm::expressions::Variable> yExpr;
152 std::pair<storm::expressions::Variable, storm::expressions::Variable> zExpr;
153 ASSERT_NO_THROW(xExpr = manager->addMetaVariable(
"x", 0, 1));
154 ASSERT_NO_THROW(yExpr = manager->addMetaVariable(
"y", 0, 1));
155 ASSERT_NO_THROW(zExpr = manager->addMetaVariable(
"z", 0, 1));
165 ((bddX0 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
166 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(-1)))) +
167 ((bddX0 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
168 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0)))) +
169 ((bddX0 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
170 manager->template getConstant<storm::RationalFunction>(
172 ((bddX0 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
173 manager->template getConstant<storm::RationalFunction>(
175 ((bddX1 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
176 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(100000)))) +
177 ((bddX1 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
178 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(3)))) +
179 ((bddX1 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
180 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(4)))) +
181 ((bddX1 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
182 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0))));
194 ((bddX0 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(-1.0)) +
195 ((bddX0 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0)) +
196 ((bddX0 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(0.5)) +
197 ((bddX0 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.33333333333333333333)) +
198 ((bddX1 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(100000.0)) +
199 ((bddX1 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(3.0)) +
200 ((bddX1 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(4.0)) +
201 ((bddX1 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0));
203 EXPECT_TRUE(comparisonAdd == doubleAdd);
210 manager->execute([&]() {
211 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
216 ASSERT_NO_THROW(encoding = manager->getEncoding(x.first, 4));
225 ASSERT_NO_THROW(add = encoding.template toAdd<storm::RationalFunction>());