33 manager->execute([&]() {
34 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
37 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 1.89999999));
42 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
43 metaVariableToValueMap.emplace(x.first, 4);
46 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
49 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
56 manager->execute([&]() {
57 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
60 ASSERT_NO_THROW(dd.
setValue(x.first, 4, storm::utility::convertNumber<storm::RationalNumber>(1.89999999)));
65 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
66 metaVariableToValueMap.emplace(x.first, 4);
69 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"9/5")), sharpened.
getValue(metaVariableToValueMap));
72 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"19/10")), sharpened.
getValue(metaVariableToValueMap));
79 manager->execute([&]() {
80 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
83 ASSERT_NO_THROW(dd.
setValue(x.first, 4, 0.4));
88 std::map<storm::expressions::Variable, int_fast64_t> metaVariableToValueMap;
89 metaVariableToValueMap.emplace(x.first, 4);
91 ASSERT_EQ(storm::utility::convertNumber<storm::RationalNumber>(std::string(
"3602879701896397/9007199254740992")),
92 rationalDd.
getValue(metaVariableToValueMap));
99 manager->execute([&]() {
101 ASSERT_NO_THROW(zero = manager->template getAddZero<storm::RationalFunction>());
103 EXPECT_EQ(0ul, zero.getNonZeroCount());
104 EXPECT_EQ(1ul, zero.getLeafCount());
105 EXPECT_EQ(1ul, zero.getNodeCount());
108 ASSERT_NO_THROW(one = manager->template getAddOne<storm::RationalFunction>());
110 EXPECT_EQ(0ul, one.getNonZeroCount());
111 EXPECT_EQ(1ul, one.getLeafCount());
112 EXPECT_EQ(1ul, one.getNodeCount());
117 ASSERT_NO_THROW(two = manager->template getConstant<storm::RationalFunction>(constantTwo));
124 std::shared_ptr<storm::RawPolynomialCache> cache = std::make_shared<storm::RawPolynomialCache>();
125 carl::StringParser parser;
126 parser.setVariables({
"x",
"y",
"z"});
132 storm::Polynomial(parser.template parseMultivariatePolynomial<storm::RationalFunctionCoefficient>(
"2*y"), cache));
136 ASSERT_NO_THROW(function = manager->template getConstant<storm::RationalFunction>(rationalFunction));
148 manager->execute([&]() {
149 std::pair<storm::expressions::Variable, storm::expressions::Variable> xExpr;
150 std::pair<storm::expressions::Variable, storm::expressions::Variable> yExpr;
151 std::pair<storm::expressions::Variable, storm::expressions::Variable> zExpr;
152 ASSERT_NO_THROW(xExpr = manager->addMetaVariable(
"x", 0, 1));
153 ASSERT_NO_THROW(yExpr = manager->addMetaVariable(
"y", 0, 1));
154 ASSERT_NO_THROW(zExpr = manager->addMetaVariable(
"z", 0, 1));
164 ((bddX0 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
165 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(-1)))) +
166 ((bddX0 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
167 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0)))) +
168 ((bddX0 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
169 manager->template getConstant<storm::RationalFunction>(
171 ((bddX0 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
172 manager->template getConstant<storm::RationalFunction>(
174 ((bddX1 && (bddY0 && bddZ0)).template toAdd<storm::RationalFunction>() *
175 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(100000)))) +
176 ((bddX1 && (bddY0 && bddZ1)).template toAdd<storm::RationalFunction>() *
177 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(3)))) +
178 ((bddX1 && (bddY1 && bddZ0)).template toAdd<storm::RationalFunction>() *
179 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(4)))) +
180 ((bddX1 && (bddY1 && bddZ1)).template toAdd<storm::RationalFunction>() *
181 manager->template getConstant<storm::RationalFunction>(
storm::RationalFunction(storm::RationalFunctionCoefficient(0))));
193 ((bddX0 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(-1.0)) +
194 ((bddX0 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0)) +
195 ((bddX0 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(0.5)) +
196 ((bddX0 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.33333333333333333333)) +
197 ((bddX1 && (bddY0 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(100000.0)) +
198 ((bddX1 && (bddY0 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(3.0)) +
199 ((bddX1 && (bddY1 && bddZ0)).template toAdd<double>() * manager->template getConstant<double>(4.0)) +
200 ((bddX1 && (bddY1 && bddZ1)).template toAdd<double>() * manager->template getConstant<double>(0.0));
202 EXPECT_TRUE(comparisonAdd == doubleAdd);
209 manager->execute([&]() {
210 std::pair<storm::expressions::Variable, storm::expressions::Variable> x = manager->addMetaVariable(
"x", 1, 9);
215 ASSERT_NO_THROW(encoding = manager->getEncoding(x.first, 4));
224 ASSERT_NO_THROW(add = encoding.template toAdd<storm::RationalFunction>());