@ -583,7 +583,7 @@ namespace storm {
}
template < typename ValueType >
boost : : optional < SparseMdpEndComponentInformation < ValueType > > computeFixedPointSystemUntilProbabilitiesEliminateEndComponents ( storm : : solver : : SolveGoal < ValueType > & goal , storm : : storage : : SparseMatrix < ValueType > const & transitionMatrix , storm : : storage : : SparseMatrix < ValueType > const & backwardTransitions , QualitativeStateSetsUntilProbabilities const & qualitativeStateSets , storm : : storage : : SparseMatrix < ValueType > & submatrix , std : : vector < ValueType > & b ) {
boost : : optional < SparseMdpEndComponentInformation < ValueType > > computeFixedPointSystemUntilProbabilitiesEliminateEndComponents ( storm : : solver : : SolveGoal < ValueType > & goal , storm : : storage : : SparseMatrix < ValueType > const & transitionMatrix , storm : : storage : : SparseMatrix < ValueType > const & backwardTransitions , QualitativeStateSetsUntilProbabilities const & qualitativeStateSets , storm : : storage : : SparseMatrix < ValueType > & submatrix , std : : vector < ValueType > & b , bool produceScheduler ) {
// Get the set of states that (under some scheduler) can stay in the set of maybestates forever
storm : : storage : : BitVector candidateStates = storm : : utility : : graph : : performProb0E ( transitionMatrix , transitionMatrix . getRowGroupIndices ( ) , backwardTransitions , qualitativeStateSets . maybeStates , ~ qualitativeStateSets . maybeStates ) ;
@ -599,7 +599,7 @@ namespace storm {
// Only do more work if there are actually end-components.
if ( doDecomposition & & ! endComponentDecomposition . empty ( ) ) {
STORM_LOG_DEBUG ( " Eliminating " < < endComponentDecomposition . size ( ) < < " EC(s). " ) ;
SparseMdpEndComponentInformation < ValueType > result = SparseMdpEndComponentInformation < ValueType > : : eliminateEndComponents ( endComponentDecomposition , transitionMatrix , qualitativeStateSets . maybeStates , & qualitativeStateSets . statesWithProbability1 , nullptr , nullptr , submatrix , & b , nullptr ) ;
SparseMdpEndComponentInformation < ValueType > result = SparseMdpEndComponentInformation < ValueType > : : eliminateEndComponents ( endComponentDecomposition , transitionMatrix , qualitativeStateSets . maybeStates , & qualitativeStateSets . statesWithProbability1 , nullptr , nullptr , submatrix , & b , nullptr , produceScheduler ) ;
// If the solve goal has relevant values, we need to adjust them.
if ( goal . hasRelevantValues ( ) ) {
@ -663,10 +663,7 @@ namespace storm {
// If the hint information tells us that we have to eliminate MECs, we do so now.
boost : : optional < SparseMdpEndComponentInformation < ValueType > > ecInformation ;
if ( hintInformation . getEliminateEndComponents ( ) ) {
ecInformation = computeFixedPointSystemUntilProbabilitiesEliminateEndComponents ( goal , transitionMatrix , backwardTransitions , qualitativeStateSets , submatrix , b ) ;
// Make sure we are not supposed to produce a scheduler if we actually eliminate end components.
STORM_LOG_THROW ( ! ecInformation | | ! ecInformation . get ( ) . getEliminatedEndComponents ( ) | | ! produceScheduler , storm : : exceptions : : NotSupportedException , " Producing schedulers is not supported if end-components need to be eliminated for the solver. " ) ;
ecInformation = computeFixedPointSystemUntilProbabilitiesEliminateEndComponents ( goal , transitionMatrix , backwardTransitions , qualitativeStateSets , submatrix , b , produceScheduler ) ;
} else {
// Otherwise, we compute the standard equations.
computeFixedPointSystemUntilProbabilities ( goal , transitionMatrix , qualitativeStateSets , submatrix , b ) ;
@ -678,13 +675,15 @@ namespace storm {
// If we eliminated end components, we need to extract the result differently.
if ( ecInformation & & ecInformation . get ( ) . getEliminatedEndComponents ( ) ) {
ecInformation . get ( ) . setValues ( result , qualitativeStateSets . maybeStates , resultForMaybeStates . getValues ( ) ) ;
if ( produceScheduler ) {
ecInformation . get ( ) . setScheduler ( * scheduler , qualitativeStateSets . maybeStates , transitionMatrix , backwardTransitions , resultForMaybeStates . getScheduler ( ) ) ;
}
} else {
// Set values of resulting vector according to result.
storm : : utility : : vector : : setVectorValues < ValueType > ( result , qualitativeStateSets . maybeStates , resultForMaybeStates . getValues ( ) ) ;
}
if ( produceScheduler ) {
extractSchedulerChoices ( * scheduler , resultForMaybeStates . getScheduler ( ) , qualitativeStateSets . maybeStates ) ;
if ( produceScheduler ) {
extractSchedulerChoices ( * scheduler , resultForMaybeStates . getScheduler ( ) , qualitativeStateSets . maybeStates ) ;
}
}
}
}
@ -1028,7 +1027,7 @@ namespace storm {
}
template < typename ValueType >
boost : : optional < SparseMdpEndComponentInformation < ValueType > > computeFixedPointSystemReachabilityRewardsEliminateEndComponents ( storm : : solver : : SolveGoal < ValueType > & goal , storm : : storage : : SparseMatrix < ValueType > const & transitionMatrix , storm : : storage : : SparseMatrix < ValueType > const & backwardTransitions , QualitativeStateSetsReachabilityRewards const & qualitativeStateSets , boost : : optional < storm : : storage : : BitVector > const & selectedChoices , std : : function < std : : vector < ValueType > ( uint_fast64_t , storm : : storage : : SparseMatrix < ValueType > const & , storm : : storage : : BitVector const & ) > const & totalStateRewardVectorGetter , storm : : storage : : SparseMatrix < ValueType > & submatrix , std : : vector < ValueType > & b , boost : : optional < std : : vector < ValueType > > & oneStepTargetProbabilities ) {
boost : : optional < SparseMdpEndComponentInformation < ValueType > > computeFixedPointSystemReachabilityRewardsEliminateEndComponents ( storm : : solver : : SolveGoal < ValueType > & goal , storm : : storage : : SparseMatrix < ValueType > const & transitionMatrix , storm : : storage : : SparseMatrix < ValueType > const & backwardTransitions , QualitativeStateSetsReachabilityRewards const & qualitativeStateSets , boost : : optional < storm : : storage : : BitVector > const & selectedChoices , std : : function < std : : vector < ValueType > ( uint_fast64_t , storm : : storage : : SparseMatrix < ValueType > const & , storm : : storage : : BitVector const & ) > const & totalStateRewardVectorGetter , storm : : storage : : SparseMatrix < ValueType > & submatrix , std : : vector < ValueType > & b , boost : : optional < std : : vector < ValueType > > & oneStepTargetProbabilities , bool produceScheduler ) {
// Start by computing the choices with reward 0, as we only want ECs within this fragment.
storm : : storage : : BitVector zeroRewardChoices ( transitionMatrix . getRowCount ( ) ) ;
@ -1075,7 +1074,7 @@ namespace storm {
// Only do more work if there are actually end-components.
if ( doDecomposition & & ! endComponentDecomposition . empty ( ) ) {
STORM_LOG_DEBUG ( " Eliminating " < < endComponentDecomposition . size ( ) < < " ECs. " ) ;
SparseMdpEndComponentInformation < ValueType > result = SparseMdpEndComponentInformation < ValueType > : : eliminateEndComponents ( endComponentDecomposition , transitionMatrix , qualitativeStateSets . maybeStates , oneStepTargetProbabilities ? & qualitativeStateSets . rewardZeroStates : nullptr , selectedChoices ? & selectedChoices . get ( ) : nullptr , & rewardVector , submatrix , oneStepTargetProbabilities ? & oneStepTargetProbabilities . get ( ) : nullptr , & b ) ;
SparseMdpEndComponentInformation < ValueType > result = SparseMdpEndComponentInformation < ValueType > : : eliminateEndComponents ( endComponentDecomposition , transitionMatrix , qualitativeStateSets . maybeStates , oneStepTargetProbabilities ? & qualitativeStateSets . rewardZeroStates : nullptr , selectedChoices ? & selectedChoices . get ( ) : nullptr , & rewardVector , submatrix , oneStepTargetProbabilities ? & oneStepTargetProbabilities . get ( ) : nullptr , & b , produceScheduler ) ;
// If the solve goal has relevant values, we need to adjust them.
if ( goal . hasRelevantValues ( ) ) {
@ -1163,10 +1162,7 @@ namespace storm {
// If the hint information tells us that we have to eliminate MECs, we do so now.
boost : : optional < SparseMdpEndComponentInformation < ValueType > > ecInformation ;
if ( hintInformation . getEliminateEndComponents ( ) ) {
ecInformation = computeFixedPointSystemReachabilityRewardsEliminateEndComponents ( goal , transitionMatrix , backwardTransitions , qualitativeStateSets , selectedChoices , totalStateRewardVectorGetter , submatrix , b , oneStepTargetProbabilities ) ;
// Make sure we are not supposed to produce a scheduler if we actually eliminate end components.
STORM_LOG_THROW ( ! ecInformation | | ! ecInformation . get ( ) . getEliminatedEndComponents ( ) | | ! produceScheduler , storm : : exceptions : : NotSupportedException , " Producing schedulers is not supported if end-components need to be eliminated for the solver. " ) ;
ecInformation = computeFixedPointSystemReachabilityRewardsEliminateEndComponents ( goal , transitionMatrix , backwardTransitions , qualitativeStateSets , selectedChoices , totalStateRewardVectorGetter , submatrix , b , oneStepTargetProbabilities , produceScheduler ) ;
} else {
// Otherwise, we compute the standard equations.
computeFixedPointSystemReachabilityRewards ( goal , transitionMatrix , qualitativeStateSets , selectedChoices , totalStateRewardVectorGetter , submatrix , b , oneStepTargetProbabilities ? & oneStepTargetProbabilities . get ( ) : nullptr ) ;
@ -1184,13 +1180,15 @@ namespace storm {
// If we eliminated end components, we need to extract the result differently.
if ( ecInformation & & ecInformation . get ( ) . getEliminatedEndComponents ( ) ) {
ecInformation . get ( ) . setValues ( result , qualitativeStateSets . maybeStates , resultForMaybeStates . getValues ( ) ) ;
if ( produceScheduler ) {
ecInformation . get ( ) . setScheduler ( * scheduler , qualitativeStateSets . maybeStates , transitionMatrix , backwardTransitions , resultForMaybeStates . getScheduler ( ) ) ;
}
} else {
// Set values of resulting vector according to result.
storm : : utility : : vector : : setVectorValues < ValueType > ( result , qualitativeStateSets . maybeStates , resultForMaybeStates . getValues ( ) ) ;
}
if ( produceScheduler ) {
extractSchedulerChoices ( * scheduler , transitionMatrix , resultForMaybeStates . getScheduler ( ) , qualitativeStateSets . maybeStates , selectedChoices ) ;
if ( produceScheduler ) {
extractSchedulerChoices ( * scheduler , transitionMatrix , resultForMaybeStates . getScheduler ( ) , qualitativeStateSets . maybeStates , selectedChoices ) ;
}
}
}
}