| 
					
					
						
							
						
					
					
				 | 
				@ -40,7 +40,7 @@ namespace storm { | 
			
		
		
	
		
			
				 | 
				 | 
				            STORM_LOG_DEBUG("Transition matrix: " << std::endl << modelComponents.transitionMatrix); | 
				 | 
				 | 
				            STORM_LOG_DEBUG("Transition matrix: " << std::endl << modelComponents.transitionMatrix); | 
			
		
		
	
		
			
				 | 
				 | 
				            STORM_LOG_DEBUG("Exit rates: " << modelComponents.exitRates); | 
				 | 
				 | 
				            STORM_LOG_DEBUG("Exit rates: " << modelComponents.exitRates); | 
			
		
		
	
		
			
				 | 
				 | 
				            STORM_LOG_DEBUG("Markovian states: " << modelComponents.markovianStates); | 
				 | 
				 | 
				            STORM_LOG_DEBUG("Markovian states: " << modelComponents.markovianStates); | 
			
		
		
	
		
			
				 | 
				 | 
				            assert(modelComponents.transitionMatrix.getRowCount() == modelComponents.transitionMatrix.getColumnCount()); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            assert(!deterministic || modelComponents.transitionMatrix.getRowCount() == modelComponents.transitionMatrix.getColumnCount()); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            // Build state labeling
 | 
				 | 
				 | 
				            // Build state labeling
 | 
			
		
		
	
		
			
				 | 
				 | 
				            modelComponents.stateLabeling = storm::models::sparse::StateLabeling(mStates.size()); | 
				 | 
				 | 
				            modelComponents.stateLabeling = storm::models::sparse::StateLabeling(mStates.size()); | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -100,24 +100,26 @@ namespace storm { | 
			
		
		
	
		
			
				 | 
				 | 
				            // TODO Matthias: set Markovian states directly as bitvector?
 | 
				 | 
				 | 
				            // TODO Matthias: set Markovian states directly as bitvector?
 | 
			
		
		
	
		
			
				 | 
				 | 
				            std::map<size_t, ValueType> outgoingTransitions; | 
				 | 
				 | 
				            std::map<size_t, ValueType> outgoingTransitions; | 
			
		
		
	
		
			
				 | 
				 | 
				            size_t rowOffset = 0; // Captures number of non-deterministic choices
 | 
				 | 
				 | 
				            size_t rowOffset = 0; // Captures number of non-deterministic choices
 | 
			
		
		
	
		
			
				 | 
				 | 
				            ValueType exitRate; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            bool deterministic = true; | 
				 | 
				 | 
				            bool deterministic = true; | 
			
		
		
	
		
			
				 | 
				 | 
				            //TODO Matthias: Handle dependencies!
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            while (!stateQueue.empty()) { | 
				 | 
				 | 
				            while (!stateQueue.empty()) { | 
			
		
		
	
		
			
				 | 
				 | 
				                // Initialization
 | 
				 | 
				 | 
				                // Initialization
 | 
			
		
		
	
		
			
				 | 
				 | 
				                outgoingTransitions.clear(); | 
				 | 
				 | 
				                outgoingTransitions.clear(); | 
			
		
		
	
		
			
				 | 
				 | 
				                exitRate = storm::utility::zero<ValueType>(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                ValueType exitRate = storm::utility::zero<ValueType>(); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                // Consider next state
 | 
				 | 
				 | 
				                // Consider next state
 | 
			
		
		
	
		
			
				 | 
				 | 
				                DFTStatePointer state = stateQueue.front(); | 
				 | 
				 | 
				                DFTStatePointer state = stateQueue.front(); | 
			
		
		
	
		
			
				 | 
				 | 
				                stateQueue.pop(); | 
				 | 
				 | 
				                stateQueue.pop(); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                bool hasDependencies = state->nrFailableDependencies() > 0; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                deterministic &= !hasDependencies; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                size_t failableCount = hasDependencies ? state->nrFailableDependencies() : state->nrFailableBEs(); | 
			
		
		
	
		
			
				 | 
				 | 
				                size_t smallest = 0; | 
				 | 
				 | 
				                size_t smallest = 0; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                transitionMatrixBuilder.newRowGroup(state->getId() + rowOffset); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                // Add self loop for target states
 | 
				 | 
				 | 
				                // Add self loop for target states
 | 
			
		
		
	
		
			
				 | 
				 | 
				                if (mDft.hasFailed(state) || mDft.isFailsafe(state)) { | 
				 | 
				 | 
				                if (mDft.hasFailed(state) || mDft.isFailsafe(state)) { | 
			
		
		
	
		
			
				 | 
				 | 
				                    transitionMatrixBuilder.newRowGroup(state->getId() + rowOffset); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    transitionMatrixBuilder.addNextValue(state->getId() + rowOffset, state->getId(), storm::utility::one<ValueType>()); | 
				 | 
				 | 
				                    transitionMatrixBuilder.addNextValue(state->getId() + rowOffset, state->getId(), storm::utility::one<ValueType>()); | 
			
		
		
	
		
			
				 | 
				 | 
				                    STORM_LOG_TRACE("Added self loop for " << state->getId()); | 
				 | 
				 | 
				                    STORM_LOG_TRACE("Added self loop for " << state->getId()); | 
			
		
		
	
		
			
				 | 
				 | 
				                    exitRates.push_back(storm::utility::one<ValueType>()); | 
				 | 
				 | 
				                    exitRates.push_back(storm::utility::one<ValueType>()); | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -130,18 +132,21 @@ namespace storm { | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                // Let BE fail
 | 
				 | 
				 | 
				                // Let BE fail
 | 
			
		
		
	
		
			
				 | 
				 | 
				                while (smallest < state->nrFailableBEs()) { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                while (smallest < failableCount) { | 
			
		
		
	
		
			
				 | 
				 | 
				                    STORM_LOG_TRACE("exploring from: " << mDft.getStateString(state)); | 
				 | 
				 | 
				                    STORM_LOG_TRACE("exploring from: " << mDft.getStateString(state)); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    // Construct new state as copy from original one
 | 
				 | 
				 | 
				                    // Construct new state as copy from original one
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    DFTStatePointer newState = std::make_shared<storm::storage::DFTState<ValueType>>(*state); | 
				 | 
				 | 
				                    DFTStatePointer newState = std::make_shared<storm::storage::DFTState<ValueType>>(*state); | 
			
		
		
	
		
			
				 | 
				 | 
				                    std::pair<std::shared_ptr<storm::storage::DFTBE<ValueType>>, bool> nextBEPair = newState->letNextBEFail(smallest++); | 
				 | 
				 | 
				                    std::pair<std::shared_ptr<storm::storage::DFTBE<ValueType>>, bool> nextBEPair = newState->letNextBEFail(smallest++); | 
			
		
		
	
		
			
				 | 
				 | 
				                    std::shared_ptr<storm::storage::DFTBE<ValueType>> nextBE = nextBEPair.first; | 
				 | 
				 | 
				                    std::shared_ptr<storm::storage::DFTBE<ValueType>> nextBE = nextBEPair.first; | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (nextBE == nullptr) { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        break; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    assert(nextBE); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    assert(nextBEPair.second == hasDependencies); | 
			
		
		
	
		
			
				 | 
				 | 
				                    STORM_LOG_TRACE("with the failure of: " << nextBE->name() << " [" << nextBE->id() << "]"); | 
				 | 
				 | 
				                    STORM_LOG_TRACE("with the failure of: " << nextBE->name() << " [" << nextBE->id() << "]"); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    // Update failable dependencies
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    newState->updateFailableDependencies(nextBE->id()); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    // Propagate failures
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    storm::storage::DFTStateSpaceGenerationQueues<ValueType> queues; | 
				 | 
				 | 
				                    storm::storage::DFTStateSpaceGenerationQueues<ValueType> queues; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    for (DFTGatePointer parent : nextBE->parents()) { | 
				 | 
				 | 
				                    for (DFTGatePointer parent : nextBE->parents()) { | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -179,6 +184,11 @@ namespace storm { | 
			
		
		
	
		
			
				 | 
				 | 
				                        stateQueue.push(newState); | 
				 | 
				 | 
				                        stateQueue.push(newState); | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    // Set transitions
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    if (hasDependencies) { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        // Failure is due to dependency -> add non-deterministic choice
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        transitionMatrixBuilder.addNextValue(state->getId() + rowOffset++, newState->getId(), storm::utility::one<ValueType>()); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    } else { | 
			
		
		
	
		
			
				 | 
				 | 
				                        // Set failure rate according to usage
 | 
				 | 
				 | 
				                        // Set failure rate according to usage
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        bool isUsed = true; | 
				 | 
				 | 
				                        bool isUsed = true; | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (mDft.hasRepresentant(nextBE->id())) { | 
				 | 
				 | 
				                        if (mDft.hasRepresentant(nextBE->id())) { | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -200,21 +210,27 @@ namespace storm { | 
			
		
		
	
		
			
				 | 
				 | 
				                            STORM_LOG_TRACE("Added transition from " << state->getId() << " to " << newState->getId() << " with " << rate); | 
				 | 
				 | 
				                            STORM_LOG_TRACE("Added transition from " << state->getId() << " to " << newState->getId() << " with " << rate); | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        exitRate += rate; | 
				 | 
				 | 
				                        exitRate += rate; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                } // end while failing BE
 | 
				 | 
				 | 
				                } // end while failing BE
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                // Add all transitions
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                transitionMatrixBuilder.newRowGroup(state->getId() + rowOffset); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                if (hasDependencies) { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    rowOffset--; // One increment to many
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } else { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    // Add all probability transitions
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    for (auto it = outgoingTransitions.begin(); it != outgoingTransitions.end(); ++it) | 
				 | 
				 | 
				                    for (auto it = outgoingTransitions.begin(); it != outgoingTransitions.end(); ++it) | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				                    { | 
			
		
		
	
		
			
				 | 
				 | 
				                        ValueType probability = it->second / exitRate; // Transform rate to probability
 | 
				 | 
				 | 
				                        ValueType probability = it->second / exitRate; // Transform rate to probability
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        transitionMatrixBuilder.addNextValue(state->getId() + rowOffset, it->first, probability); | 
				 | 
				 | 
				                        transitionMatrixBuilder.addNextValue(state->getId() + rowOffset, it->first, probability); | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    markovianStates.push_back(state->getId()); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				                exitRates.push_back(exitRate); | 
				 | 
				 | 
				                exitRates.push_back(exitRate); | 
			
		
		
	
		
			
				 | 
				 | 
				                assert(exitRates.size()-1 == state->getId()); | 
				 | 
				 | 
				                assert(exitRates.size()-1 == state->getId()); | 
			
		
		
	
		
			
				 | 
				 | 
				                markovianStates.push_back(state->getId()); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            } // end while queue
 | 
				 | 
				 | 
				            } // end while queue
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            assert(!deterministic || rowOffset == 0); | 
			
		
		
	
		
			
				 | 
				 | 
				            return deterministic; | 
				 | 
				 | 
				            return deterministic; | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |