Browse Source

added multiple Visitor methods for gameFormulas

tempestpy_adaptions
Stefan Pranger 4 years ago
committed by Tim Quatmann
parent
commit
7d87a90c1e
  1. 6
      src/storm/logic/CloneVisitor.cpp
  2. 1
      src/storm/logic/CloneVisitor.h
  3. 4
      src/storm/logic/Formula.cpp
  4. 3
      src/storm/logic/Formula.h
  5. 4
      src/storm/logic/FormulaInformationVisitor.cpp
  6. 1
      src/storm/logic/FormulaInformationVisitor.h
  7. 1
      src/storm/logic/FormulaVisitor.h
  8. 1
      src/storm/logic/Formulas.h
  9. 1
      src/storm/logic/FormulasForwardDeclarations.h
  10. 6
      src/storm/logic/FragmentChecker.cpp
  11. 1
      src/storm/logic/FragmentChecker.h
  12. 4
      src/storm/logic/LiftableTransitionRewardsVisitor.cpp
  13. 1
      src/storm/logic/LiftableTransitionRewardsVisitor.h
  14. 4
      src/storm/logic/ToExpressionVisitor.cpp
  15. 1
      src/storm/logic/ToExpressionVisitor.h
  16. 4
      src/storm/storage/jani/JSONExporter.cpp
  17. 1
      src/storm/storage/jani/JSONExporter.h

6
src/storm/logic/CloneVisitor.cpp

@ -87,6 +87,12 @@ namespace storm {
return std::static_pointer_cast<Formula>(std::make_shared<GloballyFormula>(subformula));
}
boost::any CloneVisitor::visit(GameFormula const& f, boost::any const& data) const {
STORM_PRINT_AND_LOG("CloneVisitor called for GameFormula\n");
std::shared_ptr<Formula> subformula = boost::any_cast<std::shared_ptr<Formula>>(f.getSubformula().accept(*this, data));
return std::static_pointer_cast<Formula>(std::make_shared<GameFormula>(f.getCoalition(), subformula));
}
boost::any CloneVisitor::visit(InstantaneousRewardFormula const& f, boost::any const&) const {
return std::static_pointer_cast<Formula>(std::make_shared<InstantaneousRewardFormula>(f));
}

1
src/storm/logic/CloneVisitor.h

@ -22,6 +22,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const override;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

4
src/storm/logic/Formula.cpp

@ -147,6 +147,10 @@ namespace storm {
return false;
}
bool Formula::isGameFormula() const {
return false;
}
bool Formula::isProbabilityOperatorFormula() const {
return false;
}

3
src/storm/logic/Formula.h

@ -82,6 +82,9 @@ namespace storm {
// Expected time formulas.
virtual bool isReachabilityTimeFormula() const;
// Game formulas.
virtual bool isGameFormula() const;
// Type checks for abstract intermediate classes.
virtual bool isBinaryPathFormula() const;
virtual bool isBinaryStateFormula() const;

4
src/storm/logic/FormulaInformationVisitor.cpp

@ -73,6 +73,10 @@ namespace storm {
return f.getSubformula().accept(*this, data);
}
boost::any FormulaInformationVisitor::visit(GameFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data);
}
boost::any FormulaInformationVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
return FormulaInformation();
}

1
src/storm/logic/FormulaInformationVisitor.h

@ -21,6 +21,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const override;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

1
src/storm/logic/FormulaVisitor.h

@ -22,6 +22,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const = 0;

1
src/storm/logic/Formulas.h

@ -8,6 +8,7 @@
#include "storm/logic/BoundedUntilFormula.h"
#include "storm/logic/CumulativeRewardFormula.h"
#include "storm/logic/EventuallyFormula.h"
#include "storm/logic/GameFormula.h"
#include "storm/logic/GloballyFormula.h"
#include "storm/logic/InstantaneousRewardFormula.h"
#include "storm/logic/NextFormula.h"

1
src/storm/logic/FormulasForwardDeclarations.h

@ -17,6 +17,7 @@ namespace storm {
class EventuallyFormula;
class TimeOperatorFormula;
class GloballyFormula;
class GameFormula;
class InstantaneousRewardFormula;
class LongRunAverageOperatorFormula;
class LongRunAverageRewardFormula;

6
src/storm/logic/FragmentChecker.cpp

@ -189,6 +189,12 @@ namespace storm {
return result;
}
boost::any FragmentChecker::visit(GameFormula const& f, boost::any const& data) const {
InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data);
bool result = inherited.getSpecification().areCoalitionOperatorsAllowed();
return result && boost::any_cast<bool>(f.getSubformula().accept(*this, data));
}
boost::any FragmentChecker::visit(InstantaneousRewardFormula const&, boost::any const& data) const {
InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data);
return inherited.getSpecification().areInstantaneousRewardFormulasAllowed();

1
src/storm/logic/FragmentChecker.h

@ -22,6 +22,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const override;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

4
src/storm/logic/LiftableTransitionRewardsVisitor.cpp

@ -75,6 +75,10 @@ namespace storm {
return f.getSubformula().accept(*this, data);
}
boost::any LiftableTransitionRewardsVisitor::visit(GameFormula const& f, boost::any const& data) const {
return true;
}
boost::any LiftableTransitionRewardsVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
return true;
}

1
src/storm/logic/LiftableTransitionRewardsVisitor.h

@ -28,6 +28,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const override;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

4
src/storm/logic/ToExpressionVisitor.cpp

@ -71,6 +71,10 @@ namespace storm {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
}
boost::any ToExpressionVisitor::visit(GameFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
}
boost::any ToExpressionVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
}

1
src/storm/logic/ToExpressionVisitor.h

@ -22,6 +22,7 @@ namespace storm {
virtual boost::any visit(EventuallyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(TimeOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(GameFormula const& f, boost::any const& data) const override;
virtual boost::any visit(InstantaneousRewardFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

4
src/storm/storage/jani/JSONExporter.cpp

@ -332,6 +332,10 @@ namespace storm {
return opDecl;
}
boost::any FormulaToJaniJson::visit(storm::logic::GameFormula const& f, boost::any const& data) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "We currently do not support conversion of game formulas to Jani. (Does jani support games?)");
}
boost::any FormulaToJaniJson::visit(storm::logic::InstantaneousRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Jani currently does not support conversion of an instanteneous reward formula");
}

1
src/storm/storage/jani/JSONExporter.h

@ -57,6 +57,7 @@ namespace storm {
virtual boost::any visit(storm::logic::CumulativeRewardFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::EventuallyFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::TimeOperatorFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::GameFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::GloballyFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::InstantaneousRewardFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::LongRunAverageOperatorFormula const& f, boost::any const& data) const;

Loading…
Cancel
Save