@ -162,7 +162,7 @@ namespace storm {
}
}
template < typename ValueType >
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. " ) ;
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 ( ) ;
bool const stateValuationsGiven = model ! = nullptr & & model - > hasStateValuations ( ) ;
@ -214,6 +214,15 @@ namespace storm {
if ( ! isMemorylessScheduler ( ) ) {
if ( ! isMemorylessScheduler ( ) ) {
stateString < < " m " < < std : : setw ( 8 ) < < memoryState ;
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
// Print choice info
SchedulerChoice < ValueType > const & choice = schedulerChoices [ memoryState ] [ state ] ;
SchedulerChoice < ValueType > const & choice = schedulerChoices [ memoryState ] [ state ] ;
@ -256,7 +265,8 @@ namespace storm {
// Print memory updates
// Print memory updates
if ( ! isMemorylessScheduler ( ) ) {
if ( ! isMemorylessScheduler ( ) ) {
out < < std : : setw ( widthOfStates ) < < " " ;
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 ( ) ) {
for ( auto const & choiceProbPair : choice . getChoiceAsDistribution ( ) ) {
uint64_t row = model - > getTransitionMatrix ( ) . getRowGroupIndices ( ) [ state ] + choiceProbPair . first ;
uint64_t row = model - > getTransitionMatrix ( ) . getRowGroupIndices ( ) [ state ] + choiceProbPair . first ;
bool firstUpdate = true ;
bool firstUpdate = true ;
@ -270,28 +280,29 @@ namespace storm {
// out << "model state' = " << entryIt->getColumn() << ": (transition = " << entryIt - model->getTransitionMatrix().begin() << ") -> " << "(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 ;
stateString < < std : : endl ;
}
}
out < < stateString . str ( ) ;
out < < std : : endl ;
stateString < < stateString . str ( ) ;
stateString < < std : : endl ;
}
}
}
}
if ( numOfSkippedStatesWithUniqueChoice > 0 ) {
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 < >
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. " ) ;
STORM_LOG_THROW ( isMemorylessScheduler ( ) , storm : : exceptions : : NotImplementedException , " Json export of schedulers not implemented for this value type. " ) ;
}
}
template < typename ValueType >
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_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_LOG_WARN_COND ( ! ( skipUniqueChoices & & model = = nullptr ) , " Can not skip unique choices if the model is not given. " ) ;
storm : : json < storm : : RationalNumber > output ;
storm : : json < storm : : RationalNumber > output ;
@ -303,7 +314,7 @@ namespace storm {
for ( uint_fast64_t memoryState = 0 ; memoryState < getNumberOfMemoryStates ( ) ; + + memoryState ) {
for ( uint_fast64_t memoryState = 0 ; memoryState < getNumberOfMemoryStates ( ) ; + + memoryState ) {
// Ignore dontCare states
// Ignore dontCare states
if ( ( ! isMemorylessScheduler ( ) ) & & isDontCare ( state , memoryState ) ) {
if ( skipDontCareStates & & isDontCare ( state , memoryState ) ) {
continue ;
continue ;
}
}