17template<
typename ValueType>
19 : dft{dft}, modelchecker(true), sylvanBddManager{
storm::dft::
storage::SylvanBddManager::createWithDefaultEnvironment()} {
23 STORM_LOG_DEBUG(
"Modularization found the following modules:\n" << topModule.toString(*dft));
26 populateDynamicModules(topModule);
29template<
typename ValueType>
33 dynamicModules.push_back(module);
37 populateDynamicModules(submodule);
42template<
typename ValueType>
46 std::set<ValueType> timepointSet;
47 for (
auto const& formula : formulas) {
50 std::vector<ValueType> timepoints(timepointSet.begin(), timepointSet.end());
52 auto newDft = replaceDynamicModules(timepoints);
55 return checker.
check(chunksize);
58template<
typename ValueType>
60 auto newDft = replaceDynamicModules(timepoints);
65template<
typename ValueType>
66std::shared_ptr<storm::dft::storage::DFT<ValueType>> DftModularizationChecker<ValueType>::replaceDynamicModules(std::vector<ValueType>
const& timepoints) {
68 std::map<size_t, std::map<ValueType, ValueType>> samplePoints;
71 for (
auto const& mod : dynamicModules) {
73 auto result = analyseDynamicModule(mod, timepoints);
75 std::map<ValueType, ValueType> activeSamples{};
76 for (
size_t i{0}; i < timepoints.size(); ++i) {
77 auto const probability{boost::get<ValueType>(result[i])};
78 auto const timebound{timepoints[i]};
79 activeSamples[timebound] = probability;
81 samplePoints.insert({
mod.getRepresentative(), activeSamples});
85 std::set<size_t> dynamicElements;
86 for (
auto const& mod : dynamicModules) {
87 dynamicElements.merge(
mod.getAllElements());
91 storm::dft::builder::DFTBuilder<ValueType> builder{};
92 std::unordered_set<std::string> depInConflict;
93 for (
auto const id : dft->getAllIds()) {
94 auto const element{dft->getElement(
id)};
95 auto it = samplePoints.find(
id);
96 if (it != samplePoints.end()) {
99 }
else if (!dynamicElements.contains(
id)) {
103 if (element->isDependency() && dft->isDependencyInConflict(
id)) {
104 depInConflict.insert(element->name());
108 builder.
setTopLevel(dft->getTopLevelElement()->name());
110 auto newDft = std::make_shared<storm::dft::storage::DFT<ValueType>>(builder.
build());
112 for (
size_t id : newDft->getDependencies()) {
114 if (!depInConflict.contains(newDft->getElement(
id)->name())) {
115 newDft->setDependencyNotInConflict(
id);
118 STORM_LOG_DEBUG(
"Remaining static FT: " << newDft->getElementsString());
122template<
typename ValueType>
124 storm::dft::storage::DftIndependentModule
const& module, std::vector<ValueType>
const& timepoints) {
128 auto subDft =
module.getSubtree(*dft);
131 std::stringstream propertyStream{};
132 for (
auto const timebound : timepoints) {
133 propertyStream <<
"Pmin=? [F<=" << timebound <<
"\"failed\"];";
137 return modelchecker.check(subDft, props,
false,
false, {});
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.
storm::dft::storage::DFT< ValueType > build()
Create DFT.
void cloneElement(DFTElementCPointer element)
Clone element and add it via the builder.
void setTopLevel(std::string const &tle)
Set top level element.
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).
std::set< DftIndependentModule > const & getSubModules() const
Returns 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)