Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTBE.h
Go to the documentation of this file.
1#pragma once
2
3#include "DFTElement.h"
4
5namespace storm::dft {
6namespace storage {
7namespace elements {
8
13template<typename ValueType>
14class DFTBE : public DFTElement<ValueType> {
15 public:
21 DFTBE(size_t id, std::string const& name) : DFTElement<ValueType>(id, name) {
22 // Intentionally empty
23 }
24
28
34
35 bool isBasicElement() const override {
36 return true;
37 }
38
39 bool isStaticElement() const override {
40 return true;
41 }
42
43 size_t nrChildren() const override {
44 return 0;
45 }
46
54 virtual ValueType getUnreliability(ValueType time) const = 0;
55
60 virtual bool canFail() const = 0;
61
66 void addIngoingDependency(std::shared_ptr<DFTDependency<ValueType>> const& dependency) {
67 STORM_LOG_ASSERT(dependency->containsDependentEvent(this->id()), "Dependency " << *dependency << " has no dependent BE " << *this << ".");
68 STORM_LOG_ASSERT(std::find(mIngoingDependencies.begin(), mIngoingDependencies.end(), dependency) == mIngoingDependencies.end(),
69 "Ingoing Dependency " << dependency << " already present.");
70 mIngoingDependencies.push_back(dependency);
71 }
72
78 return !mIngoingDependencies.empty();
79 }
80
85 size_t nrIngoingDependencies() const {
86 return mIngoingDependencies.size();
87 }
88
93 std::vector<std::shared_ptr<DFTDependency<ValueType>>> const& ingoingDependencies() const {
94 return mIngoingDependencies;
95 }
96
97 void extendSubDft(std::set<size_t>& elemsInSubtree, std::vector<size_t> const& parentsOfSubRoot, bool blockParents, bool sparesAsLeaves) const override;
98
102 state.beNoLongerFailable(this->id());
103 return true;
104 }
105 return false;
106 }
107
112 virtual std::string distributionString() const = 0;
113
114 virtual std::string toString() const override {
115 std::stringstream stream;
116 stream << "{" << this->name() << "} BE(" << this->distributionString() << ")";
117 return stream.str();
118 }
119
120 private:
121 std::vector<std::shared_ptr<DFTDependency<ValueType>>> mIngoingDependencies;
122};
123
124} // namespace elements
125} // namespace storage
126} // namespace storm::dft
void beNoLongerFailable(size_t id)
Definition DFTState.cpp:232
Abstract base class for basic events (BEs) in DFTs.
Definition DFTBE.h:14
size_t nrIngoingDependencies() const
Return the number of ingoing dependencies.
Definition DFTBE.h:85
void addIngoingDependency(std::shared_ptr< DFTDependency< ValueType > > const &dependency)
Add dependency which can trigger this BE.
Definition DFTBE.h:66
virtual std::string toString() const override
Print information about element to string.
Definition DFTBE.h:114
virtual ValueType getUnreliability(ValueType time) const =0
Return the unreliability of the BE up to the given time point.
std::vector< std::shared_ptr< DFTDependency< ValueType > > > const & ingoingDependencies() const
Return ingoing dependencies.
Definition DFTBE.h:93
bool isBasicElement() const override
Checks whether the element is a basic element.
Definition DFTBE.h:35
virtual storm::dft::storage::elements::BEType beType() const =0
Get type of BE (constant, exponential, etc.).
storm::dft::storage::elements::DFTElementType type() const override
Get type.
Definition DFTBE.h:25
DFTBE(size_t id, std::string const &name)
Constructor.
Definition DFTBE.h:21
void extendSubDft(std::set< size_t > &elemsInSubtree, std::vector< size_t > const &parentsOfSubRoot, bool blockParents, bool sparesAsLeaves) const override
Helper to the independent subtree computation.
Definition DFTBE.cpp:11
bool hasIngoingDependencies() const
Return whether the BE has ingoing dependencies.
Definition DFTBE.h:77
bool checkDontCareAnymore(storm::dft::storage::DFTState< ValueType > &state, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const override
Definition DFTBE.h:99
virtual bool canFail() const =0
Return whether the BE can fail.
size_t nrChildren() const override
Get number of children.
Definition DFTBE.h:43
bool isStaticElement() const override
Check whether the element is static, ie a BE or a static gate (AND, OR, VOT).
Definition DFTBE.h:39
virtual std::string distributionString() const =0
Print information about failure distribution to string.
Dependency gate with probability p.
Abstract base class for DFT elements.
Definition DFTElement.h:39
virtual size_t id() const
Get id.
Definition DFTElement.h:73
virtual std::string const & name() const
Get name.
Definition DFTElement.h:89
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
DFTElementType
Element types in a DFT.