17namespace modelchecker {
19template<
typename ValueType>
21 : dft{dft}, modelchecker(true), sylvanBddManager{
std::make_shared<
storm::dft::storage::SylvanBddManager>()} {
25 STORM_LOG_DEBUG(
"Modularization found the following modules:\n" << topModule.toString(*dft));
28 populateDynamicModules(topModule);
31template<
typename ValueType>
35 dynamicModules.push_back(module);
38 for (
auto const& submodule : module.getSubModules()) {
39 populateDynamicModules(submodule);
44template<
typename ValueType>
48 std::set<ValueType> timepointSet;
49 for (
auto const& formula : formulas) {
52 std::vector<ValueType> timepoints(timepointSet.begin(), timepointSet.end());
54 auto newDft = replaceDynamicModules(timepoints);
57 return checker.
check(chunksize);
60template<
typename ValueType>
62 auto newDft = replaceDynamicModules(timepoints);
67template<
typename ValueType>
70 std::map<size_t, std::map<ValueType, ValueType>> samplePoints;
73 for (
auto const& mod : dynamicModules) {
75 auto result = analyseDynamicModule(mod, timepoints);
77 std::map<ValueType, ValueType> activeSamples{};
78 for (
size_t i{0}; i < timepoints.size(); ++i) {
79 auto const probability{boost::get<ValueType>(result[i])};
80 auto const timebound{timepoints[i]};
81 activeSamples[timebound] = probability;
83 samplePoints.insert({
mod.getRepresentative(), activeSamples});
87 std::set<size_t> dynamicElements;
88 for (
auto const& mod : dynamicModules) {
89 dynamicElements.merge(
mod.getAllElements());
94 std::unordered_set<std::string> depInConflict;
95 for (
auto const id : dft->getAllIds()) {
96 auto const element{dft->getElement(
id)};
97 auto it = samplePoints.find(
id);
98 if (it != samplePoints.end()) {
101 }
else if (dynamicElements.find(
id) == dynamicElements.end()) {
103 builder.cloneElement(element);
105 if (element->isDependency() && dft->isDependencyInConflict(
id)) {
106 depInConflict.insert(element->name());
110 builder.setTopLevel(dft->getTopLevelElement()->name());
112 auto newDft = std::make_shared<storm::dft::storage::DFT<ValueType>>(builder.build());
114 for (
size_t id : newDft->getDependencies()) {
116 if (depInConflict.find(newDft->getElement(
id)->name()) == depInConflict.end()) {
117 newDft->setDependencyNotInConflict(
id);
120 STORM_LOG_DEBUG(
"Remaining static FT: " << newDft->getElementsString());
124template<
typename ValueType>
130 auto subDft =
module.getSubtree(*dft);
133 std::stringstream propertyStream{};
134 for (
auto const timebound : timepoints) {
135 propertyStream <<
"Pmin=? [F<=" << timebound <<
"\"failed\"];";
139 return std::move(modelchecker.check(subDft, props,
false,
false, {}));
143template class DftModularizationChecker<double>;
void addBasicElementSamples(std::string const &name, std::map< ValueType, ValueType > const &activeSamples)
Create BE with distribution given by sample points and add it to DFT.
std::vector< boost::variant< ValueType, approximation_result > > dft_results
DFT analysis via modularization.
typename DFTModelChecker< ValueType >::property_vector FormulaVector
DftModularizationChecker(std::shared_ptr< storm::dft::storage::DFT< ValueType > > dft)
Initializes and computes all modules.
std::vector< ValueType > getProbabilitiesAtTimepoints(std::vector< ValueType > const &timepoints, size_t chunksize=0)
Calculate the probability of failure for the given time points.
std::vector< ValueType > check(FormulaVector const &formulas, size_t chunksize=0)
Calculate the properties specified by the formulas.
Main class for the SFTBDDChecker.
std::vector< ValueType > getProbabilitiesAtTimepoints(std::vector< ValueType > const &timepoints, size_t const chunksize=0)
Represents a Dynamic Fault Tree.
Represents an independent module/subtree.
bool isStatic() const
Returns whether the module contains only static elements (except in sub-modules).
bool isFullyStatic() const
Returns whether the module contains only static elements (also in sub-modules).
size_t getRepresentative() const
Get representative (top element of subtree).
Find modules (independent subtrees) in DFT.
storm::dft::storage::DftIndependentModule computeModules(storm::dft::storage::DFT< ValueType > const &dft)
Compute modules of DFT by applying the LTA/DR algorithm.
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_ASSERT(cond, message)
std::vector< storm::jani::Property > parseProperties(storm::parser::FormulaParser &formulaParser, std::string const &inputString, boost::optional< std::set< std::string > > const &propertyFilter)
std::vector< std::shared_ptr< storm::logic::Formula const > > extractFormulasFromProperties(std::vector< storm::jani::Property > const &properties)
IntegerType mod(IntegerType const &first, IntegerType const &second)