@ -17,7 +17,8 @@ namespace storm {
namespace storage {
template < typename ValueType >
DFT < ValueType > : : DFT ( DFTElementVector const & elements , DFTElementPointer const & tle ) : mElements ( elements ) , mNrOfBEs ( 0 ) , mNrOfSpares ( 0 ) , mNrRepresentatives ( 0 ) , mTopLevelIndex ( tle - > id ( ) ) , mMaxSpareChildCount ( 0 ) {
DFT < ValueType > : : DFT ( DFTElementVector const & elements , DFTElementPointer const & tle ) : mElements ( elements ) , mNrOfBEs ( 0 ) , mNrOfSpares ( 0 ) , mNrRepresentatives ( 0 ) ,
mTopLevelIndex ( tle - > id ( ) ) , mMaxSpareChildCount ( 0 ) {
// Check that ids correspond to indices in the element vector
STORM_LOG_ASSERT ( elementIndicesCorrect ( ) , " Ids incorrect. " ) ;
@ -25,19 +26,20 @@ namespace storm {
if ( isRepresentative ( elem - > id ( ) ) ) {
+ + mNrRepresentatives ;
}
if ( elem - > isBasicElement ( ) ) {
if ( elem - > isBasicElement ( ) ) {
+ + mNrOfBEs ;
} else if ( elem - > isSpareGate ( ) ) {
// Build spare modules by setting representatives and representants
+ + mNrOfSpares ;
mMaxSpareChildCount = std : : max ( mMaxSpareChildCount , std : : static_pointer_cast < DFTSpare < ValueType > > ( elem ) - > children ( ) . size ( ) ) ;
for ( auto const & spareReprs : std : : static_pointer_cast < DFTSpare < ValueType > > ( elem ) - > children ( ) ) {
STORM_LOG_THROW ( spareReprs - > isGate ( ) | | spareReprs - > isBasicElement ( ) , storm : : exceptions : : WrongFormatException , " Child ' " < < spareReprs - > name ( ) < < " ' of spare ' " < < elem - > name ( ) < < " ' must be gate or BE. " ) ;
for ( auto const & spareReprs : std : : static_pointer_cast < DFTSpare < ValueType > > ( elem ) - > children ( ) ) {
STORM_LOG_THROW ( spareReprs - > isGate ( ) | | spareReprs - > isBasicElement ( ) , storm : : exceptions : : WrongFormatException ,
" Child ' " < < spareReprs - > name ( ) < < " ' of spare ' " < < elem - > name ( ) < < " ' must be gate or BE. " ) ;
std : : set < size_t > module = { spareReprs - > id ( ) } ;
spareReprs - > extendSpareModule ( module ) ;
std : : vector < size_t > sparesAndBes ;
for ( size_t modelem : module ) {
if ( mElements [ modelem ] - > isSpareGate ( ) | | mElements [ modelem ] - > isBasicElement ( ) ) {
for ( size_t modelem : module ) {
if ( mElements [ modelem ] - > isSpareGate ( ) | | mElements [ modelem ] - > isBasicElement ( ) ) {
sparesAndBes . push_back ( modelem ) ;
mRepresentants . insert ( std : : make_pair ( modelem , spareReprs - > id ( ) ) ) ;
}
@ -52,14 +54,14 @@ namespace storm {
// For the top module, we assume, contrary to [Jun15], that we have all spare gates and basic elements which are not in another module.
std : : set < size_t > topModuleSet ;
// Initialize with all ids.
for ( auto const & elem : mElements ) {
for ( auto const & elem : mElements ) {
if ( elem - > isBasicElement ( ) | | elem - > isSpareGate ( ) ) {
topModuleSet . insert ( elem - > id ( ) ) ;
}
}
// Erase spare modules
for ( auto const & module : mSpareModules ) {
for ( auto const & index : module . second ) {
for ( auto const & module : mSpareModules ) {
for ( auto const & index : module . second ) {
topModuleSet . erase ( index ) ;
}
}
@ -72,7 +74,8 @@ namespace storm {
if ( ! mTopModule . empty ( ) ) {
for ( auto & module : mSpareModules ) {
if ( std : : find ( module . second . begin ( ) , module . second . end ( ) , mTopModule . front ( ) ) ! = module . second . end ( ) ) {
STORM_LOG_WARN ( " Elements of spare module ' " < < getElement ( module . first ) - > name ( ) < < " ' also contained in top module. All elements of this spare module will be activated from the beginning on. " ) ;
STORM_LOG_WARN ( " Elements of spare module ' " < < getElement ( module . first ) - > name ( )
< < " ' also contained in top module. All elements of this spare module will be activated from the beginning on. " ) ;
module . second . clear ( ) ;
}
}
@ -88,8 +91,8 @@ namespace storm {
DFTStateGenerationInfo generationInfo ( nrElements ( ) , mNrOfSpares , mNrRepresentatives , mMaxSpareChildCount ) ;
// Generate Pre and Post info for restrictions, and mutexes
for ( auto const & elem : mElements ) {
if ( ! elem - > isDependency ( ) & & ! elem - > isRestriction ( ) ) {
for ( auto const & elem : mElements ) {
if ( ! elem - > isDependency ( ) & & ! elem - > isRestriction ( ) ) {
generationInfo . setRestrictionPreElements ( elem - > id ( ) , elem - > seqRestrictionPres ( ) ) ;
generationInfo . setRestrictionPostElements ( elem - > id ( ) , elem - > seqRestrictionPosts ( ) ) ;
generationInfo . setMutexElements ( elem - > id ( ) , elem - > mutexRestrictionElements ( ) ) ;
@ -179,7 +182,8 @@ namespace storm {
std : : shared_ptr < DFTDependency < ValueType > const > dependency = getDependency ( idDependency ) ;
visitQueue . push ( dependency - > id ( ) ) ;
visitQueue . push ( dependency - > triggerEvent ( ) - > id ( ) ) ;
STORM_LOG_THROW ( dependency - > dependentEvents ( ) . size ( ) = = 1 , storm : : exceptions : : NotSupportedException , " Direct state generation does not support n-ary dependencies. Consider rewriting them by setting the binary dependency flag. " ) ;
STORM_LOG_THROW ( dependency - > dependentEvents ( ) . size ( ) = = 1 , storm : : exceptions : : NotSupportedException ,
" Direct state generation does not support n-ary dependencies. Consider rewriting them by setting the binary dependency flag. " ) ;
visitQueue . push ( dependency - > dependentEvents ( ) [ 0 ] - > id ( ) ) ;
}
stateIndex = performStateGenerationInfoDFS ( generationInfo , visitQueue , visited , stateIndex ) ;
@ -225,7 +229,8 @@ namespace storm {
}
template < typename ValueType >
size_t DFT < ValueType > : : performStateGenerationInfoDFS ( DFTStateGenerationInfo & generationInfo , std : : queue < size_t > & visitQueue , storm : : storage : : BitVector & visited , size_t stateIndex ) const {
size_t DFT < ValueType > : : performStateGenerationInfoDFS ( DFTStateGenerationInfo & generationInfo , std : : queue < size_t > & visitQueue , storm : : storage : : BitVector & visited ,
size_t stateIndex ) const {
while ( ! visitQueue . empty ( ) ) {
size_t id = visitQueue . front ( ) ;
visitQueue . pop ( ) ;
@ -246,13 +251,13 @@ namespace storm {
}
template < typename ValueType >
std : : vector < DFT < ValueType > > DFT < ValueType > : : topModularisation ( ) const {
std : : vector < DFT < ValueType > > DFT < ValueType > : : topModularisation ( ) const {
STORM_LOG_ASSERT ( isGate ( mTopLevelIndex ) , " Top level element is no gate. " ) ;
auto const & children = getGate ( mTopLevelIndex ) - > children ( ) ;
std : : map < size_t , std : : vector < size_t > > subdfts ;
for ( auto const & child : children ) {
for ( auto const & child : children ) {
std : : vector < size_t > isubdft ;
if ( child - > nrParents ( ) > 1 | | child - > hasOutgoingDependencies ( ) | | child - > hasRestrictions ( ) ) {
if ( child - > nrParents ( ) > 1 | | child - > hasOutgoingDependencies ( ) | | child - > hasRestrictions ( ) ) {
STORM_LOG_TRACE ( " child " < < child - > name ( ) < < " does not allow modularisation. " ) ;
return { * this } ;
}
@ -260,7 +265,7 @@ namespace storm {
isubdft = getGate ( child - > id ( ) ) - > independentSubDft ( false ) ;
} else {
STORM_LOG_ASSERT ( isBasicElement ( child - > id ( ) ) , " Child is no BE. " ) ;
if ( getBasicElement ( child - > id ( ) ) - > hasIngoingDependencies ( ) ) {
if ( getBasicElement ( child - > id ( ) ) - > hasIngoingDependencies ( ) ) {
STORM_LOG_TRACE ( " child " < < child - > name ( ) < < " does not allow modularisation. " ) ;
return { * this } ;
} else {
@ -268,7 +273,7 @@ namespace storm {
}
}
if ( isubdft . empty ( ) ) {
if ( isubdft . empty ( ) ) {
return { * this } ;
} else {
subdfts [ child - > id ( ) ] = isubdft ;
@ -276,10 +281,10 @@ namespace storm {
}
std : : vector < DFT < ValueType > > res ;
for ( auto const & subdft : subdfts ) {
for ( auto const & subdft : subdfts ) {
storm : : builder : : DFTBuilder < ValueType > builder ;
for ( size_t id : subdft . second ) {
for ( size_t id : subdft . second ) {
builder . copyElement ( mElements [ id ] ) ;
}
builder . setTopLevel ( mElements [ subdft . first ] - > name ( ) ) ;
@ -293,7 +298,7 @@ namespace storm {
uint64_t DFT < ValueType > : : maxRank ( ) const {
uint64_t max = 0 ;
for ( auto const & e : mElements ) {
if ( e - > rank ( ) > max ) {
if ( e - > rank ( ) > max ) {
max = e - > rank ( ) ;
}
}
@ -338,7 +343,8 @@ namespace storm {
// Accumulate children names
std : : vector < std : : string > childrenNames ;
for ( size_t i = 1 ; i < rewrites . size ( ) ; + + i ) {
STORM_LOG_ASSERT ( mElements [ rewrites [ i ] ] - > parents ( ) . front ( ) - > id ( ) = = originalParent - > id ( ) , " Children have not the same father for rewrite " < < mElements [ rewrites [ i ] ] - > name ( ) ) ;
STORM_LOG_ASSERT ( mElements [ rewrites [ i ] ] - > parents ( ) . front ( ) - > id ( ) = = originalParent - > id ( ) ,
" Children have not the same father for rewrite " < < mElements [ rewrites [ i ] ] - > name ( ) ) ;
childrenNames . push_back ( mElements [ rewrites [ i ] ] - > name ( ) ) ;
}
@ -369,7 +375,7 @@ namespace storm {
childrenNames . clear ( ) ;
childrenNames . push_back ( newParentName ) ;
for ( auto const & child : originalParent - > children ( ) ) {
if ( std : : find ( rewrites . begin ( ) + 1 , rewrites . end ( ) , child - > id ( ) ) = = rewrites . end ( ) ) {
if ( std : : find ( rewrites . begin ( ) + 1 , rewrites . end ( ) , child - > id ( ) ) = = rewrites . end ( ) ) {
// Child was not rewritten and must be kept
childrenNames . push_back ( child - > name ( ) ) ;
}
@ -466,21 +472,21 @@ namespace storm {
STORM_LOG_ASSERT ( it ! = mTopModule . end ( ) , " Element not found. " ) ;
stream < < mElements [ ( * it ) ] - > name ( ) ;
+ + it ;
while ( it ! = mTopModule . end ( ) ) {
stream < < " , " < < mElements [ ( * it ) ] - > name ( ) ;
while ( it ! = mTopModule . end ( ) ) {
stream < < " , " < < mElements [ ( * it ) ] - > name ( ) ;
+ + it ;
}
stream < < " } " < < std : : endl ;
for ( auto const & spareModule : mSpareModules ) {
for ( auto const & spareModule : mSpareModules ) {
stream < < " [ " < < mElements [ spareModule . first ] - > name ( ) < < " ] = { " ;
if ( ! spareModule . second . empty ( ) ) {
std : : vector < size_t > : : const_iterator it = spareModule . second . begin ( ) ;
STORM_LOG_ASSERT ( it ! = spareModule . second . end ( ) , " Element not found. " ) ;
stream < < mElements [ ( * it ) ] - > name ( ) ;
+ + it ;
while ( it ! = spareModule . second . end ( ) ) {
stream < < " , " < < mElements [ ( * it ) ] - > name ( ) ;
while ( it ! = spareModule . second . end ( ) ) {
stream < < " , " < < mElements [ ( * it ) ] - > name ( ) ;
+ + it ;
}
}
@ -490,7 +496,7 @@ namespace storm {
}
template < typename ValueType >
std : : string DFT < ValueType > : : getElementsWithStateString ( DFTStatePointer const & state ) const {
std : : string DFT < ValueType > : : getElementsWithStateString ( DFTStatePointer const & state ) const {
std : : stringstream stream ;
for ( auto const & elem : mElements ) {
stream < < " [ " < < elem - > id ( ) < < " ] " ;
@ -499,9 +505,9 @@ namespace storm {
stream < < " \t ** " < < storm : : storage : : toChar ( state - > getDependencyState ( elem - > id ( ) ) ) < < " [dep] " ;
} else {
stream < < " \t ** " < < storm : : storage : : toChar ( state - > getElementState ( elem - > id ( ) ) ) ;
if ( elem - > isSpareGate ( ) ) {
if ( elem - > isSpareGate ( ) ) {
size_t useId = state - > uses ( elem - > id ( ) ) ;
if ( useId = = elem - > id ( ) | | state - > isActive ( useId ) ) {
if ( useId = = elem - > id ( ) | | state - > isActive ( useId ) ) {
stream < < " actively " ;
}
stream < < " using " < < useId ;
@ -521,10 +527,10 @@ namespace storm {
stream < < storm : : storage : : toChar ( state - > getDependencyState ( elem - > id ( ) ) ) < < " [dep] " ;
} else {
stream < < storm : : storage : : toChar ( state - > getElementState ( elem - > id ( ) ) ) ;
if ( elem - > isSpareGate ( ) ) {
if ( elem - > isSpareGate ( ) ) {
stream < < " [ " ;
size_t useId = state - > uses ( elem - > id ( ) ) ;
if ( useId = = elem - > id ( ) | | state - > isActive ( useId ) ) {
if ( useId = = elem - > id ( ) | | state - > isActive ( useId ) ) {
stream < < " actively " ;
}
stream < < " using " < < useId < < " ] " ;
@ -543,7 +549,7 @@ namespace storm {
stream < < storm : : storage : : toChar ( DFTState < ValueType > : : getDependencyState ( status , stateGenerationInfo , elem - > id ( ) ) ) < < " [dep] " ;
} else {
stream < < storm : : storage : : toChar ( DFTState < ValueType > : : getElementState ( status , stateGenerationInfo , elem - > id ( ) ) ) ;
if ( elem - > isSpareGate ( ) ) {
if ( elem - > isSpareGate ( ) ) {
stream < < " [ " ;
size_t nrUsedChild = status . getAsInt ( stateGenerationInfo . getSpareUsageIndex ( elem - > id ( ) ) , stateGenerationInfo . usageInfoBits ( ) ) ;
size_t useId ;
@ -552,7 +558,7 @@ namespace storm {
} else {
useId = getChild ( elem - > id ( ) , nrUsedChild ) ;
}
if ( useId = = elem - > id ( ) | | status [ stateGenerationInfo . getSpareActivationIndex ( useId ) ] ) {
if ( useId = = elem - > id ( ) | | status [ stateGenerationInfo . getSpareActivationIndex ( useId ) ] ) {
stream < < " actively " ;
}
stream < < " using " < < useId < < " ] " ;
@ -581,7 +587,7 @@ namespace storm {
return 0 ;
}
template < typename ValueType >
template < typename ValueType >
std : : vector < size_t > DFT < ValueType > : : getIndependentSubDftRoots ( size_t index ) const {
auto elem = getElement ( index ) ;
auto ISD = elem - > independentSubDft ( false ) ;
@ -608,7 +614,7 @@ namespace storm {
bool wellformed = true ;
// Check independence of spare modules
// TODO: comparing one element of each spare module sufficient?
for ( auto module1 = mSpareModules . begin ( ) ; module1 ! = mSpareModules . end ( ) ; + + module1 ) {
for ( auto module1 = mSpareModules . begin ( ) ; module1 ! = mSpareModules . end ( ) ; + + module1 ) {
size_t firstElement = module1 - > second . front ( ) ;
for ( auto module2 = std : : next ( module1 ) ; module2 ! = mSpareModules . end ( ) ; + + module2 ) {
if ( std : : find ( module2 - > second . begin ( ) , module2 - > second . end ( ) , firstElement ) ! = module2 - > second . end ( ) ) {
@ -621,6 +627,7 @@ namespace storm {
}
}
// TODO check VOT gates
// TODO check only one constant failed event
return wellformed ;
}
@ -651,13 +658,13 @@ namespace storm {
STORM_LOG_ASSERT ( isGate ( index2 ) , " Element is no gate. " ) ;
std : : vector < size_t > isubdft1 = getGate ( index1 ) - > independentSubDft ( false ) ;
std : : vector < size_t > isubdft2 = getGate ( index2 ) - > independentSubDft ( false ) ;
if ( isubdft1 . empty ( ) | | isubdft2 . empty ( ) | | isubdft1 . size ( ) ! = isubdft2 . size ( ) ) {
if ( isubdft1 . empty ( ) | | isubdft2 . empty ( ) | | isubdft1 . size ( ) ! = isubdft2 . size ( ) ) {
if ( isubdft1 . empty ( ) & & isubdft2 . empty ( ) & & sparesAsLeaves ) {
// Check again for shared spares
sharedSpareMode = true ;
isubdft1 = getGate ( index1 ) - > independentSubDft ( false , true ) ;
isubdft2 = getGate ( index2 ) - > independentSubDft ( false , true ) ;
if ( isubdft1 . empty ( ) | | isubdft2 . empty ( ) | | isubdft1 . size ( ) ! = isubdft2 . size ( ) ) {
if ( isubdft1 . empty ( ) | | isubdft2 . empty ( ) | | isubdft1 . size ( ) ! = isubdft2 . size ( ) ) {
return { } ;
}
} else {
@ -731,12 +738,12 @@ namespace storm {
std : : map < size_t , std : : vector < std : : vector < size_t > > > res ;
// Find symmetries for gates
for ( auto const & colourClass : completeCategories . gateCandidates ) {
for ( auto const & colourClass : completeCategories . gateCandidates ) {
findSymmetriesHelper ( colourClass . second , colouring , res ) ;
}
// Find symmetries for BEs
for ( auto const & colourClass : completeCategories . beCandidates ) {
for ( auto const & colourClass : completeCategories . beCandidates ) {
findSymmetriesHelper ( colourClass . second , colouring , res ) ;
}
@ -744,41 +751,42 @@ namespace storm {
}
template < typename ValueType >
void DFT < ValueType > : : findSymmetriesHelper ( std : : vector < size_t > const & candidates , DFTColouring < ValueType > const & colouring , std : : map < size_t , std : : vector < std : : vector < size_t > > > & result ) const {
if ( candidates . size ( ) < = 0 ) {
void DFT < ValueType > : : findSymmetriesHelper ( std : : vector < size_t > const & candidates , DFTColouring < ValueType > const & colouring ,
std : : map < size_t , std : : vector < std : : vector < size_t > > > & result ) const {
if ( candidates . size ( ) < = 0 ) {
return ;
}
std : : set < size_t > foundEqClassFor ;
for ( auto it1 = candidates . cbegin ( ) ; it1 ! = candidates . cend ( ) ; + + it1 ) {
for ( auto it1 = candidates . cbegin ( ) ; it1 ! = candidates . cend ( ) ; + + it1 ) {
std : : vector < std : : vector < size_t > > symClass ;
if ( foundEqClassFor . count ( * it1 ) > 0 ) {
if ( foundEqClassFor . count ( * it1 ) > 0 ) {
// This item is already in a class.
continue ;
}
if ( ! getElement ( * it1 ) - > hasOnlyStaticParents ( ) ) {
if ( ! getElement ( * it1 ) - > hasOnlyStaticParents ( ) ) {
continue ;
}
std : : tuple < std : : vector < size_t > , std : : vector < size_t > , std : : vector < size_t > > influencedElem1Ids = getSortedParentAndDependencyIds ( * it1 ) ;
auto it2 = it1 ;
for ( + + it2 ; it2 ! = candidates . cend ( ) ; + + it2 ) {
if ( ! getElement ( * it2 ) - > hasOnlyStaticParents ( ) ) {
for ( + + it2 ; it2 ! = candidates . cend ( ) ; + + it2 ) {
if ( ! getElement ( * it2 ) - > hasOnlyStaticParents ( ) ) {
continue ;
}
if ( influencedElem1Ids = = getSortedParentAndDependencyIds ( * it2 ) ) {
if ( influencedElem1Ids = = getSortedParentAndDependencyIds ( * it2 ) ) {
std : : map < size_t , size_t > bijection = findBijection ( * it1 , * it2 , colouring , true ) ;
if ( ! bijection . empty ( ) ) {
STORM_LOG_TRACE ( " Subdfts are symmetric " ) ;
foundEqClassFor . insert ( * it2 ) ;
if ( symClass . empty ( ) ) {
for ( auto const & i : bijection ) {
if ( symClass . empty ( ) ) {
for ( auto const & i : bijection ) {
symClass . push_back ( std : : vector < size_t > ( { i . first } ) ) ;
}
}
auto symClassIt = symClass . begin ( ) ;
for ( auto const & i : bijection ) {
for ( auto const & i : bijection ) {
symClassIt - > emplace_back ( i . second ) ;
+ + symClassIt ;
@ -787,7 +795,7 @@ namespace storm {
}
}
if ( ! symClass . empty ( ) ) {
if ( ! symClass . empty ( ) ) {
result . emplace ( * it1 , symClass ) ;
}
}
@ -795,31 +803,32 @@ namespace storm {
template < typename ValueType >
std : : vector < size_t > DFT < ValueType > : : findModularisationRewrite ( ) const {
for ( auto const & e : mElements ) {
if ( e - > isGate ( ) & & ( e - > type ( ) = = DFTElementType : : AND | | e - > type ( ) = = DFTElementType : : OR ) ) {
// suitable parent gate! - Lets check the independent submodules of the children
auto const & children = std : : static_pointer_cast < DFTGate < ValueType > > ( e ) - > children ( ) ;
for ( auto const & child : children ) {
auto ISD = std : : static_pointer_cast < DFTGate < ValueType > > ( child ) - > independentSubDft ( true ) ;
// In the ISD, check for other children:
std : : vector < size_t > rewrite = { e - > id ( ) , child - > id ( ) } ;
for ( size_t isdElemId : ISD ) {
if ( isdElemId = = child - > id ( ) ) continue ;
if ( std : : find_if ( children . begin ( ) , children . end ( ) , [ & isdElemId ] ( std : : shared_ptr < DFTElement < ValueType > > const & e ) { return e - > id ( ) = = isdElemId ; } ) ! = children . end ( ) ) {
// element in subtree is also child
rewrite . push_back ( isdElemId ) ;
}
}
if ( rewrite . size ( ) > 2 & & rewrite . size ( ) < children . size ( ) - 1 ) {
return rewrite ;
}
for ( auto const & e : mElements ) {
if ( e - > isGate ( ) & & ( e - > type ( ) = = DFTElementType : : AND | | e - > type ( ) = = DFTElementType : : OR ) ) {
// suitable parent gate! - Lets check the independent submodules of the children
auto const & children = std : : static_pointer_cast < DFTGate < ValueType > > ( e ) - > children ( ) ;
for ( auto const & child : children ) {
auto ISD = std : : static_pointer_cast < DFTGate < ValueType > > ( child ) - > independentSubDft ( true ) ;
// In the ISD, check for other children:
std : : vector < size_t > rewrite = { e - > id ( ) , child - > id ( ) } ;
for ( size_t isdElemId : ISD ) {
if ( isdElemId = = child - > id ( ) ) continue ;
if ( std : : find_if ( children . begin ( ) , children . end ( ) , [ & isdElemId ] ( std : : shared_ptr < DFTElement < ValueType > > const & e ) { return e - > id ( ) = = isdElemId ; } ) ! =
children . end ( ) ) {
// element in subtree is also child
rewrite . push_back ( isdElemId ) ;
}
}
if ( rewrite . size ( ) > 2 & & rewrite . size ( ) < children . size ( ) - 1 ) {
return rewrite ;
}
}
}
}
return { } ;
}
}
}
return { } ;
}
@ -831,14 +840,14 @@ namespace storm {
// Ingoing dependencies
std : : vector < size_t > ingoingDeps ;
if ( isBasicElement ( index ) ) {
for ( auto const & dep : getBasicElement ( index ) - > ingoingDependencies ( ) ) {
for ( auto const & dep : getBasicElement ( index ) - > ingoingDependencies ( ) ) {
ingoingDeps . push_back ( dep - > id ( ) ) ;
}
std : : sort ( ingoingDeps . begin ( ) , ingoingDeps . end ( ) ) ;
}
// Outgoing dependencies
std : : vector < size_t > outgoingDeps ;
for ( auto const & dep : getElement ( index ) - > outgoingDependencies ( ) ) {
for ( auto const & dep : getElement ( index ) - > outgoingDependencies ( ) ) {
outgoingDeps . push_back ( dep - > id ( ) ) ;
}
std : : sort ( outgoingDeps . begin ( ) , outgoingDeps . end ( ) ) ;
@ -863,10 +872,12 @@ namespace storm {
template < typename ValueType >
void DFT < ValueType > : : setRelevantEvents ( std : : set < size_t > const & relevantEvents , bool allowDCForRelevantEvents ) const {
mRelevantEvents . clear ( ) ;
for ( auto const & elem : mElements ) {
if ( relevantEvents . find ( elem - > id ( ) ) ! = relevantEvents . end ( ) ) {
elem - > setRelevance ( true ) ;
elem - > setAllowDC ( allowDCForRelevantEvents ) ;
mRelevantEvents . insert ( elem - > id ( ) ) ;
} else {
elem - > setRelevance ( false ) ;
elem - > setAllowDC ( true ) ;
@ -876,29 +887,20 @@ namespace storm {
template < typename ValueType >
std : : set < size_t > DFT < ValueType > : : getRelevantEvents ( ) const {
std : : set < size_t > relevantEvents ;
for ( auto const & elem : mElements ) {
if ( elem - > isRelevant ( ) ) {
relevantEvents . insert ( elem - > id ( ) ) ;
}
}
return relevantEvents ;
return mRelevantEvents ;
}
template < typename ValueType >
std : : string DFT < ValueType > : : getRelevantEventsString ( ) const {
std : : stringstream stream ;
bool first = true ;
for ( auto const & elem : mElements ) {
if ( elem - > isRelevant ( ) ) {
if ( first ) {
first = false ;
} else {
stream < < " , " ;
}
stream < < elem - > name ( ) < < " [ " < < elem - > id ( ) < < " ] " ;
for ( size_t relevant_id : getRelevantEvents ( ) ) {
if ( first ) {
first = false ;
} else {
stream < < " , " ;
}
stream < < getElement ( relevant_id ) - > name ( ) < < " [ " < < relevant_id < < " ] " ;
}
return stream . str ( ) ;
}
@ -1000,10 +1002,14 @@ namespace storm {
}
// Explicitly instantiate the class.
template class DFT < double > ;
template
class DFT < double > ;
# ifdef STORM_HAVE_CARL
template class DFT < RationalFunction > ;
template
class DFT < RationalFunction > ;
# endif
}