6uint64_t FailureBoundFinder::correctLowerBound(std::shared_ptr<storm::dft::modelchecker::DFTASFChecker> smtchecker, uint64_t bound, uint_fast64_t timeout) {
7 STORM_LOG_DEBUG(
"Lower bound correction - try to correct bound " << std::to_string(bound));
8 uint64_t boundCandidate = bound;
9 uint64_t nrDepEvents = 0;
10 uint64_t nrNonMarkovian = 0;
11 auto dft = smtchecker->getDFT();
14 for (
size_t i = 0;
i < dft.nrElements(); ++
i) {
15 std::shared_ptr<storm::dft::storage::elements::DFTElement<double>
const> element = dft.getElement(i);
16 if (element->isBasicElement()) {
17 auto be = std::static_pointer_cast<storm::dft::storage::elements::DFTBE<double>
const>(element);
18 if (be->hasIngoingDependencies()) {
25 while (nrNonMarkovian <= nrDepEvents && boundCandidate >= 0) {
26 if (nrNonMarkovian == 0 and boundCandidate == 0) {
29 STORM_LOG_TRACE(
"Lower bound correction - check possible bound " << std::to_string(boundCandidate) <<
" with " << std::to_string(nrNonMarkovian)
30 <<
" non-Markovian states");
33 smtchecker->setSolverTimeout(timeout * 1000);
35 smtchecker->unsetSolverTimeout();
42 if (boundCandidate == 0) {
50 STORM_LOG_DEBUG(
"Lower bound correction - Solver returned 'Unknown', corrected to 1");
60 STORM_LOG_DEBUG(
"Lower bound correction - corrected bound to " << std::to_string(boundCandidate + 1));
61 return boundCandidate + 1;
64uint64_t FailureBoundFinder::correctUpperBound(std::shared_ptr<storm::dft::modelchecker::DFTASFChecker> smtchecker, uint64_t bound, uint_fast64_t timeout) {
65 STORM_LOG_DEBUG(
"Upper bound correction - try to correct bound " << std::to_string(bound));
66 uint64_t boundCandidate = bound;
67 uint64_t nrDepEvents = 0;
68 uint64_t nrNonMarkovian = 0;
69 uint64_t currentTimepoint = 0;
70 auto dft = smtchecker->getDFT();
72 for (
size_t i = 0;
i < dft.nrElements(); ++
i) {
73 std::shared_ptr<storm::dft::storage::elements::DFTElement<double>
const> element = dft.getElement(i);
74 if (element->isBasicElement()) {
75 auto be = std::static_pointer_cast<storm::dft::storage::elements::DFTBE<double>
const>(element);
76 if (be->hasIngoingDependencies()) {
81 while (boundCandidate >= 0) {
82 currentTimepoint = bound + 1;
83 while (currentTimepoint - boundCandidate > 0) {
85 nrNonMarkovian = currentTimepoint - boundCandidate;
86 STORM_LOG_TRACE(
"Upper bound correction - candidate " << std::to_string(boundCandidate) <<
" check split " << std::to_string(currentTimepoint)
87 <<
"|" << std::to_string(nrNonMarkovian));
88 smtchecker->setSolverTimeout(timeout * 1000);
90 smtchecker->unsetSolverTimeout();
94 STORM_LOG_DEBUG(
"Upper bound correction - corrected to bound " << boundCandidate <<
" (TLE can fail at sequence point "
95 << std::to_string(currentTimepoint) <<
" with "
96 << std::to_string(nrNonMarkovian) <<
" non-Markovian states)");
97 return boundCandidate;
100 STORM_LOG_DEBUG(
"Upper bound correction - Solver returned 'Unknown', corrected to bound " << bound);
112 STORM_LOG_DEBUG(
"Upper bound correction - corrected bound to " << std::to_string(boundCandidate));
113 return boundCandidate;
118 STORM_LOG_TRACE(
"Compute lower bound for number of BE failures necessary for the DFT to fail");
131 return correctLowerBound(std::make_shared<storm::dft::modelchecker::DFTASFChecker>(smtchecker), bound, timeout);
153 STORM_LOG_WARN(
"SMT encoding does not support rational functions");
159 STORM_LOG_TRACE(
"Compute bound for number of BE failures such that the DFT always fails");
175 return correctUpperBound(std::make_shared<storm::dft::modelchecker::DFTASFChecker>(smtchecker), bound, timeout);
196 STORM_LOG_WARN(
"SMT encoding does not support rational functions");
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.
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 checkTleFailsWithEq(uint64_t bound)
Check if there exists a sequence of BE failures of exactly given length such that the TLE of the DFT ...
Represents a Dynamic Fault Tree.
size_t nrBasicElements() const
std::vector< size_t > const & getDependencies() const
static uint64_t getLeastFailureBound(storm::dft::storage::DFT< double > const &dft, bool useSMT=false, uint_fast64_t timeout=10)
Get the minimal number of BEs necessary for the TLE to fail (lower bound for number of failures to ch...
static uint64_t getAlwaysFailedBound(storm::dft::storage::DFT< double > const &dft, bool useSMT=false, uint_fast64_t timeout=10)
Get the number of BE failures for which the TLE always fails (upper bound for number of failures to c...
CheckResult
possible check results
#define STORM_LOG_WARN(message)
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_TRACE(message)