@ -171,6 +171,9 @@ namespace storm {
template < typename ValueType , typename StateType >
std : : vector < StateType > JaniNextStateGenerator < ValueType , StateType > : : getInitialStates ( StateToIdCallback const & stateToIdCallback ) {
std : : vector < StateType > initialStateIndices ;
if ( this - > model . hasNonTrivialInitialStatesRestriction ( ) ) {
// Prepare an SMT solver to enumerate all initial states.
storm : : utility : : solver : : SmtSolverFactory factory ;
std : : unique_ptr < storm : : solver : : SmtSolver > solver = factory . create ( model . getExpressionManager ( ) ) ;
@ -182,7 +185,6 @@ namespace storm {
solver - > add ( model . getInitialStatesExpression ( this - > parallelAutomata ) ) ;
// Proceed as long as the solver can still enumerate initial states.
std : : vector < StateType > initialStateIndices ;
while ( solver - > check ( ) = = storm : : solver : : SmtSolver : : CheckResult : : Sat ) {
// Create fresh state.
CompressedState initialState ( this - > variableInformation . getTotalBitOffset ( true ) ) ;
@ -226,6 +228,63 @@ namespace storm {
solver - > add ( blockingExpression ) ;
}
STORM_LOG_DEBUG ( " Enumerated " < < initialStateIndices . size ( ) < < " initial states using SMT solving. " ) ;
} else {
CompressedState initialState ( this - > variableInformation . getTotalBitOffset ( true ) ) ;
std : : vector < int_fast64_t > currentIntegerValues ;
currentIntegerValues . reserve ( this - > variableInformation . integerVariables . size ( ) ) ;
for ( auto const & variable : this - > variableInformation . integerVariables ) {
STORM_LOG_THROW ( variable . lowerBound < = variable . upperBound , storm : : exceptions : : InvalidArgumentException , " Expecting variable with non-empty set of possible values. " ) ;
currentIntegerValues . emplace_back ( 0 ) ;
initialState . setFromInt ( variable . bitOffset , variable . bitWidth , 0 ) ;
}
initialStateIndices . emplace_back ( stateToIdCallback ( initialState ) ) ;
bool done = false ;
while ( ! done ) {
bool changedBooleanVariable = false ;
for ( auto const & booleanVariable : this - > variableInformation . booleanVariables ) {
if ( initialState . get ( booleanVariable . bitOffset ) ) {
initialState . set ( booleanVariable . bitOffset ) ;
changedBooleanVariable = true ;
break ;
} else {
initialState . set ( booleanVariable . bitOffset , false ) ;
}
}
bool changedIntegerVariable = false ;
if ( changedBooleanVariable ) {
initialStateIndices . emplace_back ( stateToIdCallback ( initialState ) ) ;
} else {
for ( uint64_t integerVariableIndex = 0 ; integerVariableIndex < this - > variableInformation . integerVariables . size ( ) ; + + integerVariableIndex ) {
auto const & integerVariable = this - > variableInformation . integerVariables [ integerVariableIndex ] ;
if ( currentIntegerValues [ integerVariableIndex ] < integerVariable . upperBound - integerVariable . lowerBound ) {
+ + currentIntegerValues [ integerVariableIndex ] ;
changedIntegerVariable = true ;
} else {
currentIntegerValues [ integerVariableIndex ] = integerVariable . lowerBound ;
}
initialState . setFromInt ( integerVariable . bitOffset , integerVariable . bitWidth , currentIntegerValues [ integerVariableIndex ] ) ;
if ( changedIntegerVariable ) {
break ;
}
}
}
if ( changedIntegerVariable ) {
initialStateIndices . emplace_back ( stateToIdCallback ( initialState ) ) ;
}
done = ! changedBooleanVariable & & ! changedIntegerVariable ;
}
STORM_LOG_DEBUG ( " Enumerated " < < initialStateIndices . size ( ) < < " initial states using brute force enumeration. " ) ;
}
return initialStateIndices ;
}