@ -7,9 +7,11 @@
# include "storm/modelchecker/results/ExplicitQualitativeCheckResult.h"
# include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h"
# include "storm/modelchecker/results/ExplicitParetoCurveCheckResult.h"
# include "storm/modelchecker/prctl/helper/SparseDtmcPrctlHelper.h"
# include "storm/modelchecker/csl/helper/SparseCtmcCslHelper.h"
# include "storm/modelchecker/prctl/helper/rewardbounded/QuantileHelper.h"
# include "storm/logic/FragmentSpecification.h"
@ -31,7 +33,13 @@ namespace storm {
template < typename SparseDtmcModelType >
bool SparseDtmcPrctlModelChecker < SparseDtmcModelType > : : canHandle ( CheckTask < storm : : logic : : Formula , ValueType > const & checkTask ) const {
storm : : logic : : Formula const & formula = checkTask . getFormula ( ) ;
return formula . isInFragment ( storm : : logic : : prctl ( ) . setLongRunAverageRewardFormulasAllowed ( true ) . setLongRunAverageProbabilitiesAllowed ( true ) . setConditionalProbabilityFormulasAllowed ( true ) . setConditionalRewardFormulasAllowed ( true ) . setTotalRewardFormulasAllowed ( true ) . setOnlyEventuallyFormuluasInConditionalFormulasAllowed ( true ) . setRewardBoundedUntilFormulasAllowed ( true ) . setRewardBoundedCumulativeRewardFormulasAllowed ( true ) . setMultiDimensionalBoundedUntilFormulasAllowed ( true ) . setMultiDimensionalCumulativeRewardFormulasAllowed ( true ) . setTimeOperatorsAllowed ( true ) . setReachbilityTimeFormulasAllowed ( true ) ) ;
if ( formula . isInFragment ( storm : : logic : : prctl ( ) . setLongRunAverageRewardFormulasAllowed ( true ) . setLongRunAverageProbabilitiesAllowed ( true ) . setConditionalProbabilityFormulasAllowed ( true ) . setConditionalRewardFormulasAllowed ( true ) . setTotalRewardFormulasAllowed ( true ) . setOnlyEventuallyFormuluasInConditionalFormulasAllowed ( true ) . setRewardBoundedUntilFormulasAllowed ( true ) . setRewardBoundedCumulativeRewardFormulasAllowed ( true ) . setMultiDimensionalBoundedUntilFormulasAllowed ( true ) . setMultiDimensionalCumulativeRewardFormulasAllowed ( true ) . setTimeOperatorsAllowed ( true ) . setReachbilityTimeFormulasAllowed ( true ) ) ) {
return true ;
} else if ( formula . isInFragment ( storm : : logic : : quantiles ( ) ) ) {
if ( this - > getModel ( ) . getInitialStates ( ) . getNumberOfSetBits ( ) > 1 ) return false ;
return true ;
}
return false ;
}
template < typename SparseDtmcModelType >
@ -184,6 +192,28 @@ namespace storm {
return std : : unique_ptr < CheckResult > ( new ExplicitQuantitativeCheckResult < ValueType > ( std : : move ( numericResult ) ) ) ;
}
template < >
std : : unique_ptr < CheckResult > SparseDtmcPrctlModelChecker < storm : : models : : sparse : : Dtmc < storm : : RationalFunction > > : : checkQuantileFormula ( Environment const & env , CheckTask < storm : : logic : : QuantileFormula , ValueType > const & checkTask ) {
STORM_LOG_THROW ( false , storm : : exceptions : : NotImplementedException , " Quantiles for parametric models are not implemented. " ) ;
}
template < typename SparseDtmcModelType >
std : : unique_ptr < CheckResult > SparseDtmcPrctlModelChecker < SparseDtmcModelType > : : checkQuantileFormula ( Environment const & env , CheckTask < storm : : logic : : QuantileFormula , ValueType > const & checkTask ) {
STORM_LOG_THROW ( checkTask . isOnlyInitialStatesRelevantSet ( ) , storm : : exceptions : : InvalidOperationException , " Computing quantiles is only supported for the initial states of a model. " ) ;
STORM_LOG_THROW ( this - > getModel ( ) . getInitialStates ( ) . getNumberOfSetBits ( ) = = 1 , storm : : exceptions : : InvalidOperationException , " Quantiles not supported on models with multiple initial states. " ) ;
uint64_t initialState = * this - > getModel ( ) . getInitialStates ( ) . begin ( ) ;
helper : : rewardbounded : : QuantileHelper < SparseDtmcModelType > qHelper ( this - > getModel ( ) , checkTask . getFormula ( ) ) ;
auto res = qHelper . computeQuantile ( env ) ;
if ( res . size ( ) = = 1 & & res . front ( ) . size ( ) = = 1 ) {
return std : : unique_ptr < CheckResult > ( new ExplicitQuantitativeCheckResult < ValueType > ( initialState , std : : move ( res . front ( ) . front ( ) ) ) ) ;
} else {
return std : : unique_ptr < CheckResult > ( new ExplicitParetoCurveCheckResult < ValueType > ( initialState , std : : move ( res ) ) ) ;
}
}
template class SparseDtmcPrctlModelChecker < storm : : models : : sparse : : Dtmc < double > > ;
# ifdef STORM_HAVE_CARL