@ -1,5 +1,6 @@
# include "storm/modelchecker/csl/SparseMarkovAutomatonCslModelChecker.h"
# include "storm/modelchecker/csl/helper/SparseMarkovAutomatonCslHelper.h"
# include "storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.h"
# include "storm/modelchecker/helper/infinitehorizon/SparseNondeterministicInfiniteHorizonHelper.h"
# include "storm/modelchecker/helper/utility/SetInformationFromCheckTask.h"
@ -40,7 +41,7 @@ namespace storm {
template < typename ModelType >
bool SparseMarkovAutomatonCslModelChecker < ModelType > : : canHandleStatic ( CheckTask < storm : : logic : : Formula , ValueType > const & checkTask , bool * requiresSingleInitialState ) {
auto singleObjectiveFragment = storm : : logic : : csl ( ) . setUna ryBoo leanPathFormula sAllowed ( true ) . setBin aryBooleanPathFormulasAllowed ( true ) . setNestedPathFormulasAllowed ( true ) . setRewardOperatorsAllowed ( true ) . setReachabilityRewardFormulasAllowed ( true ) . setTotalRewardFormulasAllowed ( true ) . setTimeAllowed ( true ) . setLongRunAverageProbabilitiesAllowed ( true ) . setLongRunAverageRewardFormulasAllowed ( true ) . setRewardAccumulationAllowed ( true ) . setInstantaneousFormulasAllowed ( false ) ;
auto singleObjectiveFragment = storm : : logic : : csrlstar ( ) . setRewardOperatorsAllowed ( true ) . setReachabilityRewardFormulasAllowed ( true ) . setTotalRewardFormulasAllowed ( true ) . setTimeAllowed ( true ) . setLongRunAverageProbabilitiesAllowed ( true ) . setLongRunAverageRewardFormulasAllowed ( true ) . setRewardAccumulationAllowed ( true ) . setInstantaneousFormulasAllowed ( false ) ;
auto multiObjectiveFragment = storm : : logic : : multiObjective ( ) . setTimeAllowed ( true ) . setTimeBoundedUntilFormulasAllowed ( true ) . setRewardAccumulationAllowed ( true ) ;
if ( ! storm : : NumberTraits < ValueType > : : SupportsExponential ) {
singleObjectiveFragment . setBoundedUntilFormulasAllowed ( false ) . setCumulativeRewardFormulasAllowed ( false ) ;
@ -94,6 +95,31 @@ namespace storm {
return std : : unique_ptr < CheckResult > ( new ExplicitQuantitativeCheckResult < ValueType > ( std : : move ( result ) ) ) ;
}
template < typename SparseMarkovAutomatonModelType >
std : : unique_ptr < CheckResult > SparseMarkovAutomatonCslModelChecker < SparseMarkovAutomatonModelType > : : computeNextProbabilities ( Environment const & env , CheckTask < storm : : logic : : NextFormula , ValueType > const & checkTask ) {
storm : : logic : : NextFormula const & pathFormula = checkTask . getFormula ( ) ;
STORM_LOG_THROW ( checkTask . isOptimizationDirectionSet ( ) , storm : : exceptions : : InvalidPropertyException , " Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model. " ) ;
std : : unique_ptr < CheckResult > subResultPointer = this - > check ( env , pathFormula . getSubformula ( ) ) ;
ExplicitQualitativeCheckResult const & subResult = subResultPointer - > asExplicitQualitativeCheckResult ( ) ;
std : : vector < ValueType > numericResult = storm : : modelchecker : : helper : : SparseMdpPrctlHelper < ValueType > : : computeNextProbabilities ( env , checkTask . getOptimizationDirection ( ) , this - > getModel ( ) . getTransitionMatrix ( ) , subResult . getTruthValuesVector ( ) ) ;
return std : : unique_ptr < CheckResult > ( new ExplicitQuantitativeCheckResult < ValueType > ( std : : move ( numericResult ) ) ) ;
}
template < typename SparseMarkovAutomatonModelType >
std : : unique_ptr < CheckResult > SparseMarkovAutomatonCslModelChecker < SparseMarkovAutomatonModelType > : : computeGloballyProbabilities ( Environment const & env , CheckTask < storm : : logic : : GloballyFormula , ValueType > const & checkTask ) {
storm : : logic : : GloballyFormula const & pathFormula = checkTask . getFormula ( ) ;
STORM_LOG_THROW ( checkTask . isOptimizationDirectionSet ( ) , storm : : exceptions : : InvalidPropertyException , " Formula needs to specify whether minimal or maximal values are to be computed on nondeterministic model. " ) ;
std : : unique_ptr < CheckResult > subResultPointer = this - > check ( env , pathFormula . getSubformula ( ) ) ;
ExplicitQualitativeCheckResult const & subResult = subResultPointer - > asExplicitQualitativeCheckResult ( ) ;
auto ret = storm : : modelchecker : : helper : : SparseMdpPrctlHelper < ValueType > : : computeGloballyProbabilities ( env , storm : : solver : : SolveGoal < ValueType > ( this - > getModel ( ) , checkTask ) , this - > getModel ( ) . getTransitionMatrix ( ) , this - > getModel ( ) . getBackwardTransitions ( ) , subResult . getTruthValuesVector ( ) , checkTask . isQualitativeSet ( ) , checkTask . isProduceSchedulersSet ( ) ) ;
std : : unique_ptr < CheckResult > result ( new ExplicitQuantitativeCheckResult < ValueType > ( std : : move ( ret . values ) ) ) ;
if ( checkTask . isProduceSchedulersSet ( ) & & ret . scheduler ) {
result - > asExplicitQuantitativeCheckResult < ValueType > ( ) . setScheduler ( std : : move ( ret . scheduler ) ) ;
}
return result ;
}
template < typename SparseMarkovAutomatonModelType >
std : : unique_ptr < CheckResult > SparseMarkovAutomatonCslModelChecker < SparseMarkovAutomatonModelType > : : computeUntilProbabilities ( Environment const & env , CheckTask < storm : : logic : : UntilFormula , ValueType > const & checkTask ) {
storm : : logic : : UntilFormula const & pathFormula = checkTask . getFormula ( ) ;