diff --git a/src/storage/dft/DFT.h b/src/storage/dft/DFT.h index a0059d81b..1f3e8cceb 100644 --- a/src/storage/dft/DFT.h +++ b/src/storage/dft/DFT.h @@ -10,6 +10,7 @@ #include #include "DFTElements.h" +#include "elements/DFTRestriction.h" #include "../BitVector.h" #include "SymmetricUnits.h" #include "../../utility/math.h" diff --git a/src/storage/dft/DFTElements.cpp b/src/storage/dft/DFTElements.cpp index e06b3fe7d..9d21e5dd4 100644 --- a/src/storage/dft/DFTElements.cpp +++ b/src/storage/dft/DFTElements.cpp @@ -52,7 +52,7 @@ namespace storm { template std::vector DFTElement::independentSubDft() const { - std::cout << "INDEPENDENT SUBTREE CALL " << this->id() << std::endl; + //std::cout << "INDEPENDENT SUBTREE CALL " << this->id() << std::endl; std::vector res; res.push_back(this->id()); return res; diff --git a/src/storage/dft/DFTElements.h b/src/storage/dft/DFTElements.h index db1f0f6cf..bb4be80a7 100644 --- a/src/storage/dft/DFTElements.h +++ b/src/storage/dft/DFTElements.h @@ -159,6 +159,18 @@ namespace storm { DFTGateVector const& parents() const { return mParents; } + + bool hasRestrictions() const { + return !mRestrictions.empty(); + } + + size_t nrRestrictions() const { + return mRestrictions.size(); + } + + DFTRestrictionVector const& restrictions() const { + return mRestrictions; + } std::vector parentIds() const { std::vector res; @@ -371,7 +383,11 @@ namespace storm { queues.propagateFailure(parent); } } + for(std::shared_ptr> restr : this->mRestrictions) { + queues.checkRestrictionLater(restr); + } state.setFailed(this->mId); + // TODO can this be moved towards DFTSpare? if (this->isSpareGate()) { this->finalizeSpare(state); } diff --git a/src/storage/dft/DFTStateSpaceGenerationQueues.h b/src/storage/dft/DFTStateSpaceGenerationQueues.h index b881a220b..6ded7cb38 100644 --- a/src/storage/dft/DFTStateSpaceGenerationQueues.h +++ b/src/storage/dft/DFTStateSpaceGenerationQueues.h @@ -15,6 +15,8 @@ namespace storm { class DFTGate; template class DFTElement; + template + class DFTRestriction; template @@ -24,11 +26,14 @@ namespace storm { using DFTElementVector = std::vector; using DFTGatePointer = std::shared_ptr>; using DFTGateVector = std::vector; + using DFTRestrictionPointer = std::shared_ptr>; + using DFTRestrictionVector = std::vector; std::priority_queue> failurePropagation; DFTGateVector failsafePropagation; DFTElementVector dontcarePropagation; DFTElementVector activatePropagation; + DFTRestrictionVector restrictionChecks; public: void propagateFailure(DFTGatePointer const& elem) { @@ -45,6 +50,21 @@ namespace storm { return next; } + bool restrictionChecksDone() const { + return restrictionChecks.empty(); + } + + DFTRestrictionPointer nextRestrictionCheck() { + assert(!restrictionChecksDone()); + DFTRestrictionPointer next = restrictionChecks.back(); + restrictionChecks.pop_back(); + return next; + } + + void checkRestrictionLater(DFTRestrictionPointer const& restr) { + restrictionChecks.push_back(restr); + } + bool failsafePropagationDone() const { return failsafePropagation.empty(); } diff --git a/src/storage/dft/elements/DFTRestriction.h b/src/storage/dft/elements/DFTRestriction.h index 464c49db2..0d8651e50 100644 --- a/src/storage/dft/elements/DFTRestriction.h +++ b/src/storage/dft/elements/DFTRestriction.h @@ -127,7 +127,7 @@ namespace storm { protected: void fail(DFTState& state, DFTStateSpaceGenerationQueues& queues) const { - //state.restrictionViolated(this->mId); + state.markAsInvalid(); } void failsafe(DFTState& state, DFTStateSpaceGenerationQueues& queues) const { @@ -187,7 +187,7 @@ namespace storm { } void checkFailsafe(storm::storage::DFTState& state, DFTStateSpaceGenerationQueues& queues) const override { - assert(this->hasFailsafeChild(state)); + }