2#include <boost/any.hpp>
19 boost::optional<TimeBound>
const& lowerBound, boost::optional<TimeBound>
const& upperBound,
22 leftSubformula({leftSubformula}),
23 rightSubformula({rightSubformula}),
24 timeBoundReference({timeBoundReference}),
25 lowerBound({lowerBound}),
26 upperBound({upperBound}) {
27 STORM_LOG_THROW(lowerBound || upperBound, storm::exceptions::InvalidArgumentException,
"Bounded until formula requires at least one bound.");
31 std::vector<boost::optional<TimeBound>>
const& lowerBounds, std::vector<boost::optional<TimeBound>>
const& upperBounds,
32 std::vector<TimeBoundReference>
const& timeBoundReferences)
34 leftSubformula({leftSubformula}),
35 rightSubformula({rightSubformula}),
36 timeBoundReference(timeBoundReferences),
37 lowerBound(lowerBounds),
38 upperBound(upperBounds) {
39 assert(timeBoundReferences.size() == upperBound.size());
40 assert(timeBoundReferences.size() == lowerBound.size());
44 std::vector<std::shared_ptr<Formula const>>
const& rightSubformulas,
45 std::vector<boost::optional<TimeBound>>
const& lowerBounds, std::vector<boost::optional<TimeBound>>
const& upperBounds,
46 std::vector<TimeBoundReference>
const& timeBoundReferences)
48 leftSubformula(leftSubformulas),
49 rightSubformula(rightSubformulas),
50 timeBoundReference(timeBoundReferences),
51 lowerBound(lowerBounds),
52 upperBound(upperBounds) {
53 assert(leftSubformula.size() == rightSubformula.size());
54 assert(rightSubformula.size() == timeBoundReference.size());
55 assert(timeBoundReference.size() == lowerBound.size());
56 assert(lowerBound.size() == upperBound.size());
57 STORM_LOG_THROW(this->
getDimension() != 0, storm::exceptions::InvalidArgumentException,
"Bounded until formula requires at least one dimension.");
58 for (
unsigned i = 0; i < timeBoundReferences.size(); ++i) {
60 "Bounded until formula requires at least one bound in each dimension.");
73 return visitor.
visit(*
this, data);
104 referencedRewardModels.insert(
"");
154 assert(timeBoundReference.size() != 0);
155 return timeBoundReference.size() > 1;
159 assert(leftSubformula.size() != 0);
160 assert(leftSubformula.size() == rightSubformula.size());
161 return leftSubformula.size() > 1;
165 return timeBoundReference.size();
169 STORM_LOG_ASSERT(leftSubformula.size() == 1,
"The left subformula is not unique.");
170 return *leftSubformula.at(0);
177 return *leftSubformula.at(i);
182 STORM_LOG_ASSERT(rightSubformula.size() == 1,
"The right subformula is not unique.");
183 return *rightSubformula.at(0);
187 if (rightSubformula.size() == 1 && i <
getDimension()) {
190 return *rightSubformula.at(i);
195 assert(i < timeBoundReference.size());
196 return timeBoundReference.at(i);
200 assert(i < lowerBound.size());
204 return lowerBound.at(i).get().isStrict();
208 for (
auto const& lb : lowerBound) {
209 if (
static_cast<bool>(lb)) {
217 return static_cast<bool>(lowerBound.at(i));
224 return lowerBound.at(i).get().getBound().hasIntegerType();
228 return upperBound.at(i).get().isStrict();
232 for (
auto const& ub : upperBound) {
233 if (
static_cast<bool>(ub)) {
241 return static_cast<bool>(upperBound.at(i));
245 return upperBound.at(i).get().getBound().hasIntegerType();
249 return lowerBound.at(i).get().getBound();
253 return upperBound.at(i).get().getBound();
263 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
271 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
278 return storm::utility::zero<storm::RationalNumber>();
282 STORM_LOG_THROW(bound >= storm::utility::zero<storm::RationalNumber>(), storm::exceptions::InvalidPropertyException,
283 "Time-bound must not evaluate to negative number.");
291 STORM_LOG_THROW(bound >= storm::utility::zero<storm::RationalNumber>(), storm::exceptions::InvalidPropertyException,
292 "Time-bound must not evaluate to negative number.");
303 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
304 return static_cast<uint64_t
>(bound);
311 STORM_LOG_THROW(bound >= 0, storm::exceptions::InvalidPropertyException,
"Time-bound must not evaluate to negative number.");
312 return static_cast<uint64_t
>(bound);
317 double bound = getUpperBound<double>(i);
319 "Cannot retrieve non-strict bound from strict zero-bound.");
325 int_fast64_t bound = getUpperBound<uint64_t>(i);
327 STORM_LOG_THROW(bound > 0, storm::exceptions::InvalidPropertyException,
"Cannot retrieve non-strict bound from strict zero-bound.");
336 double bound = getLowerBound<double>(i);
343 int_fast64_t bound = getLowerBound<uint64_t>(i);
353 "Cannot evaluate time-bound '" << bound <<
"' as it contains undefined constants.");
371 if (allowParentheses) {
436 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)