Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DftNextStateGenerator.h
Go to the documentation of this file.
1#pragma once
2
5
7
8namespace storm::dft {
9namespace generator {
10
14template<typename ValueType, typename StateType = uint32_t>
16 // TODO: inherit from NextStateGenerator
17
18 using DFTStatePointer = std::shared_ptr<storm::dft::storage::DFTState<ValueType>>;
19 using DFTElementPointer = std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType>>;
20 using DFTGatePointer = std::shared_ptr<storm::dft::storage::elements::DFTGate<ValueType>>;
21 using DFTRestrictionPointer = std::shared_ptr<storm::dft::storage::elements::DFTRestriction<ValueType>>;
22
23 public:
24 typedef std::function<StateType(DFTStatePointer const&)> StateToIdCallback;
25
27
28 bool isDeterministicModel() const;
29 std::vector<StateType> getInitialStates(StateToIdCallback const& stateToIdCallback);
30
31 void load(storm::storage::BitVector const& state);
32 void load(DFTStatePointer const& state);
33
40 storm::generator::StateBehavior<ValueType, StateType> expand(StateToIdCallback const& stateToIdCallback, bool takeFirstDependency);
41
50
56 DFTStatePointer createInitialState() const;
57
66 DFTStatePointer createSuccessorState(DFTStatePointer const origState, std::shared_ptr<storm::dft::storage::elements::DFTBE<ValueType> const> be) const;
67
80 DFTStatePointer createSuccessorState(DFTStatePointer const origState,
81 std::shared_ptr<storm::dft::storage::elements::DFTDependency<ValueType> const> dependency,
82 bool dependencySuccessful = true) const;
83
90 void propagateFailure(DFTStatePointer newState, std::shared_ptr<storm::dft::storage::elements::DFTBE<ValueType> const>& nextBE,
92
99 void propagateFailsafe(DFTStatePointer newState, std::shared_ptr<storm::dft::storage::elements::DFTBE<ValueType> const>& nextBE,
101
102 private:
112 storm::generator::StateBehavior<ValueType, StateType> exploreState(StateToIdCallback const& stateToIdCallback, bool exploreDependencies,
113 bool takeFirstDependency);
114
122 std::pair<StateType, bool> getNewStateId(DFTStatePointer state, StateToIdCallback const& stateToIdCallback) const;
123
124 // The dft used for the generation of next states.
126
127 // General information for the state generation.
128 storm::dft::storage::DFTStateGenerationInfo const& mStateGenerationInfo;
129
130 // Current state
131 DFTStatePointer state;
132
133 // Flag indicating whether all failed states should be merged into one unique failed state.
134 bool uniqueFailedState;
135
136 // Flag indicating whether the model is deterministic.
137 bool deterministicModel = false;
138};
139
140} // namespace generator
141} // namespace storm::dft
void propagateFailure(DFTStatePointer newState, std::shared_ptr< storm::dft::storage::elements::DFTBE< ValueType > const > &nextBE, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const
Propagate the failures in a given state if the given BE fails.
DftNextStateGenerator(storm::dft::storage::DFT< ValueType > const &dft, storm::dft::storage::DFTStateGenerationInfo const &stateGenerationInfo)
DFTStatePointer createSuccessorState(DFTStatePointer const origState, std::shared_ptr< storm::dft::storage::elements::DFTBE< ValueType > const > be) const
Create successor state from given state by letting the given BE fail next.
void load(storm::storage::BitVector const &state)
storm::generator::StateBehavior< ValueType, StateType > createMergeFailedState(StateToIdCallback const &stateToIdCallback)
Create unique failed state.
storm::generator::StateBehavior< ValueType, StateType > expand(StateToIdCallback const &stateToIdCallback, bool takeFirstDependency)
Expand and explore current state.
std::vector< StateType > getInitialStates(StateToIdCallback const &stateToIdCallback)
DFTStatePointer createInitialState() const
Create initial state.
std::function< StateType(DFTStatePointer const &)> StateToIdCallback
void propagateFailsafe(DFTStatePointer newState, std::shared_ptr< storm::dft::storage::elements::DFTBE< ValueType > const > &nextBE, storm::dft::storage::DFTStateSpaceGenerationQueues< ValueType > &queues) const
Propagate the failsafe state in a given state if the given BE fails.
Represents a Dynamic Fault Tree.
Definition DFT.h:50
Abstract base class for basic events (BEs) in DFTs.
Definition DFTBE.h:14
Dependency gate with probability p.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16