@ -162,7 +162,7 @@ namespace storm {
}
template < typename ValueType >
void Scheduler < ValueType > : : printToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < ValueType > > model , bool skipUniqueChoices ) const {
void Scheduler < ValueType > : : printToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < ValueType > > model , bool skipUniqueChoices , bool skipDontCareStates ) const {
STORM_LOG_THROW ( model = = nullptr | | model - > getNumberOfStates ( ) = = schedulerChoices . front ( ) . size ( ) , storm : : exceptions : : InvalidOperationException , " The given model is not compatible with this scheduler. " ) ;
bool const stateValuationsGiven = model ! = nullptr & & model - > hasStateValuations ( ) ;
@ -214,6 +214,15 @@ namespace storm {
if ( ! isMemorylessScheduler ( ) ) {
stateString < < " m " < < std : : setw ( 8 ) < < memoryState ;
}
stateString < < " " ;
bool firstMemoryState = true ;
for ( uint_fast64_t memoryState = 0 ; memoryState < getNumberOfMemoryStates ( ) ; + + memoryState ) {
// Ignore dontCare states
if ( skipDontCareStates & & isDontCare ( state , memoryState ) ) {
continue ;
}
// Print choice info
SchedulerChoice < ValueType > const & choice = schedulerChoices [ memoryState ] [ state ] ;
@ -254,44 +263,46 @@ namespace storm {
stateString < < " undefined. " ;
}
// Print memory updates
if ( ! isMemorylessScheduler ( ) ) {
out < < std : : setw ( widthOfStates ) < < " " ;
for ( auto const & choiceProbPair : choice . getChoiceAsDistribution ( ) ) {
uint64_t row = model - > getTransitionMatrix ( ) . getRowGroupIndices ( ) [ state ] + choiceProbPair . first ;
bool firstUpdate = true ;
for ( auto entryIt = model - > getTransitionMatrix ( ) . getRow ( row ) . begin ( ) ; entryIt < model - > getTransitionMatrix ( ) . getRow ( row ) . end ( ) ; + + entryIt ) {
if ( firstUpdate ) {
firstUpdate = false ;
} else {
stateString < < " , " ;
// Print memory updates
if ( ! isMemorylessScheduler ( ) ) {
stateString < < std : : setw ( widthOfStates ) < < " " ;
// The memory updates do not depend on the actual choice, they only depend on the current model- and memory state as well as the successor model state.
for ( auto const & choiceProbPair : choice . getChoiceAsDistribution ( ) ) {
uint64_t row = model - > getTransitionMatrix ( ) . getRowGroupIndices ( ) [ state ] + choiceProbPair . first ;
bool firstUpdate = true ;
for ( auto entryIt = model - > getTransitionMatrix ( ) . getRow ( row ) . begin ( ) ; entryIt < model - > getTransitionMatrix ( ) . getRow ( row ) . end ( ) ; + + entryIt ) {
if ( firstUpdate ) {
firstUpdate = false ;
} else {
stateString < < " , " ;
}
stateString < < " model state' = " < < entryIt - > getColumn ( ) < < " : -> " < < " (m' = " < < this - > memoryStructure - > getSuccessorMemoryState ( memoryState , entryIt - model - > getTransitionMatrix ( ) . begin ( ) ) < < " ) " ;
// out << "model state' = " << entryIt->getColumn() << ": (transition = " << entryIt - model->getTransitionMatrix().begin() << ") -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")";
}
stateString < < " model state' = " < < entryIt - > getColumn ( ) < < " : -> " < < " (m' = " < < this - > memoryStructure - > getSuccessorMemoryState ( memoryState , entryIt - model - > getTransitionMatrix ( ) . begin ( ) ) < < " ) " ;
// out << "model state' = " << entryIt->getColumn() << ": (transition = " << entryIt - model->getTransitionMatrix().begin() << ") -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")";
}
}
stateString < < std : : endl ;
}
out < < stateString . str ( ) ;
out < < std : : endl ;
stateString < < stateString . str ( ) ;
stateString < < std : : endl ;
}
}
if ( numOfSkippedStatesWithUniqueChoice > 0 ) {
out < < " Skipped " < < numOfSkippedStatesWithUniqueChoice < < " deterministic states with unique choice. " < < std : : endl ;
stateString < < " Skipped " < < numOfSkippedStatesWithUniqueChoice < < " deterministic states with unique choice. " < < std : : endl ;
}
out < < " ___________________________________________________________________ " < < std : : endl ;
stateString < < " ___________________________________________________________________ " < < std : : endl ;
}
template < >
void Scheduler < float > : : printJsonToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < float > > model , bool skipUniqueChoices ) const {
void Scheduler < float > : : printJsonToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < float > > model , bool skipUniqueChoices , bool skipDontCareStates ) const {
STORM_LOG_THROW ( isMemorylessScheduler ( ) , storm : : exceptions : : NotImplementedException , " Json export of schedulers not implemented for this value type. " ) ;
}
template < typename ValueType >
void Scheduler < ValueType > : : printJsonToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < ValueType > > model , bool skipUniqueChoices ) const {
void Scheduler < ValueType > : : printJsonToStream ( std : : ostream & out , std : : shared_ptr < storm : : models : : sparse : : Model < ValueType > > model , bool skipUniqueChoices , bool skipDontCareStates ) const {
STORM_LOG_THROW ( model = = nullptr | | model - > getNumberOfStates ( ) = = schedulerChoices . front ( ) . size ( ) , storm : : exceptions : : InvalidOperationException , " The given model is not compatible with this scheduler. " ) ;
STORM_LOG_WARN_COND ( ! ( skipUniqueChoices & & model = = nullptr ) , " Can not skip unique choices if the model is not given. " ) ;
storm : : json < storm : : RationalNumber > output ;
@ -303,7 +314,7 @@ namespace storm {
for ( uint_fast64_t memoryState = 0 ; memoryState < getNumberOfMemoryStates ( ) ; + + memoryState ) {
// Ignore dontCare states
if ( ( ! isMemorylessScheduler ( ) ) & & isDontCare ( state , memoryState ) ) {
if ( skipDontCareStates & & isDontCare ( state , memoryState ) ) {
continue ;
}