Browse Source

Fixed labeling when using multiple failed states

tempestpy_adaptions
Matthias Volk 8 years ago
parent
commit
69e2aac5c9
  1. 2
      src/storm-dft/builder/ExplicitDFTModelBuilder.h
  2. 7
      src/storm-dft/builder/ExplicitDFTModelBuilderApprox.cpp
  3. 14
      src/storm-dft/builder/ExplicitDFTModelBuilderApprox.h

2
src/storm-dft/builder/ExplicitDFTModelBuilder.h

@ -60,7 +60,7 @@ namespace storm {
storm::storage::BitVectorHashMap<uint_fast64_t> mStates;
std::vector<std::pair<uint_fast64_t, storm::storage::BitVector>> mPseudoStatesMapping; // vector of (id to concrete state, bitvector)
size_t newIndex = 0;
bool mergeFailedStates = true;
bool mergeFailedStates = false;
bool enableDC = true;
size_t failedIndex = 0;
size_t initialStateIndex = 0;

7
src/storm-dft/builder/ExplicitDFTModelBuilderApprox.cpp

@ -169,7 +169,7 @@ namespace storm {
modelComponents.deterministicModel = generator.isDeterministicModel();
// Fix the entries in the transition matrix according to the mapping of ids to row group indices
STORM_LOG_ASSERT(matrixBuilder.stateRemapping[initialStateIndex] == initialStateIndex, "Initial state should not be remapped.");
STORM_LOG_ASSERT(matrixBuilder.getRemapping(initialStateIndex) == initialStateIndex, "Initial state should not be remapped.");
// TODO Matthias: do not consider all rows?
STORM_LOG_TRACE("Remap matrix: " << matrixBuilder.stateRemapping << ", offset: " << matrixBuilder.mappingOffset);
matrixBuilder.remap();
@ -230,7 +230,7 @@ namespace storm {
StateType skippedIndex = nrExpandedStates;
std::map<StateType, std::pair<DFTStatePointer, ExplorationHeuristicPointer>> skippedStatesNew;
for (size_t id = 0; id < matrixBuilder.stateRemapping.size(); ++id) {
StateType index = matrixBuilder.stateRemapping[id];
StateType index = matrixBuilder.getRemapping(id);
auto itFind = skippedStates.find(index);
if (itFind != skippedStates.end()) {
// Set new mapping for skipped state
@ -405,6 +405,7 @@ namespace storm {
modelComponents.stateLabeling = storm::models::sparse::StateLabeling(modelComponents.transitionMatrix.getRowGroupCount());
// Initial state
modelComponents.stateLabeling.addLabel("init");
STORM_LOG_ASSERT(matrixBuilder.getRemapping(initialStateIndex) == initialStateIndex, "Initial state should not be remapped.");
modelComponents.stateLabeling.addLabelToState("init", initialStateIndex);
// Label all states corresponding to their status (failed, failsafe, failed BE)
if(labelOpts.buildFailLabel) {
@ -428,7 +429,7 @@ namespace storm {
}
for (auto const& stateIdPair : stateStorage.stateToId) {
storm::storage::BitVector state = stateIdPair.first;
size_t stateId = stateIdPair.second;
size_t stateId = matrixBuilder.getRemapping(stateIdPair.second);
if (!mergeFailedStates && labelOpts.buildFailLabel && dft.hasFailed(state, *stateGenerationInfo)) {
modelComponents.stateLabeling.addLabelToState("failed", stateId);
}

14
src/storm-dft/builder/ExplicitDFTModelBuilderApprox.h

@ -116,6 +116,18 @@ namespace storm {
return currentRowGroup;
}
/*!
* Get the remapped state for the given id.
*
* @param id State.
*
* @return Remapped index.
*/
StateType getRemapping(StateType id) {
STORM_LOG_ASSERT(id < stateRemapping.size(), "Invalid index for remapping.");
return stateRemapping[id];
}
// Matrix builder.
storm::storage::SparseMatrixBuilder<ValueType> builder;
@ -287,7 +299,7 @@ namespace storm {
bool enableDC = true;
//TODO Matthias: make changeable
const bool mergeFailedStates = true;
const bool mergeFailedStates = false;
// Heuristic used for approximation
storm::builder::ApproximationHeuristic usedHeuristic;

Loading…
Cancel
Save