Browse Source

- Restructuration of model checkers (by logic)

- LTL file parser
main
Lanchid 12 years ago
parent
commit
f9ab6f85d0
  1. 10
      src/formula/Csl.h
  2. 2
      src/formula/Csl/AbstractNoBoundOperator.h
  3. 4
      src/formula/Csl/AbstractPathFormula.h
  4. 4
      src/formula/Csl/AbstractStateFormula.h
  5. 4
      src/formula/Csl/And.h
  6. 4
      src/formula/Csl/Ap.h
  7. 4
      src/formula/Csl/Eventually.h
  8. 4
      src/formula/Csl/Globally.h
  9. 2
      src/formula/Csl/Next.h
  10. 4
      src/formula/Csl/Not.h
  11. 2
      src/formula/Csl/Or.h
  12. 2
      src/formula/Csl/ProbabilisticBoundOperator.h
  13. 4
      src/formula/Csl/ProbabilisticNoBoundOperator.h
  14. 2
      src/formula/Csl/SteadyStateBoundOperator.h
  15. 2
      src/formula/Csl/SteadyStateNoBoundOperator.h
  16. 2
      src/formula/Csl/TimeBoundedEventually.h
  17. 2
      src/formula/Csl/TimeBoundedUntil.h
  18. 2
      src/formula/Csl/Until.h
  19. 4
      src/formula/Ltl.h
  20. 4
      src/formula/Ltl/AbstractLtlFormula.h
  21. 4
      src/formula/Ltl/And.h
  22. 2
      src/formula/Ltl/Ap.h
  23. 4
      src/formula/Ltl/BoundedEventually.h
  24. 4
      src/formula/Ltl/BoundedUntil.h
  25. 4
      src/formula/Ltl/Eventually.h
  26. 4
      src/formula/Ltl/Globally.h
  27. 2
      src/formula/Ltl/Next.h
  28. 2
      src/formula/Ltl/Not.h
  29. 2
      src/formula/Ltl/Or.h
  30. 2
      src/formula/Ltl/Until.h
  31. 17
      src/formula/Prctl.h
  32. 2
      src/formula/Prctl/AbstractNoBoundOperator.h
  33. 4
      src/formula/Prctl/AbstractPathFormula.h
  34. 4
      src/formula/Prctl/AbstractStateFormula.h
  35. 4
      src/formula/Prctl/And.h
  36. 4
      src/formula/Prctl/Ap.h
  37. 4
      src/formula/Prctl/BoundedEventually.h
  38. 4
      src/formula/Prctl/BoundedNaryUntil.h
  39. 4
      src/formula/Prctl/BoundedUntil.h
  40. 2
      src/formula/Prctl/CumulativeReward.h
  41. 4
      src/formula/Prctl/Eventually.h
  42. 4
      src/formula/Prctl/Globally.h
  43. 2
      src/formula/Prctl/InstantaneousReward.h
  44. 2
      src/formula/Prctl/Next.h
  45. 4
      src/formula/Prctl/Not.h
  46. 2
      src/formula/Prctl/Or.h
  47. 2
      src/formula/Prctl/ProbabilisticBoundOperator.h
  48. 2
      src/formula/Prctl/ProbabilisticNoBoundOperator.h
  49. 2
      src/formula/Prctl/ReachabilityReward.h
  50. 2
      src/formula/Prctl/RewardBoundOperator.h
  51. 2
      src/formula/Prctl/RewardNoBoundOperator.h
  52. 2
      src/formula/Prctl/SteadyStateReward.h
  53. 2
      src/formula/Prctl/Until.h
  54. 2
      src/formula/abstract/AbstractFormula.h
  55. 1
      src/formula/abstract/And.h
  56. 1
      src/formula/abstract/Ap.h
  57. 1
      src/formula/abstract/BoundedEventually.h
  58. 1
      src/formula/abstract/BoundedNaryUntil.h
  59. 1
      src/formula/abstract/BoundedUntil.h
  60. 1
      src/formula/abstract/Eventually.h
  61. 1
      src/formula/abstract/Globally.h
  62. 1
      src/formula/abstract/Not.h
  63. 1
      src/formula/abstract/PathBoundOperator.h
  64. 1
      src/formula/abstract/PathNoBoundOperator.h
  65. 1
      src/formula/abstract/StateBoundOperator.h
  66. 1
      src/formula/abstract/StateNoBoundOperator.h
  67. 287
      src/modelchecker/csl/AbstractModelChecker.h
  68. 2
      src/modelchecker/csl/ForwardDeclarations.h
  69. 193
      src/modelchecker/ltl/AbstractModelChecker.h
  70. 24
      src/modelchecker/ltl/ForwardDeclarations.h
  71. 15
      src/modelchecker/prctl/AbstractModelChecker.h
  72. 10
      src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h
  73. 24
      src/modelchecker/prctl/ForwardDeclarations.h
  74. 12
      src/modelchecker/prctl/GmmxxDtmcPrctlModelChecker.h
  75. 12
      src/modelchecker/prctl/GmmxxMdpPrctlModelChecker.h
  76. 12
      src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h
  77. 12
      src/modelchecker/prctl/SparseMdpPrctlModelChecker.h
  78. 10
      src/modelchecker/prctl/TopologicalValueIterationMdpPrctlModelChecker.h
  79. 49
      src/parser/LtlFileParser.cpp
  80. 42
      src/parser/LtlFileParser.h
  81. 3
      src/parser/PrctlFileParser.cpp
  82. 2
      src/parser/PrctlFileParser.h
  83. 2
      src/parser/PrctlParser.cpp
  84. 38
      src/storm.cpp
  85. 8
      test/functional/GmmxxDtmcPrctModelCheckerTest.cpp
  86. 10
      test/functional/GmmxxMdpPrctModelCheckerTest.cpp
  87. 4
      test/storm-tests.cpp

10
src/formula/Csl.h

@ -5,8 +5,10 @@
* Author: thomas
*/
#ifndef CSL_H_
#define CSL_H_
#ifndef STORM_FORMULA_CSL_H_
#define STORM_FORMULA_CSL_H_
#include "src/modelchecker/csl/ForwardDeclarations.h"
#include "Csl/And.h"
#include "Csl/Ap.h"
@ -24,5 +26,7 @@
#include "Csl/TimeBoundedEventually.h"
#include "Csl/TimeBoundedUntil.h"
#include "modelchecker/csl/AbstractModelChecker.h"
#endif /* CSL_H_ */
#endif /* STORM_FORMULA_CSL_H_ */

2
src/formula/Csl/AbstractNoBoundOperator.h

@ -74,7 +74,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0;
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0;
};
} /* namespace csl */

4
src/formula/Csl/AbstractPathFormula.h

@ -17,7 +17,7 @@ template<class T> class AbstractPathFormula;
} //namespace storm
#include "src/formula/abstract/AbstractFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
#include <vector>
#include <iostream>
@ -71,7 +71,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const = 0;
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const = 0;
};
} //namespace csl

4
src/formula/Csl/AbstractStateFormula.h

@ -18,7 +18,7 @@ template<class T> class AbstractStateFormula;
#include "AbstractCslFormula.h"
#include "src/storage/BitVector.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -65,7 +65,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const = 0;
virtual storm::storage::BitVector* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const = 0;
};
} //namespace csl

4
src/formula/Csl/And.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/And.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
#include <string>
namespace storm {
@ -114,7 +114,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this);
}

4
src/formula/Csl/Ap.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/Ap.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -91,7 +91,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IApModelChecker>()->checkAp(*this);
}

4
src/formula/Csl/Eventually.h

@ -11,7 +11,7 @@
#include "src/formula/abstract/Eventually.h"
#include "src/formula/Csl/AbstractPathFormula.h"
#include "src/formula/Csl/AbstractStateFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -108,7 +108,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this, qualitative);
}
};

4
src/formula/Csl/Globally.h

@ -12,7 +12,7 @@
#include "AbstractPathFormula.h"
#include "AbstractStateFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -110,7 +110,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this, qualitative);
}
};

2
src/formula/Csl/Next.h

@ -108,7 +108,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<INextModelChecker>()->checkNext(*this, qualitative);
}
};

4
src/formula/Csl/Not.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/Not.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/csl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -104,7 +104,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<INotModelChecker>()->checkNot(*this);
}
};

2
src/formula/Csl/Or.h

@ -113,7 +113,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IOrModelChecker>()->checkOr(*this);
}
};

2
src/formula/Csl/ProbabilisticBoundOperator.h

@ -109,7 +109,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IProbabilisticBoundOperatorModelChecker>()->checkProbabilisticBoundOperator(*this);
}
};

4
src/formula/Csl/ProbabilisticNoBoundOperator.h

@ -34,7 +34,7 @@ namespace csl {
* This class does not contain a check() method like the other formula classes.
* The check method should only be called by the model checker to infer the correct check function for sub
* formulas. As this operator can only appear at the root, the method is not useful here.
* Use the checkProbabilisticNoBoundOperator method from the DtmcPrctlModelChecker class instead.
* Use the checkProbabilisticNoBoundOperator method from the DtmccslModelChecker class instead.
*
* The subtree is seen as part of the object and deleted with it
* (this behavior can be prevented by setting them to NULL before deletion)
@ -103,7 +103,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
return this->getPathFormula().check(modelChecker, qualitative);
}
};

2
src/formula/Csl/SteadyStateBoundOperator.h

@ -105,7 +105,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<ISteadyStateBoundOperatorModelChecker>()->checkSteadyStateBoundOperator(*this);
}

2
src/formula/Csl/SteadyStateNoBoundOperator.h

@ -87,7 +87,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
return modelChecker.template as<ISteadyStateNoBoundOperatorModelChecker>()->checkSteadyStateNoBoundOperator(*this);
}

2
src/formula/Csl/TimeBoundedEventually.h

@ -85,7 +85,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<ITimeBoundedEventuallyModelChecker>()->checkTimeBoundedEventually(*this, qualitative);
}
};

2
src/formula/Csl/TimeBoundedUntil.h

@ -99,7 +99,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T>* check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<ITimeBoundedUntilModelChecker>()->checkTimeBoundedUntil(*this, qualitative);
}
};

2
src/formula/Csl/Until.h

@ -113,7 +113,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::csl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this, qualitative);
}
};

4
src/formula/Ltl.h

@ -8,7 +8,7 @@
#ifndef STORM_FORMULA_LTL_H_
#define STORM_FORMULA_LTL_H_
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
#include "Ltl/And.h"
#include "Ltl/Ap.h"
@ -21,6 +21,6 @@
#include "Ltl/Or.h"
#include "Ltl/Until.h"
#include "modelchecker/AbstractModelChecker.h"
#include "modelchecker/ltl/AbstractModelChecker.h"
#endif /* STORM_FORMULA_LTL_H_ */

4
src/formula/Ltl/AbstractLtlFormula.h

@ -9,7 +9,7 @@
#define STORM_LTL_ABSTRACTLTLFORMULA_H_
#include <vector>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
#include "src/formula/abstract/AbstractFormula.h"
namespace storm {
@ -40,7 +40,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const = 0;
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const = 0;
/*!
* Clones the called object.

4
src/formula/Ltl/And.h

@ -11,7 +11,7 @@
#include "AbstractLtlFormula.h"
#include "src/formula/abstract/And.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
#include <string>
namespace storm {
@ -113,7 +113,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this);
}

2
src/formula/Ltl/Ap.h

@ -84,7 +84,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IApModelChecker>()->checkAp(*this);
}

4
src/formula/Ltl/BoundedEventually.h

@ -13,7 +13,7 @@
#include "src/formula/AbstractFormulaChecker.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -112,7 +112,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IBoundedEventuallyModelChecker>()->checkBoundedEventually(*this);
}
};

4
src/formula/Ltl/BoundedUntil.h

@ -12,7 +12,7 @@
#include "AbstractLtlFormula.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -129,7 +129,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T> *check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IBoundedUntilModelChecker>()->checkBoundedUntil(*this);
}
};

4
src/formula/Ltl/Eventually.h

@ -10,7 +10,7 @@
#include "src/formula/abstract/Eventually.h"
#include "AbstractLtlFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -106,7 +106,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T> *check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this);
}
};

4
src/formula/Ltl/Globally.h

@ -11,7 +11,7 @@
#include "src/formula/abstract/Globally.h"
#include "AbstractLtlFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/ltl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -108,7 +108,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T> *check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this);
}
};

2
src/formula/Ltl/Next.h

@ -106,7 +106,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T> *check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<INextModelChecker>()->checkNext(*this);
}
};

2
src/formula/Ltl/Not.h

@ -102,7 +102,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<INotModelChecker>()->checkNot(*this);
}
};

2
src/formula/Ltl/Or.h

@ -107,7 +107,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T>* check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IOrModelChecker>()->checkOr(*this);
}

2
src/formula/Ltl/Until.h

@ -123,7 +123,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual std::vector<T> *check(const storm::modelchecker::ltl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this);
}
};

17
src/formula/Prctl.h

@ -5,10 +5,10 @@
* Author: chris
*/
#ifndef STORM_FORMULA_FORMULAS_H_
#define STORM_FORMULA_FORMULAS_H_
#ifndef STORM_FORMULA_PRCTL_H_
#define STORM_FORMULA_PRCTL_H_
#include "modelchecker/ForwardDeclarations.h"
#include "modelchecker/prctl/ForwardDeclarations.h"
#include "Prctl/And.h"
#include "Prctl/Ap.h"
@ -32,18 +32,11 @@
#include "Prctl/RewardNoBoundOperator.h"
#include "Prctl/SteadyStateReward.h"
/*
#include "SteadyStateNoBoundOperator.h"
#include "SteadyStateBoundOperator.h"
#include "TimeBoundedUntil.h"
#include "TimeBoundedEventually.h"
*/
#include "Prctl/AbstractPrctlFormula.h"
#include "Prctl/AbstractStateFormula.h"
#include "Prctl/AbstractNoBoundOperator.h"
#include "Prctl/AbstractPathFormula.h"
#include "modelchecker/AbstractModelChecker.h"
#include "modelchecker/prctl/AbstractModelChecker.h"
#endif /* STORM_FORMULA_FORMULAS_H_ */
#endif /* STORM_FORMULA_PRCTL_H_ */

2
src/formula/Prctl/AbstractNoBoundOperator.h

@ -74,7 +74,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0;
virtual std::vector<T>* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const = 0;
};
} /* namespace prctl */

4
src/formula/Prctl/AbstractPathFormula.h

@ -13,7 +13,7 @@ template <class T> class AbstractPathFormula;
}}}
#include "src/formula/abstract/AbstractFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
#include <vector>
#include <iostream>
@ -66,7 +66,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const = 0;
virtual std::vector<T>* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const = 0;
};
} //namespace prctl

4
src/formula/Prctl/AbstractStateFormula.h

@ -14,7 +14,7 @@ template <class T> class AbstractStateFormula;
#include "AbstractPrctlFormula.h"
#include "src/storage/BitVector.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -61,7 +61,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const = 0;
virtual storm::storage::BitVector *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const = 0;
};
} //namespace prctl

4
src/formula/Prctl/And.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/And.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
#include <string>
namespace storm {
@ -114,7 +114,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IAndModelChecker>()->checkAnd(*this);
}

4
src/formula/Prctl/Ap.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/Ap.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -91,7 +91,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IApModelChecker>()->checkAp(*this);
}

4
src/formula/Prctl/BoundedEventually.h

@ -14,7 +14,7 @@
#include "src/formula/AbstractFormulaChecker.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -114,7 +114,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T>* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IBoundedEventuallyModelChecker>()->checkBoundedEventually(*this, qualitative);
}
};

4
src/formula/Prctl/BoundedNaryUntil.h

@ -16,7 +16,7 @@
#include <vector>
#include <tuple>
#include <sstream>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -128,7 +128,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IBoundedNaryUntilModelChecker>()->checkBoundedNaryUntil(*this, qualitative);
}

4
src/formula/Prctl/BoundedUntil.h

@ -13,7 +13,7 @@
#include "src/formula/Prctl/AbstractStateFormula.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -119,7 +119,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IBoundedUntilModelChecker>()->checkBoundedUntil(*this, qualitative);
}
};

2
src/formula/Prctl/CumulativeReward.h

@ -98,7 +98,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<ICumulativeRewardModelChecker>()->checkCumulativeReward(*this, qualitative);
}
};

4
src/formula/Prctl/Eventually.h

@ -11,7 +11,7 @@
#include "src/formula/abstract/Eventually.h"
#include "src/formula/Prctl/AbstractPathFormula.h"
#include "src/formula/Prctl/AbstractStateFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -108,7 +108,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IEventuallyModelChecker>()->checkEventually(*this, qualitative);
}
};

4
src/formula/Prctl/Globally.h

@ -12,7 +12,7 @@
#include "AbstractPathFormula.h"
#include "AbstractStateFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -110,7 +110,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IGloballyModelChecker>()->checkGlobally(*this, qualitative);
}
};

2
src/formula/Prctl/InstantaneousReward.h

@ -99,7 +99,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IInstantaneousRewardModelChecker>()->checkInstantaneousReward(*this, qualitative);
}
};

2
src/formula/Prctl/Next.h

@ -108,7 +108,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<INextModelChecker>()->checkNext(*this, qualitative);
}
};

4
src/formula/Prctl/Not.h

@ -11,7 +11,7 @@
#include "AbstractStateFormula.h"
#include "src/formula/abstract/Not.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/modelchecker/prctl/ForwardDeclarations.h"
namespace storm {
namespace property {
@ -104,7 +104,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<INotModelChecker>()->checkNot(*this);
}
};

2
src/formula/Prctl/Or.h

@ -113,7 +113,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IOrModelChecker>()->checkOr(*this);
}
};

2
src/formula/Prctl/ProbabilisticBoundOperator.h

@ -127,7 +127,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IProbabilisticBoundOperatorModelChecker>()->checkProbabilisticBoundOperator(*this);
}
};

2
src/formula/Prctl/ProbabilisticNoBoundOperator.h

@ -103,7 +103,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
virtual std::vector<T>* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
return this->getPathFormula().check(modelChecker, qualitative);
}
};

2
src/formula/Prctl/ReachabilityReward.h

@ -105,7 +105,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IReachabilityRewardModelChecker>()->checkReachabilityReward(*this, qualitative);
}
};

2
src/formula/Prctl/RewardBoundOperator.h

@ -120,7 +120,7 @@ public:
*
* @returns A bit vector indicating all states that satisfy the formula represented by the called object.
*/
virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker) const {
virtual storm::storage::BitVector* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker) const {
return modelChecker.template as<IRewardBoundOperatorModelChecker>()->checkRewardBoundOperator(*this);
}
};

2
src/formula/Prctl/RewardNoBoundOperator.h

@ -96,7 +96,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T>* check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
virtual std::vector<T>* check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative=false) const {
return this->getPathFormula().check(modelChecker, qualitative);
}
};

2
src/formula/Prctl/SteadyStateReward.h

@ -80,7 +80,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<ISteadyStateRewardModelChecker>()->checkSteadyStateReward(*this, qualitative);
}
};

2
src/formula/Prctl/Until.h

@ -113,7 +113,7 @@ public:
*
* @returns A vector indicating the probability that the formula holds for each state.
*/
virtual std::vector<T> *check(const storm::modelchecker::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
virtual std::vector<T> *check(const storm::modelchecker::prctl::AbstractModelChecker<T>& modelChecker, bool qualitative) const {
return modelChecker.template as<IUntilModelChecker>()->checkUntil(*this, qualitative);
}
};

2
src/formula/abstract/AbstractFormula.h

@ -18,7 +18,7 @@ template <class T> class AbstractFormula;
} //namespace property
} //namespace storm
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/formula/AbstractFormulaChecker.h"
namespace storm {

1
src/formula/abstract/And.h

@ -10,7 +10,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include <string>
namespace storm {

1
src/formula/abstract/Ap.h

@ -10,7 +10,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {
namespace property {

1
src/formula/abstract/BoundedEventually.h

@ -12,7 +12,6 @@
#include "src/formula/AbstractFormulaChecker.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {

1
src/formula/abstract/BoundedNaryUntil.h

@ -14,7 +14,6 @@
#include <vector>
#include <tuple>
#include <sstream>
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {
namespace property {

1
src/formula/abstract/BoundedUntil.h

@ -11,7 +11,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "boost/integer/integer_mask.hpp"
#include <string>
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {
namespace property {

1
src/formula/abstract/Eventually.h

@ -9,7 +9,6 @@
#define STORM_FORMULA_ABSTRACT_EVENTUALLY_H_
#include "src/formula/abstract/AbstractFormula.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {

1
src/formula/abstract/Globally.h

@ -10,7 +10,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {

1
src/formula/abstract/Not.h

@ -10,7 +10,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {

1
src/formula/abstract/PathBoundOperator.h

@ -15,7 +15,6 @@
#include "src/formula/abstract/OptimizingOperator.h"
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/utility/ConstTemplates.h"
namespace storm {

1
src/formula/abstract/PathNoBoundOperator.h

@ -12,7 +12,6 @@
#include "src/formula/AbstractFormulaChecker.h"
#include "src/formula/abstract/OptimizingOperator.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {

1
src/formula/abstract/StateBoundOperator.h

@ -12,7 +12,6 @@
#include "src/formula/abstract/AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/formula/ComparisonType.h"
#include "src/modelchecker/AbstractModelChecker.h"
#include "src/utility/ConstTemplates.h"
namespace storm {

1
src/formula/abstract/StateNoBoundOperator.h

@ -11,7 +11,6 @@
#include "AbstractFormula.h"
#include "src/formula/AbstractFormulaChecker.h"
#include "src/modelchecker/ForwardDeclarations.h"
namespace storm {
namespace property {

287
src/modelchecker/csl/AbstractModelChecker.h

@ -0,0 +1,287 @@
/*
* AbstractModelChecker.h
*
* Created on: 22.10.2012
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_CSL_ABSTRACTMODELCHECKER_H_
#define STORM_MODELCHECKER_CSL_ABSTRACTMODELCHECKER_H_
#include "src/exceptions/InvalidPropertyException.h"
#include "src/formula/Csl.h"
#include "src/storage/BitVector.h"
#include "src/models/AbstractModel.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
#include <iostream>
extern log4cplus::Logger logger;
namespace storm {
namespace modelchecker {
namespace csl {
/*!
* @brief
* (Abstract) interface for all model checker classes.
*
* This class provides basic functions that are common to all model checkers (i.e. subclasses). It mainly declares
* abstract methods that are implemented in the concrete subclasses, but also covers checking procedures that are common
* to all model checkers for state-based models.
*/
template<class Type>
class AbstractModelChecker :
// A list of interfaces the model checker supports. Typically, for each of the interfaces, a check method needs to
// be implemented that performs the corresponding check.
public virtual storm::property::csl::IApModelChecker<Type>,
public virtual storm::property::csl::IAndModelChecker<Type>,
public virtual storm::property::csl::IOrModelChecker<Type>,
public virtual storm::property::csl::INotModelChecker<Type>,
public virtual storm::property::csl::IUntilModelChecker<Type>,
public virtual storm::property::csl::IEventuallyModelChecker<Type>,
public virtual storm::property::csl::IGloballyModelChecker<Type>,
public virtual storm::property::csl::INextModelChecker<Type>,
public virtual storm::property::csl::ITimeBoundedUntilModelChecker<Type>,
public virtual storm::property::csl::ITimeBoundedEventuallyModelChecker<Type>,
public virtual storm::property::csl::INoBoundOperatorModelChecker<Type>,
public virtual storm::property::csl::IProbabilisticBoundOperatorModelChecker<Type> {
public:
/*!
* Constructs an AbstractModelChecker with the given model.
*/
explicit AbstractModelChecker(storm::models::AbstractModel<Type> const& model) : model(model) {
// Intentionally left empty.
}
/*!
* Copy constructs an AbstractModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit AbstractModelChecker(AbstractModelChecker<Type> const& modelchecker) : model(modelchecker.model) {
// Intentionally left empty.
}
/*!
* Virtual destructor. Needs to be virtual, because this class has virtual methods.
*/
virtual ~AbstractModelChecker() {
// Intentionally left empty.
}
/*!
* Returns a pointer to the model checker object that is of the requested type as given by the template parameters.
* @returns A pointer to the model checker object that is of the requested type as given by the template parameters.
* If the model checker is not of the requested type, type casting will fail and result in an exception.
*/
template <template <class T> class Target>
const Target<Type>* as() const {
try {
const Target<Type>* target = dynamic_cast<const Target<Type>*>(this);
return target;
} catch (std::bad_cast& bc) {
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(*this).name() << " to " << typeid(Target<Type>).name() << ".");
throw bc;
}
return nullptr;
}
/*!
* Retrieves the model associated with this model checker as a constant reference to an object of the type given
* by the template parameter.
*
* @returns A constant reference of the specified type to the model associated with this model checker. If the model
* is not of the requested type, type casting will fail and result in an exception.
*/
template <class Model>
Model const& getModel() const {
try {
Model const& target = dynamic_cast<Model const&>(this->model);
return target;
} catch (std::bad_cast& bc) {
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(this->model).name() << " to " << typeid(Model).name() << ".");
throw bc;
}
}
/*!
* Checks the given abstract prctl formula on the model and prints the result (depending on the actual type of the formula)
* for all initial states, i.e. states that carry the atomic proposition "init".
*
* @param formula The formula to be checked.
*/
void check(storm::property::csl::AbstractCslFormula<Type> const& formula) const {
if (dynamic_cast<storm::property::csl::AbstractStateFormula<Type> const*>(&formula) != nullptr) {
this->check(static_cast<storm::property::csl::AbstractStateFormula<Type> const&>(formula));
} else if (dynamic_cast<storm::property::csl::AbstractNoBoundOperator<Type> const*>(&formula) != nullptr) {
this->check(static_cast<storm::property::csl::AbstractNoBoundOperator<Type> const&>(formula));
}
}
/*!
* Checks the given state formula on the model and prints the result (true/false) for all initial states, i.e.
* states that carry the atomic proposition "init".
*
* @param stateFormula The formula to be checked.
*/
void check(storm::property::csl::AbstractStateFormula<Type> const& stateFormula) const {
std::cout << std::endl;
LOG4CPLUS_INFO(logger, "Model checking formula\t" << stateFormula.toString());
std::cout << "Model checking formula:\t" << stateFormula.toString() << std::endl;
storm::storage::BitVector* result = nullptr;
try {
result = stateFormula.check(*this);
LOG4CPLUS_INFO(logger, "Result for initial states:");
std::cout << "Result for initial states:" << std::endl;
for (auto initialState : model.getLabeledStates("init")) {
LOG4CPLUS_INFO(logger, "\t" << initialState << ": " << (result->get(initialState) ? "satisfied" : "not satisfied"));
std::cout << "\t" << initialState << ": " << result->get(initialState) << std::endl;
}
delete result;
} catch (std::exception& e) {
std::cout << "Error during computation: " << e.what() << "Skipping property." << std::endl;
LOG4CPLUS_ERROR(logger, "Error during computation: " << e.what() << "Skipping property.");
if (result != nullptr) {
delete result;
}
}
std::cout << std::endl;
storm::utility::printSeparationLine(std::cout);
}
/*!
* Checks the given formula (with no bound) on the model and prints the result (probability/rewards) for all
* initial states, i.e. states that carry the atomic proposition "init".
*
* @param noBoundFormula The formula to be checked.
*/
void check(storm::property::csl::AbstractNoBoundOperator<Type> const& noBoundFormula) const {
std::cout << std::endl;
LOG4CPLUS_INFO(logger, "Model checking formula\t" << noBoundFormula.toString());
std::cout << "Model checking formula:\t" << noBoundFormula.toString() << std::endl;
std::vector<Type>* result = nullptr;
try {
result = this->checkNoBoundOperator(noBoundFormula);
LOG4CPLUS_INFO(logger, "Result for initial states:");
std::cout << "Result for initial states:" << std::endl;
for (auto initialState : model.getLabeledStates("init")) {
LOG4CPLUS_INFO(logger, "\t" << initialState << ": " << (*result)[initialState]);
std::cout << "\t" << initialState << ": " << (*result)[initialState] << std::endl;
}
delete result;
} catch (std::exception& e) {
std::cout << "Error during computation: " << e.what() << " Skipping property." << std::endl;
if (result != nullptr) {
delete result;
}
}
std::cout << std::endl;
storm::utility::printSeparationLine(std::cout);
}
/*!
* Checks the given formula consisting of a single atomic proposition.
*
* @param formula The formula to be checked.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
storm::storage::BitVector* checkAp(storm::property::csl::Ap<Type> const& formula) const {
if (formula.getAp() == "true") {
return new storm::storage::BitVector(model.getNumberOfStates(), true);
} else if (formula.getAp() == "false") {
return new storm::storage::BitVector(model.getNumberOfStates());
}
if (!model.hasAtomicProposition(formula.getAp())) {
LOG4CPLUS_ERROR(logger, "Atomic proposition '" << formula.getAp() << "' is invalid.");
throw storm::exceptions::InvalidPropertyException() << "Atomic proposition '" << formula.getAp() << "' is invalid.";
}
return new storm::storage::BitVector(model.getLabeledStates(formula.getAp()));
}
/*!
* Checks the given formula that is a logical "and" of two formulae.
*
* @param formula The formula to be checked.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
storm::storage::BitVector* checkAnd(storm::property::csl::And<Type> const& formula) const {
storm::storage::BitVector* result = formula.getLeft().check(*this);
storm::storage::BitVector* right = formula.getRight().check(*this);
(*result) &= (*right);
delete right;
return result;
}
/*!
* Checks the given formula that is a logical "or" of two formulae.
*
* @param formula The formula to check.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
virtual storm::storage::BitVector* checkOr(storm::property::csl::Or<Type> const& formula) const {
storm::storage::BitVector* result = formula.getLeft().check(*this);
storm::storage::BitVector* right = formula.getRight().check(*this);
(*result) |= (*right);
delete right;
return result;
}
/*!
* Checks the given formula that is a logical "not" of a sub-formula.
*
* @param formula The formula to check.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
storm::storage::BitVector* checkNot(const storm::property::csl::Not<Type>& formula) const {
storm::storage::BitVector* result = formula.getChild().check(*this);
result->complement();
return result;
}
/*!
* Checks the given formula that is a P operator over a path formula featuring a value bound.
*
* @param formula The formula to check.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
storm::storage::BitVector* checkProbabilisticBoundOperator(storm::property::csl::ProbabilisticBoundOperator<Type> const& formula) const {
// First, we need to compute the probability for satisfying the path formula for each state.
std::vector<Type>* quantitativeResult = formula.getPathFormula().check(*this, false);
// Create resulting bit vector that will hold the yes/no-answer for every state.
storm::storage::BitVector* result = new storm::storage::BitVector(quantitativeResult->size());
// Now, we can compute which states meet the bound specified in this operator and set the
// corresponding bits to true in the resulting vector.
for (uint_fast64_t i = 0; i < quantitativeResult->size(); ++i) {
if (formula.meetsBound((*quantitativeResult)[i])) {
result->set(i, true);
}
}
// Delete the probabilities computed for the states and return result.
delete quantitativeResult;
return result;
}
private:
/*!
* A constant reference to the model associated with this model checker.
*
* @note that we do not own this object, but merely have a constant reference to it. That means that using the
* model checker object is unsafe after the object has been destroyed.
*/
storm::models::AbstractModel<Type> const& model;
};
} // namespace csl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_CSL_DTMCPRCTLMODELCHECKER_H_ */

2
src/modelchecker/ForwardDeclarations.h → src/modelchecker/csl/ForwardDeclarations.h

@ -12,10 +12,12 @@
// the callback methods (i.e., the check methods).
namespace storm {
namespace modelchecker {
namespace csl {
template <class Type>
class AbstractModelChecker;
} //namespace csl
} //namespace modelchecker
} //namespace storm

193
src/modelchecker/ltl/AbstractModelChecker.h

@ -0,0 +1,193 @@
/*
* AbstractModelChecker.h
*
* Created on: 22.10.2012
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_LTL_ABSTRACTMODELCHECKER_H_
#define STORM_MODELCHECKER_LTL_ABSTRACTMODELCHECKER_H_
#include "src/exceptions/InvalidPropertyException.h"
#include "src/formula/Ltl.h"
#include "src/storage/BitVector.h"
#include "src/models/AbstractModel.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
#include <iostream>
extern log4cplus::Logger logger;
namespace storm {
namespace modelchecker {
namespace ltl {
/*!
* @brief
* (Abstract) interface for all model checker classes.
*
* This class provides basic functions that are common to all model checkers (i.e. subclasses). It mainly declares
* abstract methods that are implemented in the concrete subclasses, but also covers checking procedures that are common
* to all model checkers for state-based models.
*/
template<class Type>
class AbstractModelChecker :
// A list of interfaces the model checker supports. Typically, for each of the interfaces, a check method needs to
// be implemented that performs the corresponding check.
public virtual storm::property::ltl::IApModelChecker<Type>,
public virtual storm::property::ltl::IAndModelChecker<Type>,
public virtual storm::property::ltl::IOrModelChecker<Type>,
public virtual storm::property::ltl::INotModelChecker<Type>,
public virtual storm::property::ltl::IUntilModelChecker<Type>,
public virtual storm::property::ltl::IEventuallyModelChecker<Type>,
public virtual storm::property::ltl::IGloballyModelChecker<Type>,
public virtual storm::property::ltl::INextModelChecker<Type>,
public virtual storm::property::ltl::IBoundedUntilModelChecker<Type>,
public virtual storm::property::ltl::IBoundedEventuallyModelChecker<Type> {
public:
/*!
* Constructs an AbstractModelChecker with the given model.
*/
explicit AbstractModelChecker(storm::models::AbstractModel<Type> const& model) : model(model) {
// Intentionally left empty.
}
/*!
* Copy constructs an AbstractModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit AbstractModelChecker(AbstractModelChecker<Type> const& modelchecker) : model(modelchecker.model) {
// Intentionally left empty.
}
/*!
* Virtual destructor. Needs to be virtual, because this class has virtual methods.
*/
virtual ~AbstractModelChecker() {
// Intentionally left empty.
}
/*!
* Returns a pointer to the model checker object that is of the requested type as given by the template parameters.
* @returns A pointer to the model checker object that is of the requested type as given by the template parameters.
* If the model checker is not of the requested type, type casting will fail and result in an exception.
*/
template <template <class T> class Target>
const Target<Type>* as() const {
try {
const Target<Type>* target = dynamic_cast<const Target<Type>*>(this);
return target;
} catch (std::bad_cast& bc) {
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(*this).name() << " to " << typeid(Target<Type>).name() << ".");
throw bc;
}
return nullptr;
}
/*!
* Retrieves the model associated with this model checker as a constant reference to an object of the type given
* by the template parameter.
*
* @returns A constant reference of the specified type to the model associated with this model checker. If the model
* is not of the requested type, type casting will fail and result in an exception.
*/
template <class Model>
Model const& getModel() const {
try {
Model const& target = dynamic_cast<Model const&>(this->model);
return target;
} catch (std::bad_cast& bc) {
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(this->model).name() << " to " << typeid(Model).name() << ".");
throw bc;
}
}
/*!
* Checks the given state formula on the model and prints the result (true/false) for all initial states, i.e.
* states that carry the atomic proposition "init".
*
* @param stateFormula The formula to be checked.
*/
void check(storm::property::ltl::AbstractLtlFormula<Type> const& ltlFormula) const {
std::cout << std::endl;
LOG4CPLUS_INFO(logger, "Model checking formula\t" << ltlFormula.toString());
std::cout << "Model checking formula:\t" << ltlFormula.toString() << std::endl;
storm::storage::BitVector* result = nullptr;
try {
result = ltlFormula.check(*this);
LOG4CPLUS_INFO(logger, "Result for initial states:");
std::cout << "Result for initial states:" << std::endl;
for (auto initialState : model.getLabeledStates("init")) {
LOG4CPLUS_INFO(logger, "\t" << initialState << ": " << (result->get(initialState) ? "satisfied" : "not satisfied"));
std::cout << "\t" << initialState << ": " << result->get(initialState) << std::endl;
}
delete result;
} catch (std::exception& e) {
std::cout << "Error during computation: " << e.what() << "Skipping property." << std::endl;
LOG4CPLUS_ERROR(logger, "Error during computation: " << e.what() << "Skipping property.");
if (result != nullptr) {
delete result;
}
}
std::cout << std::endl;
storm::utility::printSeparationLine(std::cout);
}
/*!
* Checks the given formula consisting of a single atomic proposition.
*
* @param formula The formula to be checked.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
virtual std::vector<Type>* checkAp(storm::property::ltl::Ap<Type> const& formula) const {
return nullptr;
}
/*!
* Checks the given formula that is a logical "and" of two formulae.
*
* @param formula The formula to be checked.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
virtual std::vector<Type>* checkAnd(storm::property::ltl::And<Type> const& formula) const {
return nullptr;
}
/*!
* Checks the given formula that is a logical "or" of two formulae.
*
* @param formula The formula to check.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
virtual std::vector<Type>* checkOr(storm::property::ltl::Or<Type> const& formula) const {
return nullptr;
}
/*!
* Checks the given formula that is a logical "not" of a sub-formula.
*
* @param formula The formula to check.
* @returns The set of states satisfying the formula represented by a bit vector.
*/
virtual std::vector<Type>* checkNot(const storm::property::ltl::Not<Type>& formula) const {
return nullptr;
}
private:
/*!
* A constant reference to the model associated with this model checker.
*
* @note that we do not own this object, but merely have a constant reference to it. That means that using the
* model checker object is unsafe after the object has been destroyed.
*/
storm::models::AbstractModel<Type> const& model;
};
} // namespace ltl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_LTL_ABSTRACTMODELCHECKER_H_ */

24
src/modelchecker/ltl/ForwardDeclarations.h

@ -0,0 +1,24 @@
/*
* ForwardDeclarations.h
*
* Created on: 14.01.2013
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_LTL_FORWARDDECLARATIONS_H_
#define STORM_MODELCHECKER_LTL_FORWARDDECLARATIONS_H_
// Forward declare the abstract model checker. This is used by the formula classes that need this declaration for
// the callback methods (i.e., the check methods).
namespace storm {
namespace modelchecker {
namespace ltl {
template <class Type>
class AbstractModelChecker;
} //namespace ltl
} //namespace modelchecker
} //namespace storm
#endif /* STORM_MODELCHECKER_LTL_FORWARDDECLARATIONS_H_ */

15
src/modelchecker/AbstractModelChecker.h → src/modelchecker/prctl/AbstractModelChecker.h

@ -5,15 +5,8 @@
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_ABSTRACTMODELCHECKER_H_
#define STORM_MODELCHECKER_ABSTRACTMODELCHECKER_H_
// Forward declaration of abstract model checker class needed by the formula classes.
namespace storm {
namespace modelchecker {
template <class Type> class AbstractModelChecker;
}
}
#ifndef STORM_MODELCHECKER_PRCTL_ABSTRACTMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_ABSTRACTMODELCHECKER_H_
#include "src/exceptions/InvalidPropertyException.h"
#include "src/formula/Prctl.h"
@ -29,6 +22,7 @@ extern log4cplus::Logger logger;
namespace storm {
namespace modelchecker {
namespace prctl {
/*!
* @brief
@ -316,7 +310,8 @@ private:
storm::models::AbstractModel<Type> const& model;
};
} // namespace prctl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_DTMCPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_DTMCPRCTLMODELCHECKER_H_ */

10
src/modelchecker/EigenDtmcPrctlModelChecker.h → src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h

@ -5,13 +5,13 @@
* Author:
*/
#ifndef STORM_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_EIGENDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_EIGENDTMCPRCTLMODELCHECKER_H_
#include "src/utility/Vector.h"
#include "src/models/Dtmc.h"
#include "src/modelchecker/SparseDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h"
#include "src/utility/GraphAnalyzer.h"
#include "src/utility/ConstTemplates.h"
#include "src/exceptions/NoConvergenceException.h"
@ -30,6 +30,7 @@ extern log4cplus::Logger logger;
namespace storm {
namespace modelchecker {
namespace prctl {
/*
* A model checking engine that makes use of the eigen backend.
@ -135,7 +136,8 @@ private:
}
};
} //namespace prctl
} //namespace modelchecker
} //namespace storm
#endif /* STORM_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_EIGENDTMCPRCTLMODELCHECKER_H_ */

24
src/modelchecker/prctl/ForwardDeclarations.h

@ -0,0 +1,24 @@
/*
* ForwardDeclarations.h
*
* Created on: 14.01.2013
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_PRCTL_FORWARDDECLARATIONS_H_
#define STORM_MODELCHECKER_PRCTL_FORWARDDECLARATIONS_H_
// Forward declare the abstract model checker. This is used by the formula classes that need this declaration for
// the callback methods (i.e., the check methods).
namespace storm {
namespace modelchecker {
namespace prctl {
template <class Type>
class AbstractModelChecker;
} //namespace prctl
} //namespace modelchecker
} //namespace storm
#endif /* STORM_MODELCHECKER_PRCTL_FORWARDDECLARATIONS_H_ */

12
src/modelchecker/GmmxxDtmcPrctlModelChecker.h → src/modelchecker/prctl/GmmxxDtmcPrctlModelChecker.h

@ -5,10 +5,10 @@
* Author: Christian Dehnert
*/
#ifndef STORM_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_GMMXXDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_GMMXXDTMCPRCTLMODELCHECKER_H_
#include "src/modelchecker/SparseDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h"
#include "src/adapters/GmmxxAdapter.h"
#include "src/storage/JacobiDecomposition.h"
#include "src/utility/ConstTemplates.h"
@ -21,6 +21,7 @@
namespace storm {
namespace modelchecker {
namespace prctl {
/*
* An implementation of the SparseDtmcPrctlModelChecker interface that uses gmm++ as the solving backend.
@ -42,7 +43,7 @@ public:
* Copy constructs a GmmxxDtmcPrctlModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit GmmxxDtmcPrctlModelChecker(storm::modelchecker::GmmxxDtmcPrctlModelChecker<Type> const& modelchecker) : SparseDtmcPrctlModelChecker<Type>(modelchecker) {
explicit GmmxxDtmcPrctlModelChecker(storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<Type> const& modelchecker) : SparseDtmcPrctlModelChecker<Type>(modelchecker) {
// Intentionally left empty.
}
@ -302,7 +303,8 @@ private:
}
};
} // namespace prctl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_GMMXXDTMCPRCTLMODELCHECKER_H_ */

12
src/modelchecker/GmmxxMdpPrctlModelChecker.h → src/modelchecker/prctl/GmmxxMdpPrctlModelChecker.h

@ -5,10 +5,10 @@
* Author: Christian Dehnert
*/
#ifndef STORM_MODELCHECKER_GMMXXMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_GMMXXMDPPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_GMMXXMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_GMMXXMDPPRCTLMODELCHECKER_H_
#include "src/modelchecker/SparseMdpPrctlModelChecker.h"
#include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
#include "src/adapters/GmmxxAdapter.h"
#include "gmm/gmm_matrix.h"
@ -18,6 +18,7 @@
namespace storm {
namespace modelchecker {
namespace prctl {
/*
* An implementation of the SparseMdpPrctlModelChecker interface that uses gmm++ as the solving backend.
@ -39,7 +40,7 @@ public:
* Copy constructs a GmmxxDtmcPrctlModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit GmmxxMdpPrctlModelChecker(storm::modelchecker::GmmxxMdpPrctlModelChecker<Type> const& modelchecker) : SparseMdpPrctlModelChecker<Type>(modelchecker) {
explicit GmmxxMdpPrctlModelChecker(storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<Type> const& modelchecker) : SparseMdpPrctlModelChecker<Type>(modelchecker) {
// Intentionally left empty.
}
@ -156,7 +157,8 @@ private:
}
};
} //namespace prctl
} //namespace modelchecker
} //namespace storm
#endif /* STORM_MODELCHECKER_GMMXXMDPPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_GMMXXMDPPRCTLMODELCHECKER_H_ */

12
src/modelchecker/SparseDtmcPrctlModelChecker.h → src/modelchecker/prctl/SparseDtmcPrctlModelChecker.h

@ -5,10 +5,10 @@
* Author: Thomas Heinemann
*/
#ifndef STORM_MODELCHECKER_SPARSEDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_SPARSEDTMCPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_SPARSEDTMCPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_SPARSEDTMCPRCTLMODELCHECKER_H_
#include "src/modelchecker/AbstractModelChecker.h"
#include "src/modelchecker/prctl/AbstractModelChecker.h"
#include "src/models/Dtmc.h"
#include "src/utility/Vector.h"
#include "src/utility/GraphAnalyzer.h"
@ -17,6 +17,7 @@
namespace storm {
namespace modelchecker {
namespace prctl {
/*!
* @brief
@ -39,7 +40,7 @@ public:
* Copy constructs a SparseDtmcPrctlModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit SparseDtmcPrctlModelChecker(storm::modelchecker::SparseDtmcPrctlModelChecker<Type> const& modelChecker) : AbstractModelChecker<Type>(modelChecker) {
explicit SparseDtmcPrctlModelChecker(storm::modelchecker::prctl::SparseDtmcPrctlModelChecker<Type> const& modelChecker) : AbstractModelChecker<Type>(modelChecker) {
// Intentionally left empty.
}
@ -448,7 +449,8 @@ private:
virtual void solveEquationSystem(storm::storage::SparseMatrix<Type> const& A, std::vector<Type>& x, std::vector<Type> const& b) const = 0;
};
} // namespace prctl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_SPARSEDTMCPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_SPARSEDTMCPRCTLMODELCHECKER_H_ */

12
src/modelchecker/SparseMdpPrctlModelChecker.h → src/modelchecker/prctl/SparseMdpPrctlModelChecker.h

@ -5,10 +5,10 @@
* Author: Christian Dehnert
*/
#ifndef STORM_MODELCHECKER_SPARSEMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_SPARSEMDPPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_SPARSEMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_SPARSEMDPPRCTLMODELCHECKER_H_
#include "src/modelchecker/AbstractModelChecker.h"
#include "src/modelchecker/prctl/AbstractModelChecker.h"
#include "src/models/Mdp.h"
#include "src/utility/Vector.h"
#include "src/utility/GraphAnalyzer.h"
@ -18,6 +18,7 @@
namespace storm {
namespace modelchecker {
namespace prctl {
/*!
* @brief
@ -40,7 +41,7 @@ public:
* Copy constructs a SparseMdpPrctlModelChecker from the given model checker. In particular, this means that the newly
* constructed model checker will have the model of the given model checker as its associated model.
*/
explicit SparseMdpPrctlModelChecker(storm::modelchecker::SparseMdpPrctlModelChecker<Type> const& modelchecker)
explicit SparseMdpPrctlModelChecker(storm::modelchecker::prctl::SparseMdpPrctlModelChecker<Type> const& modelchecker)
: AbstractModelChecker<Type>(modelchecker), minimumOperatorStack() {
// Intentionally left empty.
}
@ -580,7 +581,8 @@ private:
}
};
} // namespace prctl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_SPARSEMDPPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_SPARSEMDPPRCTLMODELCHECKER_H_ */

10
src/modelchecker/TopologicalValueIterationMdpPrctlModelChecker.h → src/modelchecker/prctl/TopologicalValueIterationMdpPrctlModelChecker.h

@ -5,15 +5,16 @@
* Author: Christian Dehnert
*/
#ifndef STORM_MODELCHECKER_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_
#ifndef STORM_MODELCHECKER_PRCTL_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_
#define STORM_MODELCHECKER_PRCTL_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_
#include "src/modelchecker/SparseMdpPrctlModelChecker.h"
#include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
#include "src/exceptions/InvalidPropertyException.h"
#include <cmath>
namespace storm {
namespace modelchecker {
namespace prctl {
/*
* An implementation of the SparseMdpPrctlModelChecker interface that uses topoligical value iteration for solving
@ -143,7 +144,8 @@ private:
}
};
} // namespace prctl
} // namespace modelchecker
} // namespace storm
#endif /* STORM_MODELCHECKER_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_ */
#endif /* STORM_MODELCHECKER_PRCTL_TOPOLOGICALVALUEITERATIONSMDPPRCTLMODELCHECKER_H_ */

49
src/parser/LtlFileParser.cpp

@ -0,0 +1,49 @@
/*
* LtlFileParser.cpp
*
* Created on: 13.05.2013
* Author: thomas
*/
#include "LtlFileParser.h"
#include "LtlParser.h"
namespace storm {
namespace parser {
LtlFileParser::LtlFileParser() {
// TODO Auto-generated constructor stub
}
LtlFileParser::~LtlFileParser() {
// TODO Auto-generated destructor stub
}
std::list<storm::property::ltl::AbstractLtlFormula<double>*> LtlFileParser::parseFormulas(std::string filename) {
// Open file
std::ifstream inputFileStream(filename, std::ios::in);
if (!inputFileStream.is_open()) {
std::string message = "Error while opening file ";
throw storm::exceptions::FileIoException() << message << filename;
}
std::list<storm::property::ltl::AbstractLtlFormula<double>*> result;
while(!inputFileStream.eof()) {
std::string line;
//The while loop reads the input file line by line
while (std::getline(inputFileStream, line)) {
LtlParser parser(line);
result.push_back(parser.getFormula());
}
}
return result;
}
} //namespace parser
} //namespace storm

42
src/parser/LtlFileParser.h

@ -0,0 +1,42 @@
/*
* LtlFileParser.h
*
* Created on: 13.05.2013
* Author: Thonas Heinemann
*/
#ifndef LTLFILEPARSER_H_
#define LTLFILEPARSER_H_
#include "formula/Ltl.h"
#include <list>
namespace storm {
namespace parser {
class LtlFileParser {
public:
/*!
* Constructor
*/
LtlFileParser();
/*!
* Destructor
*/
~LtlFileParser();
/*!
* Parses each line of a given file as prctl formula and returns a list containing the results of the parsing.
*
* @param filename
* @return The list of parsed formulas
*/
std::list<storm::property::ltl::AbstractLtlFormula<double>*> parseFormulas(std::string filename);
};
} //namespace parser
} //namespace storm
#endif /* LTLFILEPARSER_H_ */

3
src/parser/PrctlFileParser.cpp

@ -9,9 +9,6 @@
#include "PrctlFileParser.h"
#include "PrctlParser.h"
#include "modelchecker/EigenDtmcPrctlModelChecker.h"
#include "modelchecker/GmmxxDtmcPrctlModelChecker.h"
#include "modelchecker/GmmxxMdpPrctlModelChecker.h"
namespace storm {
namespace parser {

2
src/parser/PrctlFileParser.h

@ -34,7 +34,7 @@ public:
* At this time, empty
*
*/
virtual ~PrctlFileParser();
~PrctlFileParser();
/*!
* Parses each line of a given file as prctl formula and returns a list containing the results of the parsing.

2
src/parser/PrctlParser.cpp

@ -35,7 +35,7 @@ namespace parser {
template<typename Iterator, typename Skipper>
struct PrctlParser::PrctlGrammar : qi::grammar<Iterator, storm::property::prctl::AbstractPrctlFormula<double>*(), Skipper > {
PrctlGrammar() : PrctlGrammar::base_type(start) {
freeIdentifierName = qi::lexeme[+(qi::alpha | qi::char_('_'))];
freeIdentifierName = qi::lexeme[qi::alpha >> *(qi::alnum | qi::char_('_'))];
//This block defines rules for parsing state formulas
stateFormula %= orFormula;

38
src/storm.cpp

@ -22,9 +22,9 @@
#include "src/models/Dtmc.h"
#include "src/storage/SparseMatrix.h"
#include "src/models/AtomicPropositionsLabeling.h"
#include "src/modelchecker/EigenDtmcPrctlModelChecker.h"
#include "src/modelchecker/GmmxxDtmcPrctlModelChecker.h"
#include "src/modelchecker/GmmxxMdpPrctlModelChecker.h"
#include "src/modelchecker/prctl/EigenDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/GmmxxDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/GmmxxMdpPrctlModelChecker.h"
#include "src/parser/AutoParser.h"
#include "src/parser/PrctlParser.h"
#include "src/utility/Settings.h"
@ -32,6 +32,7 @@
#include "src/formula/Prctl.h"
#include "src/parser/PrctlFileParser.h"
#include "src/parser/LtlFileParser.h"
#include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h"
@ -98,7 +99,7 @@ void printFooter() {
bool parseOptions(const int argc, const char* argv[]) {
storm::settings::Settings* s = nullptr;
try {
storm::settings::Settings::registerModule<storm::modelchecker::GmmxxDtmcPrctlModelChecker<double>>();
storm::settings::Settings::registerModule<storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double>>();
s = storm::settings::newInstance(argc, argv, nullptr);
} catch (storm::exceptions::InvalidSettingsException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;
@ -142,10 +143,10 @@ void cleanUp() {
* @param dtmc The Dtmc that the model checker will check
* @return
*/
storm::modelchecker::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Dtmc<double>& dtmc) {
storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Dtmc<double>& dtmc) {
storm::settings::Settings* s = storm::settings::instance();
if (s->getString("matrixlib") == "gmm++") {
return new storm::modelchecker::GmmxxDtmcPrctlModelChecker<double>(dtmc);
return new storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double>(dtmc);
}
// The control flow should never reach this point, as there is a default setting for matrixlib (gmm++)
std::string message = "No matrix library suitable for DTMC model checking has been set";
@ -158,10 +159,10 @@ storm::modelchecker::AbstractModelChecker<double>* createPrctlModelChecker(storm
* @param mdp The Dtmc that the model checker will check
* @return
*/
storm::modelchecker::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Mdp<double>& mdp) {
storm::modelchecker::prctl::AbstractModelChecker<double>* createPrctlModelChecker(storm::models::Mdp<double>& mdp) {
storm::settings::Settings* s = storm::settings::instance();
if (s->getString("matrixlib") == "gmm++") {
return new storm::modelchecker::GmmxxMdpPrctlModelChecker<double>(mdp);
return new storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<double>(mdp);
}
// The control flow should never reach this point, as there is a default setting for matrixlib (gmm++)
std::string message = "No matrix library suitable for MDP model checking has been set";
@ -176,7 +177,7 @@ storm::modelchecker::AbstractModelChecker<double>* createPrctlModelChecker(storm
* @param mc the model checker
*/
void checkPrctlFormulasAgainstModel(std::list<storm::property::prctl::AbstractPrctlFormula<double>*>& formulaList,
storm::modelchecker::AbstractModelChecker<double> const& mc) {
storm::modelchecker::prctl::AbstractModelChecker<double> const& mc) {
for ( auto formula : formulaList ) {
mc.check(*formula);
@ -198,7 +199,7 @@ void checkMdp(std::shared_ptr<storm::models::Mdp<double>> mdp) {
storm::parser::PrctlFileParser fileParser;
std::list<storm::property::prctl::AbstractPrctlFormula<double>*> formulaList = fileParser.parseFormulas(s->getString("prctl"));
storm::modelchecker::AbstractModelChecker<double>* mc = createPrctlModelChecker(*mdp);
storm::modelchecker::prctl::AbstractModelChecker<double>* mc = createPrctlModelChecker(*mdp);
checkPrctlFormulasAgainstModel(formulaList, *mc);
@ -222,13 +223,28 @@ void checkDtmc(std::shared_ptr<storm::models::Dtmc<double>> dtmc) {
storm::parser::PrctlFileParser fileParser;
std::list<storm::property::prctl::AbstractPrctlFormula<double>*> formulaList = fileParser.parseFormulas(s->getString("prctl"));
storm::modelchecker::AbstractModelChecker<double>* mc = createPrctlModelChecker(*dtmc);
storm::modelchecker::prctl::AbstractModelChecker<double>* mc = createPrctlModelChecker(*dtmc);
checkPrctlFormulasAgainstModel(formulaList, *mc);
delete mc;
}
if (s->isSet("ltl")) {
LOG4CPLUS_INFO(logger, "Parsing ltl file"+ s->getString("ltl"));
storm::parser::LtlFileParser fileParser;
std::list<storm::property::ltl::AbstractLtlFormula<double>*> formulaList = fileParser.parseFormulas(s->getString("ltl"));
LOG4CPLUS_ERROR(logger, "LTL model checking is not implemented yet.");
//Debug output while LTL formulas cannot be checked
for (auto formula : formulaList) {
LOG4CPLUS_DEBUG(logger, formula->toString());
}
}
if(s->isSet("csl")) {
LOG4CPLUS_ERROR(logger, "CSL properties cannot be checked on DTMCs.");
}

8
test/functional/GmmxxDtmcPrctModelCheckerTest.cpp

@ -2,7 +2,7 @@
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/modelchecker/GmmxxDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/GmmxxDtmcPrctlModelChecker.h"
#include "src/parser/AutoParser.h"
TEST(GmmxxDtmcPrctModelCheckerTest, Die) {
@ -17,7 +17,7 @@ TEST(GmmxxDtmcPrctModelCheckerTest, Die) {
ASSERT_EQ(dtmc->getNumberOfStates(), 13u);
ASSERT_EQ(dtmc->getNumberOfTransitions(), 27u);
storm::modelchecker::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::property::prctl::Ap<double>* apFormula = new storm::property::prctl::Ap<double>("one");
storm::property::prctl::Eventually<double>* eventuallyFormula = new storm::property::prctl::Eventually<double>(apFormula);
@ -84,7 +84,7 @@ TEST(GmmxxDtmcPrctModelCheckerTest, Crowds) {
ASSERT_EQ(dtmc->getNumberOfStates(), 8607u);
ASSERT_EQ(dtmc->getNumberOfTransitions(), 22460u);
storm::modelchecker::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::property::prctl::Ap<double>* apFormula = new storm::property::prctl::Ap<double>("observe0Greater1");
storm::property::prctl::Eventually<double>* eventuallyFormula = new storm::property::prctl::Eventually<double>(apFormula);
@ -138,7 +138,7 @@ TEST(GmmxxDtmcPrctModelCheckerTest, SynchronousLeader) {
ASSERT_EQ(dtmc->getNumberOfStates(), 12400u);
ASSERT_EQ(dtmc->getNumberOfTransitions(), 28894u);
storm::modelchecker::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double> mc(*dtmc);
storm::property::prctl::Ap<double>* apFormula = new storm::property::prctl::Ap<double>("elected");
storm::property::prctl::Eventually<double>* eventuallyFormula = new storm::property::prctl::Eventually<double>(apFormula);

10
test/functional/GmmxxMdpPrctModelCheckerTest.cpp

@ -2,7 +2,7 @@
#include "storm-config.h"
#include "src/utility/Settings.h"
#include "src/modelchecker/GmmxxMdpPrctlModelChecker.h"
#include "src/modelchecker/prctl/GmmxxMdpPrctlModelChecker.h"
#include "src/parser/AutoParser.h"
TEST(GmmxxMdpPrctModelCheckerTest, Dice) {
@ -16,7 +16,7 @@ TEST(GmmxxMdpPrctModelCheckerTest, Dice) {
ASSERT_EQ(mdp->getNumberOfStates(), 169u);
ASSERT_EQ(mdp->getNumberOfTransitions(), 436u);
storm::modelchecker::GmmxxMdpPrctlModelChecker<double> mc(*mdp);
storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<double> mc(*mdp);
storm::property::prctl::Ap<double>* apFormula = new storm::property::prctl::Ap<double>("two");
storm::property::prctl::Eventually<double>* eventuallyFormula = new storm::property::prctl::Eventually<double>(apFormula);
@ -114,7 +114,7 @@ TEST(GmmxxMdpPrctModelCheckerTest, Dice) {
std::shared_ptr<storm::models::Mdp<double>> stateRewardMdp = stateRewardParser.getModel<storm::models::Mdp<double>>();
storm::modelchecker::GmmxxMdpPrctlModelChecker<double> stateRewardModelChecker(*stateRewardMdp);
storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<double> stateRewardModelChecker(*stateRewardMdp);
apFormula = new storm::property::prctl::Ap<double>("done");
reachabilityRewardFormula = new storm::property::prctl::ReachabilityReward<double>(apFormula);
@ -144,7 +144,7 @@ TEST(GmmxxMdpPrctModelCheckerTest, Dice) {
std::shared_ptr<storm::models::Mdp<double>> stateAndTransitionRewardMdp = stateAndTransitionRewardParser.getModel<storm::models::Mdp<double>>();
storm::modelchecker::GmmxxMdpPrctlModelChecker<double> stateAndTransitionRewardModelChecker(*stateAndTransitionRewardMdp);
storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<double> stateAndTransitionRewardModelChecker(*stateAndTransitionRewardMdp);
apFormula = new storm::property::prctl::Ap<double>("done");
reachabilityRewardFormula = new storm::property::prctl::ReachabilityReward<double>(apFormula);
@ -180,7 +180,7 @@ TEST(GmmxxMdpPrctModelCheckerTest, AsynchronousLeader) {
ASSERT_EQ(mdp->getNumberOfStates(), 3172u);
ASSERT_EQ(mdp->getNumberOfTransitions(), 7144u);
storm::modelchecker::GmmxxMdpPrctlModelChecker<double> mc(*mdp);
storm::modelchecker::prctl::GmmxxMdpPrctlModelChecker<double> mc(*mdp);
storm::property::prctl::Ap<double>* apFormula = new storm::property::prctl::Ap<double>("elected");
storm::property::prctl::Eventually<double>* eventuallyFormula = new storm::property::prctl::Eventually<double>(apFormula);

4
test/storm-tests.cpp

@ -7,7 +7,7 @@
#include "log4cplus/fileappender.h"
#include "src/utility/Settings.h"
#include "src/modelchecker/GmmxxDtmcPrctlModelChecker.h"
#include "src/modelchecker/prctl/GmmxxDtmcPrctlModelChecker.h"
log4cplus::Logger logger;
@ -37,7 +37,7 @@ void setUpLogging() {
bool parseOptions(int const argc, char const * const argv[]) {
storm::settings::Settings* s = nullptr;
try {
storm::settings::Settings::registerModule<storm::modelchecker::GmmxxDtmcPrctlModelChecker<double>>();
storm::settings::Settings::registerModule<storm::modelchecker::prctl::GmmxxDtmcPrctlModelChecker<double>>();
s = storm::settings::newInstance(argc, argv, nullptr, true);
} catch (storm::exceptions::InvalidSettingsException& e) {
std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl;

|||||||
100:0
Loading…
Cancel
Save