Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SFTBDDChecker.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <memory>
5#include <set>
6#include <unordered_map>
7#include <utility>
8#include <vector>
9
14
15namespace storm::dft {
16namespace modelchecker {
17
23 public:
24 using ValueType = double;
25#ifdef STORM_HAVE_SYLVAN
26 using Bdd = sylvan::Bdd;
27#endif
28
29 SFTBDDChecker(std::shared_ptr<storm::dft::storage::DFT<ValueType>> dft, std::shared_ptr<storm::dft::storage::SylvanBddManager> sylvanBddManager);
30
32
36 std::shared_ptr<storm::dft::storage::DFT<ValueType>> getDFT() const;
37
41 std::shared_ptr<storm::dft::storage::SylvanBddManager> getSylvanBddManager() const;
42
46 std::shared_ptr<storm::dft::transformations::SftToBddTransformator<ValueType>> getTransformator() const;
47
55 void exportBddToDot(std::string const &filename) {
56#ifdef STORM_HAVE_SYLVAN
57 getSylvanBddManager()->exportBddToDot(getTopLevelElementBdd(), filename);
58#else
59 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException,
60 "This version of Storm was compiled without support for Sylvan. Yet, a method was called that requires this support. Please choose a "
61 "version of Storm with Sylvan support.");
62#endif
63 }
64
70 std::vector<std::vector<std::string>> getMinimalCutSets();
71
78 std::vector<std::vector<uint32_t>> getMinimalCutSetsAsIndices();
79
85#ifdef STORM_HAVE_SYLVAN
86 return getProbabilityAtTimebound(getTopLevelElementBdd(), timebound);
87#else
88 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException,
89 "This version of Storm was compiled without support for Sylvan. Yet, a method was called that requires this support. Please choose a "
90 "version of Storm with Sylvan support.");
91#endif
92 }
93
94#ifdef STORM_HAVE_SYLVAN
103 ValueType getProbabilityAtTimebound(Bdd bdd, ValueType timebound) const;
104#endif
105
117 std::vector<ValueType> getProbabilitiesAtTimepoints(std::vector<ValueType> const &timepoints, size_t const chunksize = 0) {
118#ifdef STORM_HAVE_SYLVAN
119 return getProbabilitiesAtTimepoints(getTopLevelElementBdd(), timepoints, chunksize);
120#else
121 STORM_LOG_THROW(false, storm::exceptions::MissingLibraryException,
122 "This version of Storm was compiled without support for Sylvan. Yet, a method was called that requires this support. Please choose a "
123 "version of Storm with Sylvan support.");
124#endif
125 }
126
127#ifdef STORM_HAVE_SYLVAN
143 std::vector<ValueType> getProbabilitiesAtTimepoints(Bdd bdd, std::vector<ValueType> const &timepoints, size_t chunksize = 0) const;
144#endif
145
151 ValueType getBirnbaumFactorAtTimebound(std::string const &beName, ValueType timebound);
152
162 std::vector<ValueType> getAllBirnbaumFactorsAtTimebound(ValueType timebound);
163
175 std::vector<ValueType> getBirnbaumFactorsAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize = 0);
176
188 std::vector<std::vector<ValueType>> getAllBirnbaumFactorsAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize = 0);
189
196 ValueType getCIFAtTimebound(std::string const &beName, ValueType timebound);
197
208 std::vector<ValueType> getAllCIFsAtTimebound(ValueType timebound);
209
220 std::vector<ValueType> getCIFsAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize = 0);
221
232 std::vector<std::vector<ValueType>> getAllCIFsAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize = 0);
233
240 ValueType getDIFAtTimebound(std::string const &beName, ValueType timebound);
241
252 std::vector<ValueType> getAllDIFsAtTimebound(ValueType timebound);
253
264 std::vector<ValueType> getDIFsAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize = 0);
265
276 std::vector<std::vector<ValueType>> getAllDIFsAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize = 0);
277
284 ValueType getRAWAtTimebound(std::string const &beName, ValueType timebound);
285
296 std::vector<ValueType> getAllRAWsAtTimebound(ValueType timebound);
297
308 std::vector<ValueType> getRAWsAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize = 0);
309
320 std::vector<std::vector<ValueType>> getAllRAWsAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize = 0);
321
328 ValueType getRRWAtTimebound(std::string const &beName, ValueType timebound);
329
340 std::vector<ValueType> getAllRRWsAtTimebound(ValueType timebound);
341
352 std::vector<ValueType> getRRWsAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize = 0);
353
364 std::vector<std::vector<ValueType>> getAllRRWsAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize = 0);
365
366 private:
367#ifdef STORM_HAVE_SYLVAN
382 void recursiveMCS(Bdd const bdd, std::vector<uint32_t> &buffer, std::vector<std::vector<uint32_t>> &minimalCutSets) const;
383
384 template<typename FuncType>
385 void chunkCalculationTemplate(std::vector<ValueType> const &timepoints, size_t chunksize, FuncType func) const;
386
387 template<typename FuncType>
388 ValueType getImportanceMeasureAtTimebound(std::string const &beName, ValueType timebound, FuncType func);
389
390 template<typename FuncType>
391 std::vector<ValueType> getAllImportanceMeasuresAtTimebound(ValueType timebound, FuncType func);
392
393 template<typename FuncType>
394 std::vector<ValueType> getImportanceMeasuresAtTimepoints(std::string const &beName, std::vector<ValueType> const &timepoints, size_t chunksize,
395 FuncType func);
396
397 template<typename FuncType>
398 std::vector<std::vector<ValueType>> getAllImportanceMeasuresAtTimepoints(std::vector<ValueType> const &timepoints, size_t chunksize, FuncType func);
399
404 Bdd getTopLevelElementBdd();
405
406 std::shared_ptr<storm::dft::transformations::SftToBddTransformator<ValueType>> transformator;
407#endif
408};
409
410} // namespace modelchecker
411} // namespace storm::dft
std::vector< ValueType > getAllRRWsAtTimebound(ValueType timebound)
ValueType getRAWAtTimebound(std::string const &beName, ValueType timebound)
std::vector< std::vector< ValueType > > getAllRAWsAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
ValueType getCIFAtTimebound(std::string const &beName, ValueType timebound)
std::vector< std::vector< ValueType > > getAllBirnbaumFactorsAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
std::vector< ValueType > getAllDIFsAtTimebound(ValueType timebound)
std::vector< ValueType > getAllRAWsAtTimebound(ValueType timebound)
std::vector< ValueType > getRRWsAtTimepoints(std::string const &beName, std::vector< ValueType > const &timepoints, size_t chunksize=0)
std::shared_ptr< storm::dft::storage::DFT< ValueType > > getDFT() const
std::vector< std::vector< ValueType > > getAllDIFsAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
ValueType getRRWAtTimebound(std::string const &beName, ValueType timebound)
std::vector< std::vector< ValueType > > getAllRRWsAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
std::vector< ValueType > getAllBirnbaumFactorsAtTimebound(ValueType timebound)
std::vector< ValueType > getRAWsAtTimepoints(std::string const &beName, std::vector< ValueType > const &timepoints, size_t chunksize=0)
ValueType getBirnbaumFactorAtTimebound(std::string const &beName, ValueType timebound)
std::vector< ValueType > getProbabilitiesAtTimepoints(std::vector< ValueType > const &timepoints, size_t const chunksize=0)
std::vector< std::vector< ValueType > > getAllCIFsAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
std::vector< ValueType > getBirnbaumFactorsAtTimepoints(std::string const &beName, std::vector< ValueType > const &timepoints, size_t chunksize=0)
std::shared_ptr< storm::dft::storage::SylvanBddManager > getSylvanBddManager() const
std::shared_ptr< storm::dft::transformations::SftToBddTransformator< ValueType > > getTransformator() const
std::vector< std::vector< uint32_t > > getMinimalCutSetsAsIndices()
std::vector< ValueType > getCIFsAtTimepoints(std::string const &beName, std::vector< ValueType > const &timepoints, size_t chunksize=0)
void exportBddToDot(std::string const &filename)
Exports the Bdd that represents the top level event to a file in the dot format.
std::vector< std::vector< std::string > > getMinimalCutSets()
std::vector< ValueType > getAllCIFsAtTimebound(ValueType timebound)
ValueType getDIFAtTimebound(std::string const &beName, ValueType timebound)
SFTBDDChecker(std::shared_ptr< storm::dft::storage::DFT< ValueType > > dft, std::shared_ptr< storm::dft::storage::SylvanBddManager > sylvanBddManager)
std::vector< ValueType > getDIFsAtTimepoints(std::string const &beName, std::vector< ValueType > const &timepoints, size_t chunksize=0)
ValueType getProbabilityAtTimebound(ValueType timebound)
Represents a Dynamic Fault Tree.
Definition DFT.h:49
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
SFTBDDChecker::ValueType ValueType