3#include <boost/any.hpp>
17 boost::optional<TimeBound>
const& lowerBound, boost::optional<TimeBound>
const& upperBound,
20 leftSubformula({leftSubformula}),
21 rightSubformula({rightSubformula}),
22 timeBoundReference({timeBoundReference}),
23 lowerBound({lowerBound}),
24 upperBound({upperBound}) {
25 STORM_LOG_THROW(lowerBound || upperBound, storm::exceptions::InvalidArgumentException,
"Bounded until formula requires at least one bound.");
29 std::vector<boost::optional<TimeBound>>
const& lowerBounds, std::vector<boost::optional<TimeBound>>
const& upperBounds,
30 std::vector<TimeBoundReference>
const& timeBoundReferences)
32 leftSubformula({leftSubformula}),
33 rightSubformula({rightSubformula}),
34 timeBoundReference(timeBoundReferences),
35 lowerBound(lowerBounds),
36 upperBound(upperBounds) {
37 assert(timeBoundReferences.size() == upperBound.size());
38 assert(timeBoundReferences.size() == lowerBound.size());
42 std::vector<std::shared_ptr<Formula const>>
const& rightSubformulas,
43 std::vector<boost::optional<TimeBound>>
const& lowerBounds, std::vector<boost::optional<TimeBound>>
const& upperBounds,
44 std::vector<TimeBoundReference>
const& timeBoundReferences)
46 leftSubformula(leftSubformulas),
47 rightSubformula(rightSubformulas),
48 timeBoundReference(timeBoundReferences),
49 lowerBound(lowerBounds),
50 upperBound(upperBounds) {
51 assert(leftSubformula.size() == rightSubformula.size());
52 assert(rightSubformula.size() == timeBoundReference.size());
53 assert(timeBoundReference.size() == lowerBound.size());
54 assert(lowerBound.size() == upperBound.size());
55 STORM_LOG_THROW(this->
getDimension() != 0, storm::exceptions::InvalidArgumentException,
"Bounded until formula requires at least one dimension.");
56 for (
unsigned i = 0; i < timeBoundReferences.size(); ++i) {
58 "Bounded until formula requires at least one bound in each dimension.");
71 return visitor.
visit(*
this, data);
102 referencedRewardModels.insert(
"");
152 assert(timeBoundReference.size() != 0);
153 return timeBoundReference.size() > 1;
157 assert(leftSubformula.size() != 0);
158 assert(leftSubformula.size() == rightSubformula.size());
159 return leftSubformula.size() > 1;
163 return timeBoundReference.size();
167 STORM_LOG_ASSERT(leftSubformula.size() == 1,
"The left subformula is not unique.");
168 return *leftSubformula.at(0);
175 return *leftSubformula.at(i);
180 STORM_LOG_ASSERT(rightSubformula.size() == 1,
"The right subformula is not unique.");
181 return *rightSubformula.at(0);
185 if (rightSubformula.size() == 1 && i <
getDimension()) {
188 return *rightSubformula.at(i);
193 assert(i < timeBoundReference.size());
194 return timeBoundReference.at(i);
198 assert(i < lowerBound.size());
202 return lowerBound.at(i).get().isStrict();
206 for (
auto const& lb : lowerBound) {
207 if (
static_cast<bool>(lb)) {
215 return static_cast<bool>(lowerBound.at(i));
222 return lowerBound.at(i).get().getBound().hasIntegerType();
226 return upperBound.at(i).get().isStrict();
230 for (
auto const& ub : upperBound) {
231 if (
static_cast<bool>(ub)) {
239 return static_cast<bool>(upperBound.at(i));
243 return upperBound.at(i).get().getBound().hasIntegerType();
247 return lowerBound.at(i).get().getBound();
251 return upperBound.at(i).get().getBound();
261 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
269 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
276 return storm::utility::zero<storm::RationalNumber>();
280 STORM_LOG_THROW(bound >= storm::utility::zero<storm::RationalNumber>(), storm::exceptions::InvalidPropertyException,
281 "Time-bound must not evaluate to negative number.");
289 STORM_LOG_THROW(bound >= storm::utility::zero<storm::RationalNumber>(), storm::exceptions::InvalidPropertyException,
290 "Time-bound must not evaluate to negative number.");
301 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
302 return static_cast<uint64_t
>(bound);
309 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
310 return static_cast<uint64_t
>(bound);
315 double bound = getUpperBound<double>(i);
317 "Cannot retrieve non-strict bound from strict zero-bound.");
323 int_fast64_t bound = getUpperBound<uint64_t>(i);
325 STORM_LOG_THROW(bound > 0, storm::exceptions::InvalidPropertyException,
"Cannot retrieve non-strict bound from strict zero-bound.");
334 double bound = getLowerBound<double>(i);
341 int_fast64_t bound = getLowerBound<uint64_t>(i);
351 "Cannot evaluate time-bound '" << bound <<
"' as it contains undefined constants.");
369 if (allowParentheses) {
434 if (allowParentheses) {
int_fast64_t evaluateAsInt(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
double evaluateAsDouble(Valuation const *valuation=nullptr) const
Evaluates the expression under the valuation of variables given by the valuation and returns the resu...
storm::RationalNumber evaluateAsRational() const
Evaluates the expression and returns the resulting rational number.
bool containsVariables() const
Retrieves whether the expression contains a variable.
void gatherVariables(std::set< storm::expressions::Variable > &variables) const
Retrieves the set of all variables that appear in the expression.
std::string const & getRewardName() const
bool isRewardBound() const
RewardAccumulation const & getRewardAccumulation() const
bool hasRewardModelName() const
bool hasRewardAccumulation() const
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_THROW(cond, exception, message)