@ -12,6 +12,7 @@ namespace storm { namespace modelChecker {
template < class Type > class AbstractModelChecker ;
} }
# include "src/exceptions/InvalidPropertyException.h"
# include "src/formula/Formulas.h"
# include "src/storage/BitVector.h"
@ -42,7 +43,8 @@ class AbstractModelChecker :
public virtual storm : : formula : : IBoundedUntilModelChecker < Type > ,
public virtual storm : : formula : : IBoundedEventuallyModelChecker < Type > ,
public virtual storm : : formula : : INoBoundOperatorModelChecker < Type > ,
public virtual storm : : formula : : IPathBoundOperatorModelChecker < Type > ,
public virtual storm : : formula : : IProbabilisticBoundOperatorModelChecker < Type > ,
public virtual storm : : formula : : IRewardBoundOperatorModelChecker < Type > ,
public virtual storm : : formula : : IReachabilityRewardModelChecker < Type > ,
public virtual storm : : formula : : ICumulativeRewardModelChecker < Type > ,
public virtual storm : : formula : : IInstantaneousRewardModelChecker < Type > {
@ -58,6 +60,100 @@ public:
}
return nullptr ;
}
/*!
* The check method for a state formula with an And node as root in its formula tree
*
* @ param formula The And formula to check
* @ returns The set of states satisfying the formula , represented by a bit vector
*/
storm : : storage : : BitVector * checkAnd ( const storm : : formula : : And < Type > & formula ) const {
storm : : storage : : BitVector * result = formula . getLeft ( ) . check ( * this ) ;
storm : : storage : : BitVector * right = formula . getRight ( ) . check ( * this ) ;
( * result ) & = ( * right ) ;
delete right ;
return result ;
}
/*!
* The check method for a formula with a Not node as root in its formula tree
*
* @ param formula The Not state formula to check
* @ returns The set of states satisfying the formula , represented by a bit vector
*/
storm : : storage : : BitVector * checkNot ( const storm : : formula : : Not < Type > & formula ) const {
storm : : storage : : BitVector * result = formula . getChild ( ) . check ( * this ) ;
result - > complement ( ) ;
return result ;
}
/*!
* The check method for a state formula with an Or node as root in its formula tree
*
* @ param formula The Or state formula to check
* @ returns The set of states satisfying the formula , represented by a bit vector
*/
virtual storm : : storage : : BitVector * checkOr ( const storm : : formula : : Or < Type > & formula ) const {
storm : : storage : : BitVector * result = formula . getLeft ( ) . check ( * this ) ;
storm : : storage : : BitVector * right = formula . getRight ( ) . check ( * this ) ;
( * result ) | = ( * right ) ;
delete right ;
return result ;
}
/*!
* The check method for a state formula with a bound operator node as root in
* its formula tree
*
* @ param formula The state formula to check
* @ returns The set of states satisfying the formula , represented by a bit vector
*/
storm : : storage : : BitVector * checkProbabilisticBoundOperator ( const storm : : formula : : ProbabilisticBoundOperator < Type > & formula ) const {
/ / First , we need to compute the probability for satisfying the path formula for each state .
std : : vector < Type > * quantitativeResult = formula . getPathFormula ( ) . check ( * this ) ;
/ / Create resulting bit vector , which will hold the yes / no - answer for every state .
storm : : storage : : BitVector * result = new storm : : storage : : BitVector ( quantitativeResult - > size ( ) ) ;
/ / Now , we can compute which states meet the bound specified in this operator and set the
/ / corresponding bits to true in the resulting vector .
for ( uint_fast64_t i = 0 ; i < quantitativeResult - > size ( ) ; + + i ) {
if ( formula . meetsBound ( ( * quantitativeResult ) [ i ] ) ) {
result - > set ( i , true ) ;
}
}
/ / Delete the probabilities computed for the states and return result .
delete quantitativeResult ;
return result ;
}
/*!
* The check method for a state formula with a bound operator node as root in
* its formula tree
*
* @ param formula The state formula to check
* @ returns The set of states satisfying the formula , represented by a bit vector
*/
storm : : storage : : BitVector * checkRewardBoundOperator ( const storm : : formula : : RewardBoundOperator < Type > & formula ) const {
/ / First , we need to compute the probability for satisfying the path formula for each state .
std : : vector < Type > * quantitativeResult = formula . getPathFormula ( ) . check ( * this ) ;
/ / Create resulting bit vector , which will hold the yes / no - answer for every state .
storm : : storage : : BitVector * result = new storm : : storage : : BitVector ( quantitativeResult - > size ( ) ) ;
/ / Now , we can compute which states meet the bound specified in this operator and set the
/ / corresponding bits to true in the resulting vector .
for ( uint_fast64_t i = 0 ; i < quantitativeResult - > size ( ) ; + + i ) {
if ( formula . meetsBound ( ( * quantitativeResult ) [ i ] ) ) {
result - > set ( i , true ) ;
}
}
/ / Delete the probabilities computed for the states and return result .
delete quantitativeResult ;
return result ;
}
} ;
} / / namespace modelChecker