Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DFTASFChecker.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5#include <vector>
6
7#include "SmtConstraint.h"
11
12namespace storm::dft {
13namespace modelchecker {
14
16 public:
17 SpareAndChildPair(uint64_t spareIndex, uint64_t childIndex) : spareIndex(spareIndex), childIndex(childIndex) {}
18
19 friend bool operator<(SpareAndChildPair const& p1, SpareAndChildPair const& p2) {
20 return p1.spareIndex < p2.spareIndex || (p1.spareIndex == p2.spareIndex && p1.childIndex < p2.childIndex);
21 }
22
23 private:
24 uint64_t spareIndex;
25 uint64_t childIndex;
26};
27
29 public:
30 DependencyPair(uint64_t depIndex, uint64_t childIndex) : depIndex(depIndex), childIndex(childIndex) {}
31
32 friend bool operator<(DependencyPair const& p1, DependencyPair const& p2) {
33 return p1.depIndex < p2.depIndex || (p1.depIndex == p2.depIndex && p1.childIndex < p2.childIndex);
34 }
35
36 private:
37 uint64_t depIndex;
38 uint64_t childIndex;
39};
40
42 using ValueType = double;
43
44 public:
46
51 void convert();
52 void toFile(std::string const&);
53
57 void toSolver();
58
65
73
81
92 storm::solver::SmtSolver::CheckResult checkDependencyConflict(uint64_t dep1Index, uint64_t dep2Index, uint64_t timeout = 10);
93
99 void setSolverTimeout(uint_fast64_t milliseconds);
100
104 void unsetSolverTimeout();
105
110 return dft;
111 }
112
122 storm::solver::SmtSolver::CheckResult checkFailsLeqWithEqNonMarkovianState(uint64_t checkbound, uint64_t nrNonMarkovian);
123
132
133 private:
134 uint64_t getClaimVariableIndex(uint64_t spareIndex, uint64_t childIndex) const;
135
146 std::shared_ptr<SmtConstraint> generateTryToClaimConstraint(std::shared_ptr<storm::dft::storage::elements::DFTSpare<ValueType> const> spare,
147 uint64_t childIndex, uint64_t timepoint) const;
148
153 void generateAndConstraint(size_t i, std::vector<uint64_t> childVarIndices,
154 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
155
160 void generateOrConstraint(size_t i, std::vector<uint64_t> childVarIndices,
161 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
162
166 void generateVotConstraint(size_t i, std::vector<uint64_t> childVarIndices,
167 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
168
173 void generatePandConstraint(size_t i, std::vector<uint64_t> childVarIndices,
174 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
175
179 void generatePorConstraint(size_t i, std::vector<uint64_t> childVarIndices,
180 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
181
186 void generateSeqConstraint(std::vector<uint64_t> childVarIndices, std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
187
192 void generateSpareConstraint(size_t i, std::vector<uint64_t> childVarIndices,
193 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
194
199 void generatePdepConstraint(size_t i, std::vector<uint64_t> childVarIndices,
200 std::shared_ptr<storm::dft::storage::elements::DFTElement<ValueType> const> element);
201
206 void addClaimingConstraints();
207
212 void addMarkovianConstraints();
213
215 std::shared_ptr<storm::solver::SmtSolver> solver = nullptr;
216 std::vector<std::string> varNames;
217 std::unordered_map<uint64_t, uint64_t> timePointVariables;
218 std::vector<std::shared_ptr<SmtConstraint>> constraints;
219 std::map<SpareAndChildPair, uint64_t> claimVariables;
220 std::unordered_map<uint64_t, uint64_t> dependencyVariables;
221 std::unordered_map<uint64_t, uint64_t> markovianVariables;
222 std::vector<uint64_t> tmpTimePointVariables;
223 uint64_t notFailed;
224};
225
226} // namespace modelchecker
227} // namespace storm::dft
storm::solver::SmtSolver::CheckResult checkTleFailsWithLeq(uint64_t bound)
Check if there exists a sequence of BE failures of at least given length such that the TLE of the DFT...
void setSolverTimeout(uint_fast64_t milliseconds)
Set the timeout of the solver.
storm::solver::SmtSolver::CheckResult checkFailsAtTimepointWithEqNonMarkovianState(uint64_t timepoint, uint64_t nrNonMarkovian)
Helper function that checks if the DFT can fail at a timepoint while visiting a given number of Marko...
storm::dft::storage::DFT< ValueType > const & getDFT()
Get a reference to the DFT.
void convert()
Generate general variables and constraints for the DFT and store them in the corresponding maps and v...
storm::solver::SmtSolver::CheckResult checkFailsLeqWithEqNonMarkovianState(uint64_t checkbound, uint64_t nrNonMarkovian)
Helper function to check if the TLE fails before or at a given timepoint while visiting exactly a giv...
void toSolver()
Generates a new solver instance and prepares it for SMT checking of the DFT.
void unsetSolverTimeout()
Unset the timeout for the solver.
storm::solver::SmtSolver::CheckResult checkTleNeverFailed()
Check if the TLE of the DFT never fails.
storm::solver::SmtSolver::CheckResult checkDependencyConflict(uint64_t dep1Index, uint64_t dep2Index, uint64_t timeout=10)
Check if two given dependencies are conflicting in their resolution, i.e.
storm::solver::SmtSolver::CheckResult checkTleFailsWithEq(uint64_t bound)
Check if there exists a sequence of BE failures of exactly given length such that the TLE of the DFT ...
friend bool operator<(DependencyPair const &p1, DependencyPair const &p2)
DependencyPair(uint64_t depIndex, uint64_t childIndex)
friend bool operator<(SpareAndChildPair const &p1, SpareAndChildPair const &p2)
SpareAndChildPair(uint64_t spareIndex, uint64_t childIndex)
Represents a Dynamic Fault Tree.
Definition DFT.h:52
Abstract base class for DFT elements.
Definition DFTElement.h:39
CheckResult
possible check results
Definition SmtSolver.h:25