@ -164,6 +164,7 @@ namespace storm {
bool BoundedUntilFormula : : isLowerBoundStrict ( unsigned i ) const {
bool BoundedUntilFormula : : isLowerBoundStrict ( unsigned i ) const {
assert ( i < lowerBound . size ( ) ) ;
assert ( i < lowerBound . size ( ) ) ;
if ( ! hasLowerBound ( i ) ) { return false ; }
return lowerBound . at ( i ) . get ( ) . isStrict ( ) ;
return lowerBound . at ( i ) . get ( ) . isStrict ( ) ;
}
}
@ -181,6 +182,7 @@ namespace storm {
}
}
bool BoundedUntilFormula : : hasIntegerLowerBound ( unsigned i ) const {
bool BoundedUntilFormula : : hasIntegerLowerBound ( unsigned i ) const {
if ( ! hasLowerBound ( i ) ) { return true ; }
return lowerBound . at ( i ) . get ( ) . getBound ( ) . hasIntegerType ( ) ;
return lowerBound . at ( i ) . get ( ) . getBound ( ) . hasIntegerType ( ) ;
}
}
@ -215,6 +217,7 @@ namespace storm {
template < >
template < >
double BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
double BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
if ( ! hasLowerBound ( i ) ) { return 0.0 ; }
checkNoVariablesInBound ( this - > getLowerBound ( ) ) ;
checkNoVariablesInBound ( this - > getLowerBound ( ) ) ;
double bound = this - > getLowerBound ( i ) . evaluateAsDouble ( ) ;
double bound = this - > getLowerBound ( i ) . evaluateAsDouble ( ) ;
STORM_LOG_THROW ( bound > = 0 , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
STORM_LOG_THROW ( bound > = 0 , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
@ -231,6 +234,7 @@ namespace storm {
template < >
template < >
storm : : RationalNumber BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
storm : : RationalNumber BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
if ( ! hasLowerBound ( i ) ) { return storm : : utility : : zero < storm : : RationalNumber > ( ) ; }
checkNoVariablesInBound ( this - > getLowerBound ( i ) ) ;
checkNoVariablesInBound ( this - > getLowerBound ( i ) ) ;
storm : : RationalNumber bound = this - > getLowerBound ( i ) . evaluateAsRational ( ) ;
storm : : RationalNumber bound = this - > getLowerBound ( i ) . evaluateAsRational ( ) ;
STORM_LOG_THROW ( bound > = storm : : utility : : zero < storm : : RationalNumber > ( ) , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
STORM_LOG_THROW ( bound > = storm : : utility : : zero < storm : : RationalNumber > ( ) , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
@ -247,6 +251,7 @@ namespace storm {
template < >
template < >
uint64_t BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
uint64_t BoundedUntilFormula : : getLowerBound ( unsigned i ) const {
if ( ! hasLowerBound ( i ) ) { return 0 ; }
checkNoVariablesInBound ( this - > getLowerBound ( i ) ) ;
checkNoVariablesInBound ( this - > getLowerBound ( i ) ) ;
int_fast64_t bound = this - > getLowerBound ( i ) . evaluateAsInt ( ) ;
int_fast64_t bound = this - > getLowerBound ( i ) . evaluateAsInt ( ) ;
STORM_LOG_THROW ( bound > = 0 , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
STORM_LOG_THROW ( bound > = 0 , storm : : exceptions : : InvalidPropertyException , " Time-bound must not evaluate to negative number. " ) ;
@ -278,6 +283,23 @@ namespace storm {
return bound ;
return bound ;
}
}
}
}
template < >
double BoundedUntilFormula : : getNonStrictLowerBound ( unsigned i ) const {
double bound = getLowerBound < double > ( i ) ;
STORM_LOG_THROW ( ! isLowerBoundStrict ( i ) , storm : : exceptions : : InvalidPropertyException , " Cannot retrieve non-strict lower bound from strict lower-bound. " ) ;
return bound ;
}
template < >
uint64_t BoundedUntilFormula : : getNonStrictLowerBound ( unsigned i ) const {
int_fast64_t bound = getLowerBound < uint64_t > ( i ) ;
if ( isLowerBoundStrict ( i ) ) {
return bound + 1 ;
} else {
return bound ;
}
}
void BoundedUntilFormula : : checkNoVariablesInBound ( storm : : expressions : : Expression const & bound ) {
void BoundedUntilFormula : : checkNoVariablesInBound ( storm : : expressions : : Expression const & bound ) {
STORM_LOG_THROW ( ! bound . containsVariables ( ) , storm : : exceptions : : InvalidOperationException , " Cannot evaluate time-bound ' " < < bound < < " ' as it contains undefined constants. " ) ;
STORM_LOG_THROW ( ! bound . containsVariables ( ) , storm : : exceptions : : InvalidOperationException , " Cannot evaluate time-bound ' " < < bound < < " ' as it contains undefined constants. " ) ;