Browse Source

added multiple Visitor methods for gameFormulas

tempestpy_adaptions
Stefan Pranger 4 years ago
committed by Tim Quatmann
parent
commit
7d87a90c1e
  1. 18
      src/storm/logic/CloneVisitor.cpp
  2. 1
      src/storm/logic/CloneVisitor.h
  3. 246
      src/storm/logic/Formula.cpp
  4. 7
      src/storm/logic/Formula.h
  5. 18
      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. 10
      src/storm/logic/FragmentChecker.cpp
  11. 1
      src/storm/logic/FragmentChecker.h
  12. 18
      src/storm/logic/LiftableTransitionRewardsVisitor.cpp
  13. 1
      src/storm/logic/LiftableTransitionRewardsVisitor.h
  14. 36
      src/storm/logic/ToExpressionVisitor.cpp
  15. 1
      src/storm/logic/ToExpressionVisitor.h
  16. 10
      src/storm/storage/jani/JSONExporter.cpp
  17. 1
      src/storm/storage/jani/JSONExporter.h

18
src/storm/logic/CloneVisitor.cpp

@ -76,30 +76,36 @@ namespace storm {
return std::static_pointer_cast<Formula>(std::make_shared<EventuallyFormula>(subformula, f.getContext())); return std::static_pointer_cast<Formula>(std::make_shared<EventuallyFormula>(subformula, f.getContext()));
} }
} }
boost::any CloneVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const { boost::any CloneVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const {
std::shared_ptr<Formula> subformula = boost::any_cast<std::shared_ptr<Formula>>(f.getSubformula().accept(*this, data)); 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<TimeOperatorFormula>(subformula, f.getOperatorInformation())); return std::static_pointer_cast<Formula>(std::make_shared<TimeOperatorFormula>(subformula, f.getOperatorInformation()));
} }
boost::any CloneVisitor::visit(GloballyFormula const& f, boost::any const& data) const { boost::any CloneVisitor::visit(GloballyFormula const& f, boost::any const& data) const {
std::shared_ptr<Formula> subformula = boost::any_cast<std::shared_ptr<Formula>>(f.getSubformula().accept(*this, data)); 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<GloballyFormula>(subformula)); 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 { boost::any CloneVisitor::visit(InstantaneousRewardFormula const& f, boost::any const&) const {
return std::static_pointer_cast<Formula>(std::make_shared<InstantaneousRewardFormula>(f)); return std::static_pointer_cast<Formula>(std::make_shared<InstantaneousRewardFormula>(f));
} }
boost::any CloneVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const { boost::any CloneVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const {
std::shared_ptr<Formula> subformula = boost::any_cast<std::shared_ptr<Formula>>(f.getSubformula().accept(*this, data)); 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<LongRunAverageOperatorFormula>(subformula, f.getOperatorInformation())); return std::static_pointer_cast<Formula>(std::make_shared<LongRunAverageOperatorFormula>(subformula, f.getOperatorInformation()));
} }
boost::any CloneVisitor::visit(LongRunAverageRewardFormula const& f, boost::any const&) const { boost::any CloneVisitor::visit(LongRunAverageRewardFormula const& f, boost::any const&) const {
return std::static_pointer_cast<Formula>(std::make_shared<LongRunAverageRewardFormula>(f)); return std::static_pointer_cast<Formula>(std::make_shared<LongRunAverageRewardFormula>(f));
} }
boost::any CloneVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const { boost::any CloneVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const {
std::vector<std::shared_ptr<Formula const>> subformulas; std::vector<std::shared_ptr<Formula const>> subformulas;
for(auto const& subF : f.getSubformulas()){ for(auto const& subF : f.getSubformulas()){

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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override; virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

246
src/storm/logic/Formula.cpp

@ -14,313 +14,317 @@ namespace storm {
bool Formula::isPathFormula() const { bool Formula::isPathFormula() const {
return false; return false;
} }
bool Formula::isStateFormula() const { bool Formula::isStateFormula() const {
return false; return false;
} }
bool Formula::isMultiObjectiveFormula() const { bool Formula::isMultiObjectiveFormula() const {
return false; return false;
} }
bool Formula::isQuantileFormula() const { bool Formula::isQuantileFormula() const {
return false; return false;
} }
bool Formula::isBinaryStateFormula() const { bool Formula::isBinaryStateFormula() const {
return false; return false;
} }
bool Formula::isUnaryStateFormula() const { bool Formula::isUnaryStateFormula() const {
return false; return false;
} }
bool Formula::isBinaryBooleanStateFormula() const { bool Formula::isBinaryBooleanStateFormula() const {
return false; return false;
} }
bool Formula::isUnaryBooleanStateFormula() const { bool Formula::isUnaryBooleanStateFormula() const {
return false; return false;
} }
bool Formula::isBooleanLiteralFormula() const { bool Formula::isBooleanLiteralFormula() const {
return false; return false;
} }
bool Formula::isTrueFormula() const { bool Formula::isTrueFormula() const {
return false; return false;
} }
bool Formula::isFalseFormula() const { bool Formula::isFalseFormula() const {
return false; return false;
} }
bool Formula::isAtomicExpressionFormula() const { bool Formula::isAtomicExpressionFormula() const {
return false; return false;
} }
bool Formula::isAtomicLabelFormula() const { bool Formula::isAtomicLabelFormula() const {
return false; return false;
} }
bool Formula::isUntilFormula() const { bool Formula::isUntilFormula() const {
return false; return false;
} }
bool Formula::isBoundedUntilFormula() const { bool Formula::isBoundedUntilFormula() const {
return false; return false;
} }
bool Formula::isEventuallyFormula() const { bool Formula::isEventuallyFormula() const {
return false; return false;
} }
bool Formula::isReachabilityProbabilityFormula() const { bool Formula::isReachabilityProbabilityFormula() const {
return false; return false;
} }
bool Formula::isGloballyFormula() const { bool Formula::isGloballyFormula() const {
return false; return false;
} }
bool Formula::isBinaryPathFormula() const { bool Formula::isBinaryPathFormula() const {
return false; return false;
} }
bool Formula::isUnaryPathFormula() const { bool Formula::isUnaryPathFormula() const {
return false; return false;
} }
bool Formula::isConditionalProbabilityFormula() const { bool Formula::isConditionalProbabilityFormula() const {
return false; return false;
} }
bool Formula::isConditionalRewardFormula() const { bool Formula::isConditionalRewardFormula() const {
return false; return false;
} }
bool Formula::isProbabilityPathFormula() const { bool Formula::isProbabilityPathFormula() const {
return false; return false;
} }
bool Formula::isRewardPathFormula() const { bool Formula::isRewardPathFormula() const {
return false; return false;
} }
bool Formula::isTimePathFormula() const { bool Formula::isTimePathFormula() const {
return false; return false;
} }
bool Formula::isNextFormula() const { bool Formula::isNextFormula() const {
return false; return false;
} }
bool Formula::isLongRunAverageOperatorFormula() const { bool Formula::isLongRunAverageOperatorFormula() const {
return false; return false;
} }
bool Formula::isTimeOperatorFormula() const { bool Formula::isTimeOperatorFormula() const {
return false; return false;
} }
bool Formula::isCumulativeRewardFormula() const { bool Formula::isCumulativeRewardFormula() const {
return false; return false;
} }
bool Formula::isInstantaneousRewardFormula() const { bool Formula::isInstantaneousRewardFormula() const {
return false; return false;
} }
bool Formula::isReachabilityRewardFormula() const { bool Formula::isReachabilityRewardFormula() const {
return false; return false;
} }
bool Formula::isLongRunAverageRewardFormula() const { bool Formula::isLongRunAverageRewardFormula() const {
return false; return false;
} }
bool Formula::isTotalRewardFormula() const { bool Formula::isTotalRewardFormula() const {
return false; return false;
} }
bool Formula::isReachabilityTimeFormula() const { bool Formula::isReachabilityTimeFormula() const {
return false; return false;
} }
bool Formula::isGameFormula() const {
return false;
}
bool Formula::isProbabilityOperatorFormula() const { bool Formula::isProbabilityOperatorFormula() const {
return false; return false;
} }
bool Formula::isRewardOperatorFormula() const { bool Formula::isRewardOperatorFormula() const {
return false; return false;
} }
bool Formula::isOperatorFormula() const { bool Formula::isOperatorFormula() const {
return false; return false;
} }
bool Formula::hasQualitativeResult() const { bool Formula::hasQualitativeResult() const {
return true; return true;
} }
bool Formula::hasQuantitativeResult() const { bool Formula::hasQuantitativeResult() const {
return false; return false;
} }
bool Formula::isInFragment(FragmentSpecification const& fragment) const { bool Formula::isInFragment(FragmentSpecification const& fragment) const {
FragmentChecker checker; FragmentChecker checker;
return checker.conformsToSpecification(*this, fragment); return checker.conformsToSpecification(*this, fragment);
} }
FormulaInformation Formula::info() const { FormulaInformation Formula::info() const {
FormulaInformationVisitor visitor; FormulaInformationVisitor visitor;
return visitor.getInformation(*this); return visitor.getInformation(*this);
} }
std::shared_ptr<Formula const> Formula::getTrueFormula() { std::shared_ptr<Formula const> Formula::getTrueFormula() {
return std::shared_ptr<Formula const>(new BooleanLiteralFormula(true)); return std::shared_ptr<Formula const>(new BooleanLiteralFormula(true));
} }
bool Formula::isInitialFormula() const { bool Formula::isInitialFormula() const {
return this->isAtomicLabelFormula() && this->asAtomicLabelFormula().getLabel() == "init"; return this->isAtomicLabelFormula() && this->asAtomicLabelFormula().getLabel() == "init";
} }
PathFormula& Formula::asPathFormula() { PathFormula& Formula::asPathFormula() {
return dynamic_cast<PathFormula&>(*this); return dynamic_cast<PathFormula&>(*this);
} }
PathFormula const& Formula::asPathFormula() const { PathFormula const& Formula::asPathFormula() const {
return dynamic_cast<PathFormula const&>(*this); return dynamic_cast<PathFormula const&>(*this);
} }
StateFormula& Formula::asStateFormula() { StateFormula& Formula::asStateFormula() {
return dynamic_cast<StateFormula&>(*this); return dynamic_cast<StateFormula&>(*this);
} }
StateFormula const& Formula::asStateFormula() const { StateFormula const& Formula::asStateFormula() const {
return dynamic_cast<StateFormula const&>(*this); return dynamic_cast<StateFormula const&>(*this);
} }
MultiObjectiveFormula& Formula::asMultiObjectiveFormula() { MultiObjectiveFormula& Formula::asMultiObjectiveFormula() {
return dynamic_cast<MultiObjectiveFormula&>(*this); return dynamic_cast<MultiObjectiveFormula&>(*this);
} }
MultiObjectiveFormula const& Formula::asMultiObjectiveFormula() const { MultiObjectiveFormula const& Formula::asMultiObjectiveFormula() const {
return dynamic_cast<MultiObjectiveFormula const&>(*this); return dynamic_cast<MultiObjectiveFormula const&>(*this);
} }
QuantileFormula& Formula::asQuantileFormula() { QuantileFormula& Formula::asQuantileFormula() {
return dynamic_cast<QuantileFormula&>(*this); return dynamic_cast<QuantileFormula&>(*this);
} }
QuantileFormula const& Formula::asQuantileFormula() const { QuantileFormula const& Formula::asQuantileFormula() const {
return dynamic_cast<QuantileFormula const&>(*this); return dynamic_cast<QuantileFormula const&>(*this);
} }
BinaryStateFormula& Formula::asBinaryStateFormula() { BinaryStateFormula& Formula::asBinaryStateFormula() {
return dynamic_cast<BinaryStateFormula&>(*this); return dynamic_cast<BinaryStateFormula&>(*this);
} }
BinaryStateFormula const& Formula::asBinaryStateFormula() const { BinaryStateFormula const& Formula::asBinaryStateFormula() const {
return dynamic_cast<BinaryStateFormula const&>(*this); return dynamic_cast<BinaryStateFormula const&>(*this);
} }
UnaryStateFormula& Formula::asUnaryStateFormula() { UnaryStateFormula& Formula::asUnaryStateFormula() {
return dynamic_cast<UnaryStateFormula&>(*this); return dynamic_cast<UnaryStateFormula&>(*this);
} }
UnaryStateFormula const& Formula::asUnaryStateFormula() const { UnaryStateFormula const& Formula::asUnaryStateFormula() const {
return dynamic_cast<UnaryStateFormula const&>(*this); return dynamic_cast<UnaryStateFormula const&>(*this);
} }
ConditionalFormula& Formula::asConditionalFormula() { ConditionalFormula& Formula::asConditionalFormula() {
return dynamic_cast<ConditionalFormula&>(*this); return dynamic_cast<ConditionalFormula&>(*this);
} }
ConditionalFormula const& Formula::asConditionalFormula() const { ConditionalFormula const& Formula::asConditionalFormula() const {
return dynamic_cast<ConditionalFormula const&>(*this); return dynamic_cast<ConditionalFormula const&>(*this);
} }
BinaryBooleanStateFormula& Formula::asBinaryBooleanStateFormula() { BinaryBooleanStateFormula& Formula::asBinaryBooleanStateFormula() {
return dynamic_cast<BinaryBooleanStateFormula&>(*this); return dynamic_cast<BinaryBooleanStateFormula&>(*this);
} }
BinaryBooleanStateFormula const& Formula::asBinaryBooleanStateFormula() const { BinaryBooleanStateFormula const& Formula::asBinaryBooleanStateFormula() const {
return dynamic_cast<BinaryBooleanStateFormula const&>(*this); return dynamic_cast<BinaryBooleanStateFormula const&>(*this);
} }
UnaryBooleanStateFormula& Formula::asUnaryBooleanStateFormula() { UnaryBooleanStateFormula& Formula::asUnaryBooleanStateFormula() {
return dynamic_cast<UnaryBooleanStateFormula&>(*this); return dynamic_cast<UnaryBooleanStateFormula&>(*this);
} }
UnaryBooleanStateFormula const& Formula::asUnaryBooleanStateFormula() const { UnaryBooleanStateFormula const& Formula::asUnaryBooleanStateFormula() const {
return dynamic_cast<UnaryBooleanStateFormula const&>(*this); return dynamic_cast<UnaryBooleanStateFormula const&>(*this);
} }
BooleanLiteralFormula& Formula::asBooleanLiteralFormula() { BooleanLiteralFormula& Formula::asBooleanLiteralFormula() {
return dynamic_cast<BooleanLiteralFormula&>(*this); return dynamic_cast<BooleanLiteralFormula&>(*this);
} }
BooleanLiteralFormula const& Formula::asBooleanLiteralFormula() const { BooleanLiteralFormula const& Formula::asBooleanLiteralFormula() const {
return dynamic_cast<BooleanLiteralFormula const&>(*this); return dynamic_cast<BooleanLiteralFormula const&>(*this);
} }
AtomicExpressionFormula& Formula::asAtomicExpressionFormula() { AtomicExpressionFormula& Formula::asAtomicExpressionFormula() {
return dynamic_cast<AtomicExpressionFormula&>(*this); return dynamic_cast<AtomicExpressionFormula&>(*this);
} }
AtomicExpressionFormula const& Formula::asAtomicExpressionFormula() const { AtomicExpressionFormula const& Formula::asAtomicExpressionFormula() const {
return dynamic_cast<AtomicExpressionFormula const&>(*this); return dynamic_cast<AtomicExpressionFormula const&>(*this);
} }
AtomicLabelFormula& Formula::asAtomicLabelFormula() { AtomicLabelFormula& Formula::asAtomicLabelFormula() {
return dynamic_cast<AtomicLabelFormula&>(*this); return dynamic_cast<AtomicLabelFormula&>(*this);
} }
AtomicLabelFormula const& Formula::asAtomicLabelFormula() const { AtomicLabelFormula const& Formula::asAtomicLabelFormula() const {
return dynamic_cast<AtomicLabelFormula const&>(*this); return dynamic_cast<AtomicLabelFormula const&>(*this);
} }
UntilFormula& Formula::asUntilFormula() { UntilFormula& Formula::asUntilFormula() {
return dynamic_cast<UntilFormula&>(*this); return dynamic_cast<UntilFormula&>(*this);
} }
UntilFormula const& Formula::asUntilFormula() const { UntilFormula const& Formula::asUntilFormula() const {
return dynamic_cast<UntilFormula const&>(*this); return dynamic_cast<UntilFormula const&>(*this);
} }
BoundedUntilFormula& Formula::asBoundedUntilFormula() { BoundedUntilFormula& Formula::asBoundedUntilFormula() {
return dynamic_cast<BoundedUntilFormula&>(*this); return dynamic_cast<BoundedUntilFormula&>(*this);
} }
BoundedUntilFormula const& Formula::asBoundedUntilFormula() const { BoundedUntilFormula const& Formula::asBoundedUntilFormula() const {
return dynamic_cast<BoundedUntilFormula const&>(*this); return dynamic_cast<BoundedUntilFormula const&>(*this);
} }
EventuallyFormula& Formula::asEventuallyFormula() { EventuallyFormula& Formula::asEventuallyFormula() {
return dynamic_cast<EventuallyFormula&>(*this); return dynamic_cast<EventuallyFormula&>(*this);
} }
EventuallyFormula const& Formula::asEventuallyFormula() const { EventuallyFormula const& Formula::asEventuallyFormula() const {
return dynamic_cast<EventuallyFormula const&>(*this); return dynamic_cast<EventuallyFormula const&>(*this);
} }
EventuallyFormula& Formula::asReachabilityRewardFormula() { EventuallyFormula& Formula::asReachabilityRewardFormula() {
return dynamic_cast<EventuallyFormula&>(*this); return dynamic_cast<EventuallyFormula&>(*this);
} }
EventuallyFormula const& Formula::asReachabilityRewardFormula() const { EventuallyFormula const& Formula::asReachabilityRewardFormula() const {
return dynamic_cast<EventuallyFormula const&>(*this); return dynamic_cast<EventuallyFormula const&>(*this);
} }
EventuallyFormula& Formula::asReachabilityProbabilityFormula() { EventuallyFormula& Formula::asReachabilityProbabilityFormula() {
return dynamic_cast<EventuallyFormula&>(*this); return dynamic_cast<EventuallyFormula&>(*this);
} }
EventuallyFormula const& Formula::asReachabilityProbabilityFormula() const { EventuallyFormula const& Formula::asReachabilityProbabilityFormula() const {
return dynamic_cast<EventuallyFormula const&>(*this); return dynamic_cast<EventuallyFormula const&>(*this);
} }
EventuallyFormula& Formula::asReachabilityTimeFormula() { EventuallyFormula& Formula::asReachabilityTimeFormula() {
return dynamic_cast<EventuallyFormula&>(*this); return dynamic_cast<EventuallyFormula&>(*this);
} }
@ -328,160 +332,160 @@ namespace storm {
EventuallyFormula const& Formula::asReachabilityTimeFormula() const { EventuallyFormula const& Formula::asReachabilityTimeFormula() const {
return dynamic_cast<EventuallyFormula const&>(*this); return dynamic_cast<EventuallyFormula const&>(*this);
} }
GloballyFormula& Formula::asGloballyFormula() { GloballyFormula& Formula::asGloballyFormula() {
return dynamic_cast<GloballyFormula&>(*this); return dynamic_cast<GloballyFormula&>(*this);
} }
GloballyFormula const& Formula::asGloballyFormula() const { GloballyFormula const& Formula::asGloballyFormula() const {
return dynamic_cast<GloballyFormula const&>(*this); return dynamic_cast<GloballyFormula const&>(*this);
} }
BinaryPathFormula& Formula::asBinaryPathFormula() { BinaryPathFormula& Formula::asBinaryPathFormula() {
return dynamic_cast<BinaryPathFormula&>(*this); return dynamic_cast<BinaryPathFormula&>(*this);
} }
BinaryPathFormula const& Formula::asBinaryPathFormula() const { BinaryPathFormula const& Formula::asBinaryPathFormula() const {
return dynamic_cast<BinaryPathFormula const&>(*this); return dynamic_cast<BinaryPathFormula const&>(*this);
} }
UnaryPathFormula& Formula::asUnaryPathFormula() { UnaryPathFormula& Formula::asUnaryPathFormula() {
return dynamic_cast<UnaryPathFormula&>(*this); return dynamic_cast<UnaryPathFormula&>(*this);
} }
UnaryPathFormula const& Formula::asUnaryPathFormula() const { UnaryPathFormula const& Formula::asUnaryPathFormula() const {
return dynamic_cast<UnaryPathFormula const&>(*this); return dynamic_cast<UnaryPathFormula const&>(*this);
} }
NextFormula& Formula::asNextFormula() { NextFormula& Formula::asNextFormula() {
return dynamic_cast<NextFormula&>(*this); return dynamic_cast<NextFormula&>(*this);
} }
NextFormula const& Formula::asNextFormula() const { NextFormula const& Formula::asNextFormula() const {
return dynamic_cast<NextFormula const&>(*this); return dynamic_cast<NextFormula const&>(*this);
} }
LongRunAverageOperatorFormula& Formula::asLongRunAverageOperatorFormula() { LongRunAverageOperatorFormula& Formula::asLongRunAverageOperatorFormula() {
return dynamic_cast<LongRunAverageOperatorFormula&>(*this); return dynamic_cast<LongRunAverageOperatorFormula&>(*this);
} }
LongRunAverageOperatorFormula const& Formula::asLongRunAverageOperatorFormula() const { LongRunAverageOperatorFormula const& Formula::asLongRunAverageOperatorFormula() const {
return dynamic_cast<LongRunAverageOperatorFormula const&>(*this); return dynamic_cast<LongRunAverageOperatorFormula const&>(*this);
} }
TimeOperatorFormula& Formula::asTimeOperatorFormula() { TimeOperatorFormula& Formula::asTimeOperatorFormula() {
return dynamic_cast<TimeOperatorFormula&>(*this); return dynamic_cast<TimeOperatorFormula&>(*this);
} }
TimeOperatorFormula const& Formula::asTimeOperatorFormula() const { TimeOperatorFormula const& Formula::asTimeOperatorFormula() const {
return dynamic_cast<TimeOperatorFormula const&>(*this); return dynamic_cast<TimeOperatorFormula const&>(*this);
} }
CumulativeRewardFormula& Formula::asCumulativeRewardFormula() { CumulativeRewardFormula& Formula::asCumulativeRewardFormula() {
return dynamic_cast<CumulativeRewardFormula&>(*this); return dynamic_cast<CumulativeRewardFormula&>(*this);
} }
CumulativeRewardFormula const& Formula::asCumulativeRewardFormula() const { CumulativeRewardFormula const& Formula::asCumulativeRewardFormula() const {
return dynamic_cast<CumulativeRewardFormula const&>(*this); return dynamic_cast<CumulativeRewardFormula const&>(*this);
} }
TotalRewardFormula& Formula::asTotalRewardFormula() { TotalRewardFormula& Formula::asTotalRewardFormula() {
return dynamic_cast<TotalRewardFormula&>(*this); return dynamic_cast<TotalRewardFormula&>(*this);
} }
TotalRewardFormula const& Formula::asTotalRewardFormula() const { TotalRewardFormula const& Formula::asTotalRewardFormula() const {
return dynamic_cast<TotalRewardFormula const&>(*this); return dynamic_cast<TotalRewardFormula const&>(*this);
} }
InstantaneousRewardFormula& Formula::asInstantaneousRewardFormula() { InstantaneousRewardFormula& Formula::asInstantaneousRewardFormula() {
return dynamic_cast<InstantaneousRewardFormula&>(*this); return dynamic_cast<InstantaneousRewardFormula&>(*this);
} }
InstantaneousRewardFormula const& Formula::asInstantaneousRewardFormula() const { InstantaneousRewardFormula const& Formula::asInstantaneousRewardFormula() const {
return dynamic_cast<InstantaneousRewardFormula const&>(*this); return dynamic_cast<InstantaneousRewardFormula const&>(*this);
} }
LongRunAverageRewardFormula& Formula::asLongRunAverageRewardFormula() { LongRunAverageRewardFormula& Formula::asLongRunAverageRewardFormula() {
return dynamic_cast<LongRunAverageRewardFormula&>(*this); return dynamic_cast<LongRunAverageRewardFormula&>(*this);
} }
LongRunAverageRewardFormula const& Formula::asLongRunAverageRewardFormula() const { LongRunAverageRewardFormula const& Formula::asLongRunAverageRewardFormula() const {
return dynamic_cast<LongRunAverageRewardFormula const&>(*this); return dynamic_cast<LongRunAverageRewardFormula const&>(*this);
} }
ProbabilityOperatorFormula& Formula::asProbabilityOperatorFormula() { ProbabilityOperatorFormula& Formula::asProbabilityOperatorFormula() {
return dynamic_cast<ProbabilityOperatorFormula&>(*this); return dynamic_cast<ProbabilityOperatorFormula&>(*this);
} }
ProbabilityOperatorFormula const& Formula::asProbabilityOperatorFormula() const { ProbabilityOperatorFormula const& Formula::asProbabilityOperatorFormula() const {
return dynamic_cast<ProbabilityOperatorFormula const&>(*this); return dynamic_cast<ProbabilityOperatorFormula const&>(*this);
} }
RewardOperatorFormula& Formula::asRewardOperatorFormula() { RewardOperatorFormula& Formula::asRewardOperatorFormula() {
return dynamic_cast<RewardOperatorFormula&>(*this); return dynamic_cast<RewardOperatorFormula&>(*this);
} }
RewardOperatorFormula const& Formula::asRewardOperatorFormula() const { RewardOperatorFormula const& Formula::asRewardOperatorFormula() const {
return dynamic_cast<RewardOperatorFormula const&>(*this); return dynamic_cast<RewardOperatorFormula const&>(*this);
} }
OperatorFormula& Formula::asOperatorFormula() { OperatorFormula& Formula::asOperatorFormula() {
return dynamic_cast<OperatorFormula&>(*this); return dynamic_cast<OperatorFormula&>(*this);
} }
OperatorFormula const& Formula::asOperatorFormula() const { OperatorFormula const& Formula::asOperatorFormula() const {
return dynamic_cast<OperatorFormula const&>(*this); return dynamic_cast<OperatorFormula const&>(*this);
} }
std::vector<std::shared_ptr<AtomicExpressionFormula const>> Formula::getAtomicExpressionFormulas() const { std::vector<std::shared_ptr<AtomicExpressionFormula const>> Formula::getAtomicExpressionFormulas() const {
std::vector<std::shared_ptr<AtomicExpressionFormula const>> result; std::vector<std::shared_ptr<AtomicExpressionFormula const>> result;
this->gatherAtomicExpressionFormulas(result); this->gatherAtomicExpressionFormulas(result);
return result; return result;
} }
std::vector<std::shared_ptr<AtomicLabelFormula const>> Formula::getAtomicLabelFormulas() const { std::vector<std::shared_ptr<AtomicLabelFormula const>> Formula::getAtomicLabelFormulas() const {
std::vector<std::shared_ptr<AtomicLabelFormula const>> result; std::vector<std::shared_ptr<AtomicLabelFormula const>> result;
this->gatherAtomicLabelFormulas(result); this->gatherAtomicLabelFormulas(result);
return result; return result;
} }
std::set<storm::expressions::Variable> Formula::getUsedVariables() const { std::set<storm::expressions::Variable> Formula::getUsedVariables() const {
std::set<storm::expressions::Variable> usedVariables; std::set<storm::expressions::Variable> usedVariables;
this->gatherUsedVariables(usedVariables); this->gatherUsedVariables(usedVariables);
return usedVariables; return usedVariables;
} }
std::set<std::string> Formula::getReferencedRewardModels() const { std::set<std::string> Formula::getReferencedRewardModels() const {
std::set<std::string> referencedRewardModels; std::set<std::string> referencedRewardModels;
this->gatherReferencedRewardModels(referencedRewardModels); this->gatherReferencedRewardModels(referencedRewardModels);
return referencedRewardModels; return referencedRewardModels;
} }
std::shared_ptr<Formula> Formula::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const { std::shared_ptr<Formula> Formula::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const {
storm::expressions::JaniExpressionSubstitutionVisitor<std::map<storm::expressions::Variable, storm::expressions::Expression>> v(substitution); storm::expressions::JaniExpressionSubstitutionVisitor<std::map<storm::expressions::Variable, storm::expressions::Expression>> v(substitution);
return substitute([&v](storm::expressions::Expression const& exp) {return v.substitute(exp);}); return substitute([&v](storm::expressions::Expression const& exp) {return v.substitute(exp);});
} }
std::shared_ptr<Formula> Formula::substitute(std::function<storm::expressions::Expression(storm::expressions::Expression const&)> const& expressionSubstitution) const { std::shared_ptr<Formula> Formula::substitute(std::function<storm::expressions::Expression(storm::expressions::Expression const&)> const& expressionSubstitution) const {
ExpressionSubstitutionVisitor visitor; ExpressionSubstitutionVisitor visitor;
return visitor.substitute(*this, expressionSubstitution); return visitor.substitute(*this, expressionSubstitution);
} }
std::shared_ptr<Formula> Formula::substitute(std::map<std::string, storm::expressions::Expression> const& labelSubstitution) const { std::shared_ptr<Formula> Formula::substitute(std::map<std::string, storm::expressions::Expression> const& labelSubstitution) const {
LabelSubstitutionVisitor visitor(labelSubstitution); LabelSubstitutionVisitor visitor(labelSubstitution);
return visitor.substitute(*this); return visitor.substitute(*this);
} }
std::shared_ptr<Formula> Formula::substitute(std::map<std::string, std::string> const& labelSubstitution) const { std::shared_ptr<Formula> Formula::substitute(std::map<std::string, std::string> const& labelSubstitution) const {
LabelSubstitutionVisitor visitor(labelSubstitution); LabelSubstitutionVisitor visitor(labelSubstitution);
return visitor.substitute(*this); return visitor.substitute(*this);
} }
std::shared_ptr<Formula> Formula::substituteRewardModelNames(std::map<std::string, std::string> const& rewardModelNameSubstitution) const { std::shared_ptr<Formula> Formula::substituteRewardModelNames(std::map<std::string, std::string> const& rewardModelNameSubstitution) const {
RewardModelNameSubstitutionVisitor visitor(rewardModelNameSubstitution); RewardModelNameSubstitutionVisitor visitor(rewardModelNameSubstitution);
return visitor.substitute(*this); return visitor.substitute(*this);
} }
storm::expressions::Expression Formula::toExpression(storm::expressions::ExpressionManager const& manager, std::map<std::string, storm::expressions::Expression> const& labelToExpressionMapping) const { storm::expressions::Expression Formula::toExpression(storm::expressions::ExpressionManager const& manager, std::map<std::string, storm::expressions::Expression> const& labelToExpressionMapping) const {
ToExpressionVisitor visitor; ToExpressionVisitor visitor;
if (labelToExpressionMapping.empty()) { if (labelToExpressionMapping.empty()) {
@ -490,37 +494,37 @@ namespace storm {
return visitor.toExpression(*this->substitute(labelToExpressionMapping), manager); return visitor.toExpression(*this->substitute(labelToExpressionMapping), manager);
} }
} }
std::shared_ptr<Formula const> Formula::asSharedPointer() { std::shared_ptr<Formula const> Formula::asSharedPointer() {
return this->shared_from_this(); return this->shared_from_this();
} }
std::shared_ptr<Formula const> Formula::asSharedPointer() const { std::shared_ptr<Formula const> Formula::asSharedPointer() const {
return this->shared_from_this(); return this->shared_from_this();
} }
void Formula::gatherAtomicExpressionFormulas(std::vector<std::shared_ptr<AtomicExpressionFormula const>>&) const { void Formula::gatherAtomicExpressionFormulas(std::vector<std::shared_ptr<AtomicExpressionFormula const>>&) const {
return; return;
} }
void Formula::gatherAtomicLabelFormulas(std::vector<std::shared_ptr<AtomicLabelFormula const>>&) const { void Formula::gatherAtomicLabelFormulas(std::vector<std::shared_ptr<AtomicLabelFormula const>>&) const {
return; return;
} }
void Formula::gatherReferencedRewardModels(std::set<std::string>&) const { void Formula::gatherReferencedRewardModels(std::set<std::string>&) const {
return; return;
} }
void Formula::gatherUsedVariables(std::set<storm::expressions::Variable>& usedVariables) const { void Formula::gatherUsedVariables(std::set<storm::expressions::Variable>& usedVariables) const {
return; return;
} }
std::string Formula::toString() const { std::string Formula::toString() const {
std::stringstream str2; std::stringstream str2;
writeToStream(str2); writeToStream(str2);
return str2.str(); return str2.str();
} }
std::ostream& operator<<(std::ostream& out, Formula const& formula) { std::ostream& operator<<(std::ostream& out, Formula const& formula) {
return formula.writeToStream(out); return formula.writeToStream(out);
} }

7
src/storm/logic/Formula.h

@ -78,10 +78,13 @@ namespace storm {
virtual bool isReachabilityRewardFormula() const; virtual bool isReachabilityRewardFormula() const;
virtual bool isLongRunAverageRewardFormula() const; virtual bool isLongRunAverageRewardFormula() const;
virtual bool isTotalRewardFormula() const; virtual bool isTotalRewardFormula() const;
// Expected time formulas. // Expected time formulas.
virtual bool isReachabilityTimeFormula() const; virtual bool isReachabilityTimeFormula() const;
// Game formulas.
virtual bool isGameFormula() const;
// Type checks for abstract intermediate classes. // Type checks for abstract intermediate classes.
virtual bool isBinaryPathFormula() const; virtual bool isBinaryPathFormula() const;
virtual bool isBinaryStateFormula() const; virtual bool isBinaryStateFormula() const;

18
src/storm/logic/FormulaInformationVisitor.cpp

@ -60,36 +60,40 @@ namespace storm {
} }
return result; return result;
} }
boost::any FormulaInformationVisitor::visit(EventuallyFormula const& f, boost::any const& data) const { boost::any FormulaInformationVisitor::visit(EventuallyFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); return f.getSubformula().accept(*this, data);
} }
boost::any FormulaInformationVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const { boost::any FormulaInformationVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); return f.getSubformula().accept(*this, data);
} }
boost::any FormulaInformationVisitor::visit(GloballyFormula const& f, boost::any const& data) const { boost::any FormulaInformationVisitor::visit(GloballyFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); 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 { boost::any FormulaInformationVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
return FormulaInformation(); return FormulaInformation();
} }
boost::any FormulaInformationVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const { boost::any FormulaInformationVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const {
FormulaInformation result; FormulaInformation result;
result.setContainsLongRunFormula(true); result.setContainsLongRunFormula(true);
result.join(boost::any_cast<FormulaInformation>(f.getSubformula().accept(*this, data))); result.join(boost::any_cast<FormulaInformation>(f.getSubformula().accept(*this, data)));
return result; return result;
} }
boost::any FormulaInformationVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const { boost::any FormulaInformationVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const {
FormulaInformation result; FormulaInformation result;
result.setContainsLongRunFormula(true); result.setContainsLongRunFormula(true);
return result; return result;
} }
boost::any FormulaInformationVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const { boost::any FormulaInformationVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const {
FormulaInformation result; FormulaInformation result;
for(auto const& subF : f.getSubformulas()){ for(auto const& subF : f.getSubformulas()){

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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula 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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const = 0;
virtual boost::any visit(LongRunAverageRewardFormula 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/BoundedUntilFormula.h"
#include "storm/logic/CumulativeRewardFormula.h" #include "storm/logic/CumulativeRewardFormula.h"
#include "storm/logic/EventuallyFormula.h" #include "storm/logic/EventuallyFormula.h"
#include "storm/logic/GameFormula.h"
#include "storm/logic/GloballyFormula.h" #include "storm/logic/GloballyFormula.h"
#include "storm/logic/InstantaneousRewardFormula.h" #include "storm/logic/InstantaneousRewardFormula.h"
#include "storm/logic/NextFormula.h" #include "storm/logic/NextFormula.h"

1
src/storm/logic/FormulasForwardDeclarations.h

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

10
src/storm/logic/FragmentChecker.cpp

@ -188,12 +188,18 @@ namespace storm {
result && boost::any_cast<bool>(f.getSubformula().accept(*this, data)); result && boost::any_cast<bool>(f.getSubformula().accept(*this, data));
return result; 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 { boost::any FragmentChecker::visit(InstantaneousRewardFormula const&, boost::any const& data) const {
InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data); InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data);
return inherited.getSpecification().areInstantaneousRewardFormulasAllowed(); return inherited.getSpecification().areInstantaneousRewardFormulasAllowed();
} }
boost::any FragmentChecker::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const { boost::any FragmentChecker::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const {
InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data); InheritedInformation const& inherited = boost::any_cast<InheritedInformation const&>(data);
bool result = inherited.getSpecification().areLongRunAverageOperatorsAllowed(); bool result = inherited.getSpecification().areLongRunAverageOperatorsAllowed();

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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override; virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

18
src/storm/logic/LiftableTransitionRewardsVisitor.cpp

@ -62,31 +62,35 @@ namespace storm {
} }
return true; return true;
} }
boost::any LiftableTransitionRewardsVisitor::visit(EventuallyFormula const& f, boost::any const& data) const { boost::any LiftableTransitionRewardsVisitor::visit(EventuallyFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); return f.getSubformula().accept(*this, data);
} }
boost::any LiftableTransitionRewardsVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const { boost::any LiftableTransitionRewardsVisitor::visit(TimeOperatorFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); return f.getSubformula().accept(*this, data);
} }
boost::any LiftableTransitionRewardsVisitor::visit(GloballyFormula const& f, boost::any const& data) const { boost::any LiftableTransitionRewardsVisitor::visit(GloballyFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); 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 { boost::any LiftableTransitionRewardsVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
return true; return true;
} }
boost::any LiftableTransitionRewardsVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const { boost::any LiftableTransitionRewardsVisitor::visit(LongRunAverageOperatorFormula const& f, boost::any const& data) const {
return f.getSubformula().accept(*this, data); return f.getSubformula().accept(*this, data);
} }
boost::any LiftableTransitionRewardsVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const { boost::any LiftableTransitionRewardsVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const {
return true; return true;
} }
boost::any LiftableTransitionRewardsVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const { boost::any LiftableTransitionRewardsVisitor::visit(MultiObjectiveFormula const& f, boost::any const& data) const {
bool result = true; bool result = true;
for (auto const& subF : f.getSubformulas()){ for (auto const& subF : f.getSubformulas()){

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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override; virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

36
src/storm/logic/ToExpressionVisitor.cpp

@ -46,67 +46,71 @@ namespace storm {
} }
return result; return result;
} }
boost::any ToExpressionVisitor::visit(BoundedUntilFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(BoundedUntilFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(ConditionalFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(ConditionalFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(CumulativeRewardFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(CumulativeRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(EventuallyFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(EventuallyFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(TimeOperatorFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(TimeOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(GloballyFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(GloballyFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); 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 { 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."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(LongRunAverageOperatorFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(LongRunAverageOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(MultiObjectiveFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(MultiObjectiveFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(QuantileFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(QuantileFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(NextFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(NextFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(ProbabilityOperatorFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(ProbabilityOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(RewardOperatorFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(RewardOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(TotalRewardFormula const&, boost::any const&) const { boost::any ToExpressionVisitor::visit(TotalRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements."); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Cannot assemble expression from formula that contains illegal elements.");
} }
boost::any ToExpressionVisitor::visit(UnaryBooleanStateFormula const& f, boost::any const& data) const { boost::any ToExpressionVisitor::visit(UnaryBooleanStateFormula const& f, boost::any const& data) const {
storm::expressions::Expression subexpression = boost::any_cast<storm::expressions::Expression>(f.getSubformula().accept(*this, data)); storm::expressions::Expression subexpression = boost::any_cast<storm::expressions::Expression>(f.getSubformula().accept(*this, data));
switch (f.getOperator()) { switch (f.getOperator()) {

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(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(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(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(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(LongRunAverageOperatorFormula const& f, boost::any const& data) const override;
virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override; virtual boost::any visit(LongRunAverageRewardFormula const& f, boost::any const& data) const override;

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

@ -324,18 +324,22 @@ namespace storm {
} }
return opDecl; return opDecl;
} }
boost::any FormulaToJaniJson::visit(storm::logic::GloballyFormula const& f, boost::any const& data) const { boost::any FormulaToJaniJson::visit(storm::logic::GloballyFormula const& f, boost::any const& data) const {
ExportJsonType opDecl; ExportJsonType opDecl;
opDecl["op"] = "G"; opDecl["op"] = "G";
opDecl["exp"] = anyToJson(f.getSubformula().accept(*this, data)); opDecl["exp"] = anyToJson(f.getSubformula().accept(*this, data));
return opDecl; 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 { 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"); STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Jani currently does not support conversion of an instanteneous reward formula");
} }
boost::any FormulaToJaniJson::visit(storm::logic::LongRunAverageOperatorFormula const& f, boost::any const& data) const { boost::any FormulaToJaniJson::visit(storm::logic::LongRunAverageOperatorFormula const& f, boost::any const& data) const {
ExportJsonType opDecl; ExportJsonType opDecl;
if(f.hasBound()) { if(f.hasBound()) {

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::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::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::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::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::InstantaneousRewardFormula const& f, boost::any const& data) const;
virtual boost::any visit(storm::logic::LongRunAverageOperatorFormula const& f, boost::any const& data) const; virtual boost::any visit(storm::logic::LongRunAverageOperatorFormula const& f, boost::any const& data) const;

Loading…
Cancel
Save