Browse Source

Ingoing and outgoing dependencies

Former-commit-id: 191acc897b
tempestpy_adaptions
Mavo 9 years ago
parent
commit
2e4afbc69b
  1. 3
      src/storage/dft/DFTBuilder.cpp
  2. 2
      src/storage/dft/DFTElements.cpp
  3. 53
      src/storage/dft/DFTElements.h

3
src/storage/dft/DFTBuilder.cpp

@ -41,7 +41,8 @@ namespace storm {
assert(mElements[dependency->nameDependent()]->isBasicElement()); assert(mElements[dependency->nameDependent()]->isBasicElement());
std::shared_ptr<DFTBE<ValueType>> dependentEvent = std::static_pointer_cast<DFTBE<ValueType>>(mElements[dependency->nameDependent()]); std::shared_ptr<DFTBE<ValueType>> dependentEvent = std::static_pointer_cast<DFTBE<ValueType>>(mElements[dependency->nameDependent()]);
dependency->initialize(triggerEvent, dependentEvent); dependency->initialize(triggerEvent, dependentEvent);
triggerEvent->addDependency(dependency);
triggerEvent->addOutgoingDependency(dependency);
dependentEvent->addIngoingDependency(dependency);
} }
// Sort elements topologically // Sort elements topologically

2
src/storage/dft/DFTElements.cpp

@ -7,7 +7,7 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
bool DFTElement<ValueType>::checkDontCareAnymore(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const { bool DFTElement<ValueType>::checkDontCareAnymore(storm::storage::DFTState<ValueType>& state, DFTStateSpaceGenerationQueues<ValueType>& queues) const {
if(!state.dontCare(mId) && !hasDependencies())
if(!state.dontCare(mId) && !hasOutgoingDependencies())
{ {
for(DFTGatePointer const& parent : mParents) { for(DFTGatePointer const& parent : mParents) {
if(state.isOperational(parent->id())) { if(state.isOperational(parent->id())) {

53
src/storage/dft/DFTElements.h

@ -35,13 +35,12 @@ namespace storm {
using DFTDependencyPointer = std::shared_ptr<DFTDependency<ValueType>>; using DFTDependencyPointer = std::shared_ptr<DFTDependency<ValueType>>;
using DFTDependencyVector = std::vector<DFTDependencyPointer>; using DFTDependencyVector = std::vector<DFTDependencyPointer>;
protected: protected:
size_t mId; size_t mId;
std::string mName; std::string mName;
size_t mRank = -1; size_t mRank = -1;
DFTGateVector mParents; DFTGateVector mParents;
DFTDependencyVector dependencies;
DFTDependencyVector mOutgoingDependencies;
public: public:
DFTElement(size_t id, std::string const& name) : DFTElement(size_t id, std::string const& name) :
@ -139,29 +138,30 @@ namespace storm {
return res; return res;
} }
bool addDependency(DFTDependencyPointer const& e) {
if(std::find(dependencies.begin(), dependencies.end(), e) != dependencies.end()) {
bool addOutgoingDependency(DFTDependencyPointer const& e) {
assert(e->triggerEvent()->id() == this->id());
if(std::find(mOutgoingDependencies.begin(), mOutgoingDependencies.end(), e) != mOutgoingDependencies.end()) {
return false; return false;
} }
else else
{ {
dependencies.push_back(e);
mOutgoingDependencies.push_back(e);
return true; return true;
} }
} }
bool hasDependencies() const {
return !dependencies.empty();
bool hasOutgoingDependencies() const {
return !mOutgoingDependencies.empty();
} }
size_t nrDependencies() const {
return dependencies.size();
size_t nrOutgoingDependencies() const {
return mOutgoingDependencies.size();
} }
DFTDependencyVector const& getDependencies() const {
return dependencies;
DFTDependencyVector const& getOutgoingDependencies() const {
return mOutgoingDependencies;
} }
virtual void extendSpareModule(std::set<size_t>& elementsInModule) const; virtual void extendSpareModule(std::set<size_t>& elementsInModule) const;
virtual size_t nrChildren() const = 0; virtual size_t nrChildren() const = 0;
@ -375,9 +375,14 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
class DFTBE : public DFTElement<ValueType> { class DFTBE : public DFTElement<ValueType> {
using DFTDependencyPointer = std::shared_ptr<DFTDependency<ValueType>>;
using DFTDependencyVector = std::vector<DFTDependencyPointer>;
protected:
ValueType mActiveFailureRate; ValueType mActiveFailureRate;
ValueType mPassiveFailureRate; ValueType mPassiveFailureRate;
DFTDependencyVector mIngoingDependencies;
public: public:
DFTBE(size_t id, std::string const& name, ValueType failureRate, ValueType dormancyFactor) : DFTBE(size_t id, std::string const& name, ValueType failureRate, ValueType dormancyFactor) :
@ -399,6 +404,30 @@ namespace storm {
ValueType const& passiveFailureRate() const { ValueType const& passiveFailureRate() const {
return mPassiveFailureRate; return mPassiveFailureRate;
} }
bool addIngoingDependency(DFTDependencyPointer const& e) {
assert(e->dependentEvent()->id() == this->id());
if(std::find(mIngoingDependencies.begin(), mIngoingDependencies.end(), e) != mIngoingDependencies.end()) {
return false;
}
else
{
mIngoingDependencies.push_back(e);
return true;
}
}
bool hasIngoingDependencies() const {
return !mIngoingDependencies.empty();
}
size_t nrIngoingDependencies() const {
return mIngoingDependencies.size();
}
DFTDependencyVector const& getIngoingDependencies() const {
return mIngoingDependencies;
}
std::string toString() const override { std::string toString() const override {
std::stringstream stream; std::stringstream stream;

Loading…
Cancel
Save