Browse Source

Fixed compile error with CarlRationalNumber instead of RationalNumber

Former-commit-id: 0fbb4ad1c1
tempestpy_adaptions
Mavo 9 years ago
parent
commit
652aeb7562
  1. 14
      src/utility/constants.cpp
  2. 2
      src/utility/parametric.h
  3. 34
      test/functional/utility/ModelInstantiatorTest.cpp

14
src/utility/constants.cpp

@ -133,13 +133,13 @@ namespace storm {
} }
template<> template<>
double convertNumber(RationalNumber const& number){
double convertNumber(CarlRationalNumber const& number){
return carl::toDouble(number); return carl::toDouble(number);
} }
template<> template<>
RationalNumber convertNumber(double const& number){
return carl::rationalize<RationalNumber>(number);
CarlRationalNumber convertNumber(double const& number){
return carl::rationalize<CarlRationalNumber>(number);
} }
#endif #endif
@ -241,7 +241,7 @@ namespace storm {
template RationalFunction& simplify(RationalFunction& value); template RationalFunction& simplify(RationalFunction& value);
template RationalFunction&& simplify(RationalFunction&& value); template RationalFunction&& simplify(RationalFunction&& value);
/*template Polynomial one();
template Polynomial one();
template Polynomial zero(); template Polynomial zero();
template bool isOne(CarlRationalNumber const& value); template bool isOne(CarlRationalNumber const& value);
@ -249,10 +249,10 @@ namespace storm {
template bool isConstant(CarlRationalNumber const& value); template bool isConstant(CarlRationalNumber const& value);
template CarlRationalNumber one(); template CarlRationalNumber one();
template CarlRationalNumber zero();*/
template CarlRationalNumber zero();
template double convertNumber(RationalNumber const& number);
template RationalNumber convertNumber(double const& number);
template double convertNumber(CarlRationalNumber const& number);
template CarlRationalNumber convertNumber(double const& number);
template bool isOne(Interval const& value); template bool isOne(Interval const& value);
template bool isZero(Interval const& value); template bool isZero(Interval const& value);

2
src/utility/parametric.h

@ -30,7 +30,7 @@ namespace storm {
template<> template<>
struct VariableType<storm::RationalFunction> { typedef storm::Variable type; }; struct VariableType<storm::RationalFunction> { typedef storm::Variable type; };
template<> template<>
struct CoefficientType<storm::RationalFunction> { typedef storm::RationalNumber type; };
struct CoefficientType<storm::RationalFunction> { typedef storm::CarlRationalNumber type; };
#endif #endif
/*! /*!

34
test/functional/utility/ModelInstantiatorTest.cpp

@ -39,13 +39,13 @@ TEST(ModelInstantiatorTest, Brp_Prob) {
EXPECT_FALSE(dtmc->hasRewardModel()); EXPECT_FALSE(dtmc->hasRewardModel());
{ {
std::map<storm::Variable, storm::RationalNumber> valuation;
std::map<storm::Variable, storm::CarlRationalNumber> valuation;
storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL"); storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL");
ASSERT_NE(pL, carl::Variable::NO_VARIABLE); ASSERT_NE(pL, carl::Variable::NO_VARIABLE);
storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK"); storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK");
ASSERT_NE(pK, carl::Variable::NO_VARIABLE); ASSERT_NE(pK, carl::Variable::NO_VARIABLE);
valuation.insert(std::make_pair(pL,carl::rationalize<storm::RationalNumber>(0.8)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::RationalNumber>(0.9)));
valuation.insert(std::make_pair(pL,carl::rationalize<storm::CarlRationalNumber>(0.8)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::CarlRationalNumber>(0.9)));
storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation)); storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation));
@ -72,13 +72,13 @@ TEST(ModelInstantiatorTest, Brp_Prob) {
} }
{ {
std::map<storm::Variable, storm::RationalNumber> valuation;
std::map<storm::Variable, storm::CarlRationalNumber> valuation;
storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL"); storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL");
ASSERT_NE(pL, carl::Variable::NO_VARIABLE); ASSERT_NE(pL, carl::Variable::NO_VARIABLE);
storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK"); storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK");
ASSERT_NE(pK, carl::Variable::NO_VARIABLE); ASSERT_NE(pK, carl::Variable::NO_VARIABLE);
valuation.insert(std::make_pair(pL,carl::rationalize<storm::RationalNumber>(1)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::RationalNumber>(1)));
valuation.insert(std::make_pair(pL,carl::rationalize<storm::CarlRationalNumber>(1)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::CarlRationalNumber>(1)));
storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation)); storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation));
@ -105,13 +105,13 @@ TEST(ModelInstantiatorTest, Brp_Prob) {
} }
{ {
std::map<storm::Variable, storm::RationalNumber> valuation;
std::map<storm::Variable, storm::CarlRationalNumber> valuation;
storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL"); storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL");
ASSERT_NE(pL, carl::Variable::NO_VARIABLE); ASSERT_NE(pL, carl::Variable::NO_VARIABLE);
storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK"); storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK");
ASSERT_NE(pK, carl::Variable::NO_VARIABLE); ASSERT_NE(pK, carl::Variable::NO_VARIABLE);
valuation.insert(std::make_pair(pL,carl::rationalize<storm::RationalNumber>(1)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::RationalNumber>(0.9)));
valuation.insert(std::make_pair(pL,carl::rationalize<storm::CarlRationalNumber>(1)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::CarlRationalNumber>(0.9)));
storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation)); storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation));
@ -159,7 +159,7 @@ TEST(ModelInstantiatorTest, Brp_Rew) {
storm::utility::ModelInstantiator<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::models::sparse::Dtmc<double>> modelInstantiator(*dtmc); storm::utility::ModelInstantiator<storm::models::sparse::Dtmc<storm::RationalFunction>, storm::models::sparse::Dtmc<double>> modelInstantiator(*dtmc);
{ {
std::map<storm::Variable, storm::RationalNumber> valuation;
std::map<storm::Variable, storm::CarlRationalNumber> valuation;
storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL"); storm::Variable const& pL = carl::VariablePool::getInstance().findVariableWithName("pL");
ASSERT_NE(pL, carl::Variable::NO_VARIABLE); ASSERT_NE(pL, carl::Variable::NO_VARIABLE);
storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK"); storm::Variable const& pK = carl::VariablePool::getInstance().findVariableWithName("pK");
@ -168,10 +168,10 @@ TEST(ModelInstantiatorTest, Brp_Rew) {
ASSERT_NE(pK, carl::Variable::NO_VARIABLE); ASSERT_NE(pK, carl::Variable::NO_VARIABLE);
storm::Variable const& TOAck = carl::VariablePool::getInstance().findVariableWithName("TOAck"); storm::Variable const& TOAck = carl::VariablePool::getInstance().findVariableWithName("TOAck");
ASSERT_NE(pK, carl::Variable::NO_VARIABLE); ASSERT_NE(pK, carl::Variable::NO_VARIABLE);
valuation.insert(std::make_pair(pL,carl::rationalize<storm::RationalNumber>(0.9)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::RationalNumber>(0.3)));
valuation.insert(std::make_pair(TOMsg,carl::rationalize<storm::RationalNumber>(0.3)));
valuation.insert(std::make_pair(TOAck,carl::rationalize<storm::RationalNumber>(0.5)));
valuation.insert(std::make_pair(pL,carl::rationalize<storm::CarlRationalNumber>(0.9)));
valuation.insert(std::make_pair(pK,carl::rationalize<storm::CarlRationalNumber>(0.3)));
valuation.insert(std::make_pair(TOMsg,carl::rationalize<storm::CarlRationalNumber>(0.3)));
valuation.insert(std::make_pair(TOAck,carl::rationalize<storm::CarlRationalNumber>(0.5)));
storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation)); storm::models::sparse::Dtmc<double> const& instantiated(modelInstantiator.instantiate(valuation));
@ -231,13 +231,13 @@ TEST(ModelInstantiatorTest, consensus) {
storm::utility::ModelInstantiator<storm::models::sparse::Mdp<storm::RationalFunction>, storm::models::sparse::Mdp<double>> modelInstantiator(*mdp); storm::utility::ModelInstantiator<storm::models::sparse::Mdp<storm::RationalFunction>, storm::models::sparse::Mdp<double>> modelInstantiator(*mdp);
std::map<storm::Variable, storm::RationalNumber> valuation;
std::map<storm::Variable, storm::CarlRationalNumber> valuation;
storm::Variable const& p1 = carl::VariablePool::getInstance().findVariableWithName("p1"); storm::Variable const& p1 = carl::VariablePool::getInstance().findVariableWithName("p1");
ASSERT_NE(p1, carl::Variable::NO_VARIABLE); ASSERT_NE(p1, carl::Variable::NO_VARIABLE);
storm::Variable const& p2 = carl::VariablePool::getInstance().findVariableWithName("p2"); storm::Variable const& p2 = carl::VariablePool::getInstance().findVariableWithName("p2");
ASSERT_NE(p2, carl::Variable::NO_VARIABLE); ASSERT_NE(p2, carl::Variable::NO_VARIABLE);
valuation.insert(std::make_pair(p1,carl::rationalize<storm::RationalNumber>(0.51)));
valuation.insert(std::make_pair(p2,carl::rationalize<storm::RationalNumber>(0.49)));
valuation.insert(std::make_pair(p1,carl::rationalize<storm::CarlRationalNumber>(0.51)));
valuation.insert(std::make_pair(p2,carl::rationalize<storm::CarlRationalNumber>(0.49)));
storm::models::sparse::Mdp<double> const& instantiated(modelInstantiator.instantiate(valuation)); storm::models::sparse::Mdp<double> const& instantiated(modelInstantiator.instantiate(valuation));
ASSERT_EQ(mdp->getTransitionMatrix().getRowGroupIndices(), instantiated.getTransitionMatrix().getRowGroupIndices()); ASSERT_EQ(mdp->getTransitionMatrix().getRowGroupIndices(), instantiated.getTransitionMatrix().getRowGroupIndices());

Loading…
Cancel
Save