@ -21,81 +21,55 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
storm : : property : : prctl : : Ap < double > * apFormula = new storm : : property : : prctl : : Ap < double > ( " two " ) ;
storm : : property : : prctl : : Eventually < double > * eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > * probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , true ) ;
std : : vector < double > result = mc . checkNoBoundOperator ( * probFormula ) ;
std : : vector < double > result = mc . checkMinMaxOperator ( * eventuallyFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0277777612209320068 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete probFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " two " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , false ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0277777612209320068 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete prob Formula;
delete eventuallyFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " three " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , true ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0555555224418640136 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete probFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " three " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , false ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0555555224418640136 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete prob Formula;
delete eventuallyFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " four " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , true ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.083333283662796020508 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete probFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " four " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , false ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.083333283662796020508 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete prob Formula;
delete eventuallyFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
storm : : property : : prctl : : ReachabilityReward < double > * reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
storm : : property : : prctl : : RewardNoBoundOperator < double > * rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , true ) ;
result = mc . checkNoBoundOperator ( * rewardFormula ) ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 7.333329499 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , false ) ;
result = mc . checkNoBoundOperator ( * rewardFormula ) ; ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 7.333329499 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
delete reachabilityRewardFormula ;
abstractModel = storm : : parser : : AutoParser : : parseModel ( STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.tra " , STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.lab " , STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.flip.state.rew " , " " ) ;
@ -107,21 +81,16 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , true ) ;
result = stateRewardModelChecker . checkNoBoundOperator ( * rewardFormula ) ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 7.333329499 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , false ) ;
result = stateRewardModelChecker . checkNoBoundOperator ( * rewardFormula ) ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 7.333329499 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
delete reachabilityRewardFormula ;
abstractModel = storm : : parser : : AutoParser : : parseModel ( STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.tra " , STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.lab " , STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.flip.state.rew " , STORM_CPP_BASE_PATH " /examples/mdp/two_dice/two_dice.flip.trans.rew " ) ;
@ -133,91 +102,67 @@ TEST(SparseMdpPrctlModelCheckerTest, Dice) {
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , true ) ;
result = stateAndTransitionRewardModelChecker . checkNoBound Operator( * rewardFormula ) ;
result = mc . checkMinMax Operator( * reachabilityRe wardFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 14.666658998 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " done " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , false ) ;
result = stateAndTransitionRewardModelChecker . checkNoBoundOperator ( * rewardFormula ) ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 14.666658998 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
delete reachabilityRewardFormula ;
}
TEST ( SparseMdpPrctlModelCheckerTest , AsynchronousLeader ) {
storm : : settings : : Settings * s = storm : : settings : : Settings : : getInstance ( ) ;
std : : shared_ptr < storm : : models : : AbstractModel < double > > abstractModel = storm : : parser : : AutoParser : : parseModel ( STORM_CPP_BASE_PATH " /examples/mdp/asynchronous_leader/leader4.tra " , STORM_CPP_BASE_PATH " /examples/mdp/asynchronous_leader/leader4.lab " , " " , STORM_CPP_BASE_PATH " /examples/mdp/asynchronous_leader/leader4.trans.rew " ) ;
ASSERT_EQ ( abstractModel - > getType ( ) , storm : : models : : MDP ) ;
ASSERT_EQ ( storm : : models : : MDP , abstractModel - > getType ( ) ) ;
std : : shared_ptr < storm : : models : : Mdp < double > > mdp = abstractModel - > as < storm : : models : : Mdp < double > > ( ) ;
ASSERT_EQ ( mdp - > getNumberOfStates ( ) , 3172ull ) ;
ASSERT_EQ ( mdp - > getNumberOfTransitions ( ) , 7144ull ) ;
ASSERT_EQ ( 3172ull , mdp - > getNumberOfStates ( ) ) ;
ASSERT_EQ ( 7144ull , mdp - > getNumberOfTransitions ( ) ) ;
storm : : modelchecker : : prctl : : SparseMdpPrctlModelChecker < double > mc ( * mdp , std : : shared_ptr < storm : : solver : : NativeNondeterministicLinearEquationSolver < double > > ( new storm : : solver : : NativeNondeterministicLinearEquationSolver < double > ( ) ) ) ;
storm : : property : : prctl : : Ap < double > * apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
storm : : property : : prctl : : Eventually < double > * eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > * probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , true ) ;
std : : vector < double > result = mc . checkNoBoundOperator ( * probFormula ) ;
std : : vector < double > result = mc . checkMinMaxOperator ( * eventuallyFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 1 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete probFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
eventuallyFormula = new storm : : property : : prctl : : Eventually < double > ( apFormula ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( eventuallyFormula , false ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * eventuallyFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 1 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete prob Formula;
delete eventuallyFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
storm : : property : : prctl : : BoundedEventually < double > * boundedEventuallyFormula = new storm : : property : : prctl : : BoundedEventually < double > ( apFormula , 25 ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( boundedEventuallyFormula , false ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * boundedEventuallyFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0625 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete probFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
boundedEventuallyFormula = new storm : : property : : prctl : : BoundedEventually < double > ( apFormula , 25 ) ;
probFormula = new storm : : property : : prctl : : ProbabilisticNoBoundOperator < double > ( boundedEventuallyFormula , true ) ;
result = mc . checkNoBoundOperator ( * probFormula ) ;
result = mc . checkMinMaxOperator ( * boundedEventuallyFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 0.0625 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete prob Formula;
delete boundedEventuallyFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
storm : : property : : prctl : : ReachabilityReward < double > * reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
storm : : property : : prctl : : RewardNoBoundOperator < double > * rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , true ) ;
result = mc . checkNoBoundOperator ( * rewardFormula ) ; ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , true ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 4.285689611 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
apFormula = new storm : : property : : prctl : : Ap < double > ( " elected " ) ;
reachabilityRewardFormula = new storm : : property : : prctl : : ReachabilityReward < double > ( apFormula ) ;
rewardFormula = new storm : : property : : prctl : : RewardNoBoundOperator < double > ( reachabilityRewardFormula , false ) ;
result = mc . checkNoBoundOperator ( * rewardFormula ) ; ;
result = mc . checkMinMaxOperator ( * reachabilityRewardFormula , false ) ;
ASSERT_LT ( std : : abs ( result [ 0 ] - 4.285689611 ) , s - > getOptionByLongName ( " precision " ) . getArgument ( 0 ) . getValueAsDouble ( ) ) ;
delete rewardFormula ;
delete reachabilityRewardFormula ;
}