2#include <boost/any.hpp>
21 boost::any result = f.
accept(*
this, boost::any());
22 return boost::any_cast<std::shared_ptr<Formula>>(result);
26 for (
auto& p : properties) {
40 std::vector<boost::optional<TimeBound>> lowerBounds, upperBounds;
41 std::vector<TimeBoundReference> timeBoundReferences;
46 lowerBounds.emplace_back();
51 upperBounds.emplace_back();
58 timeBoundReferences.push_back(std::move(tbr));
61 std::vector<std::shared_ptr<Formula const>> leftSubformulas, rightSubformulas;
63 leftSubformulas.push_back(boost::any_cast<std::shared_ptr<Formula>>(f.
getLeftSubformula(i).
accept(*
this, data)));
66 return std::static_pointer_cast<Formula>(
67 std::make_shared<BoundedUntilFormula>(leftSubformulas, rightSubformulas, lowerBounds, upperBounds, timeBoundReferences));
69 std::shared_ptr<Formula> left = boost::any_cast<std::shared_ptr<Formula>>(f.
getLeftSubformula().
accept(*
this, data));
70 std::shared_ptr<Formula> right = boost::any_cast<std::shared_ptr<Formula>>(f.
getRightSubformula().
accept(*
this, data));
71 return std::static_pointer_cast<Formula>(std::make_shared<BoundedUntilFormula>(left, right, lowerBounds, upperBounds, timeBoundReferences));
76 boost::optional<storm::logic::RewardAccumulation> rewAcc;
77 STORM_LOG_THROW(!data.empty(), storm::exceptions::UnexpectedException,
"Formula " << f <<
" does not seem to be a subformula of a reward operator.");
78 auto rewName = boost::any_cast<boost::optional<std::string>>(data);
83 std::vector<TimeBound> bounds;
84 std::vector<TimeBoundReference> timeBoundReferences;
92 timeBoundReferences.push_back(std::move(tbr));
94 return std::static_pointer_cast<Formula>(std::make_shared<CumulativeRewardFormula>(bounds, timeBoundReferences, rewAcc));
98 STORM_LOG_THROW(!data.empty(), storm::exceptions::UnexpectedException,
"Formula " << f <<
" does not seem to be a subformula of a reward operator.");
99 auto rewName = boost::any_cast<boost::optional<std::string>>(data);
101 return std::static_pointer_cast<Formula>(std::make_shared<LongRunAverageRewardFormula>());
103 return std::static_pointer_cast<Formula>(std::make_shared<LongRunAverageRewardFormula>(f.
getRewardAccumulation()));
108 std::shared_ptr<Formula> subformula = boost::any_cast<std::shared_ptr<Formula>>(f.
getSubformula().
accept(*
this, data));
120 "Formula " << f <<
" does not seem to be a subformula of a reward operator.");
121 auto rewName = boost::any_cast<boost::optional<std::string>>(data);
127 return std::static_pointer_cast<Formula>(std::make_shared<EventuallyFormula>(subformula, f.
getContext()));
136 STORM_LOG_THROW(!data.empty(), storm::exceptions::UnexpectedException,
"Formula " << f <<
" does not seem to be a subformula of a reward operator.");
137 auto rewName = boost::any_cast<boost::optional<std::string>>(data);
139 return std::static_pointer_cast<Formula>(std::make_shared<TotalRewardFormula>());
141 return std::static_pointer_cast<Formula>(std::make_shared<TotalRewardFormula>(f.
getRewardAccumulation()));
146 boost::optional<std::string> rewardModelName)
const {
147 STORM_LOG_THROW(rewardModelName.is_initialized(), storm::exceptions::InvalidPropertyException,
148 "Unable to find transient variable for unique reward model.");
151 if ((info.hasActionRewards() || info.hasTransitionRewards()) && !accumulation.
isStepsSet()) {
154 if (info.hasStateRewards()) {
std::shared_ptr< storm::logic::Formula const > const & getFormula() const
std::shared_ptr< storm::logic::Formula const > const & getStatesFormula() const
storm::modelchecker::FilterType getFilterType() const
bool isDiscreteTimeModel() const
Determines whether this model is a discrete-time model.
std::set< storm::expressions::Variable > const & getUndefinedConstants() const
std::string const & getName() const
Get the provided name.
std::string const & getComment() const
Get the provided comment, if any.
FilterExpression const & getFilter() const
RewardAccumulationEliminationVisitor(storm::jani::Model const &model)
std::shared_ptr< Formula > eliminateRewardAccumulations(Formula const &f) const
Eliminates any reward accumulations of the formula, where the presence of the reward accumulation doe...
virtual boost::any visit(BoundedUntilFormula const &f, boost::any const &data) const override
std::string const & getRewardName() const
RewardAccumulation const & getRewardAccumulation() const
bool hasRewardAccumulation() const
#define STORM_LOG_THROW(cond, exception, message)