Browse Source

Correct formulas

main
Lanchid 12 years ago
parent
commit
3e554514cb
  1. 2
      src/formula/AbstractFormulaChecker.h
  2. 8
      src/formula/Prctl/And.h
  3. 4
      src/formula/Prctl/Ap.h
  4. 6
      src/formula/Prctl/BoundedEventually.h
  5. 6
      src/formula/Prctl/BoundedNaryUntil.h
  6. 14
      src/formula/Prctl/BoundedUntil.h
  7. 4
      src/formula/Prctl/Eventually.h
  8. 6
      src/formula/Prctl/Globally.h
  9. 4
      src/formula/Prctl/InstantaneousReward.h
  10. 4
      src/formula/Prctl/Next.h
  11. 4
      src/formula/Prctl/Not.h
  12. 8
      src/formula/Prctl/Or.h
  13. 18
      src/formula/Prctl/ProbabilisticBoundOperator.h
  14. 1
      src/formula/Prctl/ProbabilisticNoBoundOperator.h
  15. 4
      src/formula/Prctl/ReachabilityReward.h
  16. 14
      src/formula/Prctl/RewardBoundOperator.h
  17. 25
      src/formula/Prctl/RewardNoBoundOperator.h
  18. 8
      src/formula/Prctl/Until.h
  19. 2
      src/formula/PrctlFormulaChecker.h
  20. 8
      src/formula/abstract/AbstractFormula.h

2
src/formula/AbstractFormulaChecker.h

@ -1,7 +1,7 @@
#ifndef STORM_FORMULA_ABSTRACTFORMULACHECKER_H_
#define STORM_FORMULA_ABSTRACTFORMULACHECKER_H_
#include "src/formula/AbstractFormula.h"
#include "src/formula/abstract/AbstractFormula.h"
namespace storm {
namespace formula {

8
src/formula/Prctl/And.h

@ -96,11 +96,11 @@ public:
*/
virtual AbstractStateFormula<T>* clone() const {
And<T>* result = new And();
if (this->left != NULL) {
result->setLeft(left->clone());
if (this->leftIsSet()) {
result->setLeft(this->getLeft().clone());
}
if (this->right != NULL) {
result->setRight(right->clone());
if (this->rightIsSet()) {
result->setRight(this->getRight().clone());
}
return result;
}

4
src/formula/Prctl/Ap.h

@ -47,7 +47,7 @@ class IApModelChecker {
* @see AbstractFormula
*/
template <class T>
class Ap : public storm::formula::abstract::Ap<T>, public AbstractFormula<T> {
class Ap : public storm::formula::abstract::Ap<T>, public AbstractStateFormula<T> {
public:
/*!
@ -78,7 +78,7 @@ public:
* @returns a new AND-object that is identical the called object.
*/
virtual AbstractStateFormula<T>* clone() const {
return new Ap(getAp());
return new Ap(this->getAp());
}
/*!

6
src/formula/Prctl/BoundedEventually.h

@ -97,9 +97,9 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
BoundedEventually<T>* result = new BoundedEventually<T>();
result->setBound(bound);
if (child != nullptr) {
result->setChild(child->clone());
result->setBound(this->getBound());
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

6
src/formula/Prctl/BoundedNaryUntil.h

@ -105,10 +105,10 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
BoundedNaryUntil<T>* result = new BoundedNaryUntil<T>();
if (left != NULL) {
result->setLeft(left->clone());
if (this->leftIsSet()) {
result->setLeft(this->getLeft().clone());
}
if (right != NULL) {
if (this->rightIsSet()) {
std::vector<std::tuple<AbstractStateFormula<T>*,T,T>>* newright = new std::vector<std::tuple<AbstractStateFormula<T>*,T,T>>();
for (auto it = this->right->begin(); it != this->right->end(); ++it) {
newright->push_back(std::tuple<AbstractStateFormula<T>*,T,T>(std::get<0>(*it)->clone(), std::get<1>(*it), std::get<2>(*it)));

14
src/formula/Prctl/BoundedUntil.h

@ -56,7 +56,7 @@ class IBoundedUntilModelChecker {
* @see AbstractFormula
*/
template <class T>
class BoundedUntil : public storm::formula::abstract::BoundedUntil<T, AbstractStateFormula>,
class BoundedUntil : public storm::formula::abstract::BoundedUntil<T, AbstractStateFormula<T>>,
public AbstractPathFormula<T> {
public:
@ -76,7 +76,7 @@ public:
*/
BoundedUntil(AbstractStateFormula<T>* left, AbstractStateFormula<T>* right,
uint_fast64_t bound) :
storm::formula::abstract::BoundedUntil<T, AbstractStateFormula>(left,right,bound) {
storm::formula::abstract::BoundedUntil<T, AbstractStateFormula<T>>(left,right,bound) {
//intentionally left empty
}
@ -99,12 +99,12 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
BoundedUntil<T>* result = new BoundedUntil<T>();
result->setBound(bound);
if (left != NULL) {
result->setLeft(left->clone());
result->setBound(this->getBound());
if (this->leftIsSet()) {
result->setLeft(this->getLeft().clone());
}
if (right != NULL) {
result->setRight(right->clone());
if (this->rightIsSet()) {
result->setRight(this->getRight().clone());
}
return result;
}

4
src/formula/Prctl/Eventually.h

@ -93,8 +93,8 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
Eventually<T>* result = new Eventually<T>();
if (child != nullptr) {
result->setChild(child);
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

6
src/formula/Prctl/Globally.h

@ -94,9 +94,9 @@ public:
* @returns a new Globally-object that is identical the called object.
*/
virtual AbstractPathFormula<T>* clone() const {
Next<T>* result = new Next<T>();
if (child != nullptr) {
result->setChild(child);
Globally<T>* result = new Globally<T>();
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

4
src/formula/Prctl/InstantaneousReward.h

@ -50,7 +50,7 @@ class IInstantaneousRewardModelChecker {
* @see AbstractFormula
*/
template <class T>
class InstantaneousReward : public storm::formula::abstract::InstantaneousReward,
class InstantaneousReward : public storm::formula::abstract::InstantaneousReward<T>,
public AbstractPathFormula<T> {
public:
@ -86,7 +86,7 @@ public:
* @returns a new InstantaneousReward-object that is identical the called object.
*/
virtual AbstractPathFormula<T>* clone() const {
return new InstantaneousReward(bound);
return new InstantaneousReward(this->getBound());
}

4
src/formula/Prctl/Next.h

@ -93,8 +93,8 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
Next<T>* result = new Next<T>();
if (child != NULL) {
result->setChild(child);
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

4
src/formula/Prctl/Not.h

@ -89,8 +89,8 @@ public:
*/
virtual AbstractStateFormula<T>* clone() const {
Not<T>* result = new Not<T>();
if (child != NULL) {
result->setChild(getChild().clone());
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

8
src/formula/Prctl/Or.h

@ -95,11 +95,11 @@ public:
*/
virtual AbstractStateFormula<T>* clone() const {
Or<T>* result = new Or();
if (this->left != NULL) {
result->setLeft(getLeft().clone());
if (this->leftIsSet()) {
result->setLeft(this->getLeft().clone());
}
if (this->right != NULL) {
result->setRight(getLeft().clone());
if (this->rightIsSet()) {
result->setRight(this->getRight().clone());
}
return result;
}

18
src/formula/Prctl/ProbabilisticBoundOperator.h

@ -54,14 +54,13 @@ class IProbabilisticBoundOperatorModelChecker {
*/
template<class T>
class ProbabilisticBoundOperator : public storm::formula::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>,
public AbstractStateFormula {
public AbstractStateFormula<T> {
public:
/*!
* Empty constructor
*/
ProbabilisticBoundOperator() : PathBoundOperator<T>
(PathBoundOperator<T>::LESS_EQUAL, storm::utility::constGetZero<T>(), nullptr) {
ProbabilisticBoundOperator() {
// Intentionally left empty
}
@ -74,8 +73,10 @@ public:
* @param pathFormula The child node
*/
ProbabilisticBoundOperator(
typename storm::formula::abstract::PathBoundOperator<T>::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula)
: storm::formula::abstract::ProbabilisticBoundOperator<T>(comparisonRelation, bound, pathFormula) {
typename storm::formula::abstract::PathBoundOperator<T, AbstractPathFormula<T>>::ComparisonType comparisonRelation,
T bound,
AbstractPathFormula<T>* pathFormula)
: storm::formula::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula) {
// Intentionally left empty
}
@ -87,8 +88,11 @@ public:
* @param minimumOperator
*/
ProbabilisticBoundOperator(
typename storm::formula::abstract::PathBoundOperator<T>::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula, bool minimumOperator)
: storm::formula::abstract::ProbabilisticBoundOperator<T>(comparisonRelation, bound, pathFormula, minimumOperator){
typename storm::formula::abstract::PathBoundOperator<T, AbstractPathFormula<T>>::ComparisonType comparisonRelation,
T bound,
AbstractPathFormula<T>* pathFormula,
bool minimumOperator)
: storm::formula::abstract::ProbabilisticBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula, minimumOperator){
// Intentionally left empty
}

1
src/formula/Prctl/ProbabilisticNoBoundOperator.h

@ -8,7 +8,6 @@
#ifndef STORM_FORMULA_PRCTL_PROBABILISTICNOBOUNDOPERATOR_H_
#define STORM_FORMULA_PRCTL_PROBABILISTICNOBOUNDOPERATOR_H_
#include "AbstractFormula.h"
#include "AbstractPathFormula.h"
#include "src/formula/abstract/ProbabilisticNoBoundOperator.h"

4
src/formula/Prctl/ReachabilityReward.h

@ -90,8 +90,8 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
ReachabilityReward<T>* result = new ReachabilityReward<T>();
if (getChild() != nullptr) {
result->setChild(*getChild());
if (this->childIsSet()) {
result->setChild(this->getChild().clone());
}
return result;
}

14
src/formula/Prctl/RewardBoundOperator.h

@ -57,11 +57,14 @@ public:
* @param pathFormula The child node
*/
RewardBoundOperator(
typename storm::formula::abstract::PathBoundOperator<T>::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula) :
storm::formula::abstract::RewardBoundOperator<T>(comparisonRelation, bound, pathFormula) {
typename storm::formula::abstract::PathBoundOperator<T, AbstractPathFormula<T>>::ComparisonType comparisonRelation,
T bound,
AbstractPathFormula<T>* pathFormula) :
storm::formula::abstract::RewardBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula) {
// Intentionally left empty
}
/*!
* Constructor
*
@ -71,8 +74,11 @@ public:
* @param minimumOperator
*/
RewardBoundOperator(
typename PathBoundOperator<T>::ComparisonType comparisonRelation, T bound, AbstractPathFormula<T>* pathFormula, bool minimumOperator)
: PathBoundOperator<T>(comparisonRelation, bound, pathFormula, minimumOperator) {
typename storm::formula::abstract::PathBoundOperator<T, AbstractPathFormula<T>>::ComparisonType comparisonRelation,
T bound,
AbstractPathFormula<T>* pathFormula,
bool minimumOperator)
: storm::formula::abstract::RewardBoundOperator<T, AbstractPathFormula<T>>(comparisonRelation, bound, pathFormula, minimumOperator) {
// Intentionally left empty
}

25
src/formula/Prctl/RewardNoBoundOperator.h

@ -8,8 +8,8 @@
#ifndef STORM_FORMULA_PRCTL_REWARDNOBOUNDOPERATOR_H_
#define STORM_FORMULA_PRCTL_REWARDNOBOUNDOPERATOR_H_
#include "AbstractFormula.h"
#include "PathNoBoundOperator.h"
#include "AbstractPathFormula.h"
#include "src/formula/abstract/RewardNoBoundOperator.h"
namespace storm {
namespace formula {
@ -45,13 +45,13 @@ namespace prctl {
* @see ProbabilisticIntervalOperator
* @see AbstractFormula
*/
template <class T, class FormulaType>
class RewardNoBoundOperator: public PathNoBoundOperator<T, FormulaType> {
template <class T>
class RewardNoBoundOperator: public storm::formula::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>> {
public:
/*!
* Empty constructor
*/
RewardNoBoundOperator() : PathNoBoundOperator<T>(nullptr) {
RewardNoBoundOperator() {
// Intentionally left empty
}
@ -60,7 +60,8 @@ public:
*
* @param pathFormula The child node.
*/
RewardNoBoundOperator(FormulaType* pathFormula) : PathNoBoundOperator<T>(pathFormula) {
RewardNoBoundOperator(AbstractPathFormula<T>* pathFormula)
: storm::formula::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula) {
// Intentionally left empty
}
@ -69,18 +70,12 @@ public:
*
* @param pathFormula The child node.
*/
RewardNoBoundOperator(FormulaType* pathFormula, bool minimumOperator) : PathNoBoundOperator<T>(pathFormula, minimumOperator) {
RewardNoBoundOperator(AbstractPathFormula<T>* pathFormula, bool minimumOperator)
: storm::formula::abstract::RewardNoBoundOperator<T, AbstractPathFormula<T>>(pathFormula, minimumOperator) {
// Intentionally left empty
}
/*!
* @returns a string representation of the formula
*/
virtual std::string toString() const {
std::string result = "R";
result += PathNoBoundOperator<T>::toString();
return result;
}
//TODO: Clone?
};
} //namespace prctl

8
src/formula/Prctl/Until.h

@ -95,11 +95,11 @@ public:
*/
virtual AbstractPathFormula<T>* clone() const {
Until<T>* result = new Until();
if (left != NULL) {
result->setLeft(left->clone());
if (this->leftIsSet()) {
result->setLeft(this->getLeft().clone());
}
if (right != NULL) {
result->setRight(right->clone());
if (this->rightIsSet()) {
result->setRight(this->getRight().clone());
}
return result;
}

2
src/formula/PrctlFormulaChecker.h

@ -2,7 +2,7 @@
#define STORM_FORMULA_PRCTLFORMULACHECKER_H_
#include "src/formula/AbstractFormulaChecker.h"
#include "src/formula/Formulas.h"
#include "src/formula/Prctl.h"
#include <iostream>

8
src/formula/abstract/AbstractFormula.h

@ -10,14 +10,6 @@
#include <string>
namespace storm {
namespace formula {
namespace abstract {
template <class T> class AbstractFormula;
}
}
}
#include "src/modelchecker/ForwardDeclarations.h"
#include "src/formula/AbstractFormulaChecker.h"

Loading…
Cancel
Save