24 double const mttfPrecision,
double const mttfStepsize, std::string
const mttfAlgorithmName,
bool const calculateMCS,
25 bool const calculateProbability,
bool const useModularisation, std::string
const importanceMeasureName,
26 std::vector<double>
const& timepoints, std::vector<std::shared_ptr<storm::logic::Formula const>>
const& properties,
27 std::vector<std::string>
const& additionalRelevantEventNames,
size_t const chunksize) {
29 if (mttfAlgorithmName ==
"proceeding") {
31 }
else if (mttfAlgorithmName ==
"variableChange") {
36 if (useModularisation && calculateProbability) {
39 for (
auto const& timebound : timepoints) {
41 std::cout <<
"System failure probability at timebound " << timebound <<
" is " << probability <<
'\n';
44 auto const probabilities{checker.getProbabilitiesAtTimepoints(timepoints, chunksize)};
45 for (
size_t i{0}; i < timepoints.size(); ++i) {
46 auto const timebound{timepoints[i]};
47 auto const probability{probabilities[i]};
48 std::cout <<
"System failure probability at timebound " << timebound <<
" is " << probability <<
'\n';
51 if (!properties.empty()) {
52 auto const probabilities{checker.check(properties, chunksize)};
53 for (
size_t i{0}; i < probabilities.size(); ++i) {
54 std::cout <<
"Property \"" << properties.at(i)->toString() <<
"\" has result " << probabilities.at(i) <<
'\n';
59 STORM_LOG_THROW(dft->nrDynamicElements() == 0, storm::exceptions::NotSupportedException,
61 "Bdds can only be used on static fault trees. "
62 "Try modularisation.");
65 auto sylvanBddManager{std::make_shared<storm::dft::storage::SylvanBddManager>()};
66 sylvanBddManager->execute([&]() {
72 checker->exportBddToDot(filename);
76 auto const minimalCutSets{checker->getMinimalCutSetsAsIndices()};
77 auto const sylvanBddManager{checker->getSylvanBddManager()};
80 for (
auto const& minimalCutSet : minimalCutSets) {
82 for (
auto const& be : minimalCutSet) {
83 std::cout << sylvanBddManager->getName(be) <<
' ';
90 if (calculateProbability) {
92 for (
auto const& timebound : timepoints) {
93 auto const probability{checker->getProbabilityAtTimebound(timebound)};
94 std::cout <<
"System failure probability at timebound " << timebound <<
" is " << probability <<
'\n';
97 auto const probabilities{checker->getProbabilitiesAtTimepoints(timepoints, chunksize)};
98 for (
size_t i{0}; i < timepoints.size(); ++i) {
99 auto const timebound{timepoints[i]};
100 auto const probability{probabilities[i]};
101 std::cout <<
"System failure probability at timebound " << timebound <<
" is " << probability <<
'\n';
105 if (!properties.empty()) {
106 auto const probabilities{adapter.check(chunksize)};
107 for (
size_t i{0}; i < probabilities.size(); ++i) {
108 std::cout <<
"Property \"" << properties.at(i)->toString() <<
"\" has result " << probabilities.at(i) <<
'\n';
113 if (importanceMeasureName !=
"" && timepoints.size() == 1) {
114 auto const bes{dft->getBasicElements()};
115 std::vector<double> values{};
116 if (importanceMeasureName ==
"MIF") {
117 values = checker->getAllBirnbaumFactorsAtTimebound(timepoints[0]);
119 if (importanceMeasureName ==
"CIF") {
120 values = checker->getAllCIFsAtTimebound(timepoints[0]);
122 if (importanceMeasureName ==
"DIF") {
123 values = checker->getAllDIFsAtTimebound(timepoints[0]);
125 if (importanceMeasureName ==
"RAW") {
126 values = checker->getAllRAWsAtTimebound(timepoints[0]);
128 if (importanceMeasureName ==
"RRW") {
129 values = checker->getAllRRWsAtTimebound(timepoints[0]);
132 for (
size_t i{0}; i < bes.size(); ++i) {
133 std::cout << importanceMeasureName <<
" for the basic event " << bes[i]->name() <<
" at timebound " << timepoints[0] <<
" is " << values[i]
136 }
else if (importanceMeasureName !=
"") {
137 auto const bes{dft->getBasicElements()};
138 std::vector<std::vector<double>> values{};
139 if (importanceMeasureName ==
"MIF") {
140 values = checker->getAllBirnbaumFactorsAtTimepoints(timepoints, chunksize);
142 if (importanceMeasureName ==
"CIF") {
143 values = checker->getAllCIFsAtTimepoints(timepoints, chunksize);
145 if (importanceMeasureName ==
"DIF") {
146 values = checker->getAllDIFsAtTimepoints(timepoints, chunksize);
148 if (importanceMeasureName ==
"RAW") {
149 values = checker->getAllRAWsAtTimepoints(timepoints, chunksize);
151 if (importanceMeasureName ==
"RRW") {
152 values = checker->getAllRRWsAtTimepoints(timepoints, chunksize);
154 for (
size_t i{0}; i < bes.size(); ++i) {
155 for (
size_t j{0}; j < timepoints.size(); ++j) {
156 std::cout << importanceMeasureName <<
" for the basic event " << bes[i]->name() <<
" at timebound " << timepoints[j] <<
" is "
157 << values[i][j] <<
'\n';
166 bool const calculateMttf,
double const mttfPrecision,
double const mttfStepsize, std::string
const mttfAlgorithmName,
167 bool const calculateMCS,
bool const calculateProbability,
bool const useModularisation, std::string
const importanceMeasureName,
168 std::vector<double>
const& timepoints, std::vector<std::shared_ptr<storm::logic::Formula const>>
const& properties,
169 std::vector<std::string>
const& additionalRelevantEventNames,
size_t const chunksize) {
170 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"BDD analysis is not supportet for this data type.");
173template<
typename ValueType>
178template<
typename ValueType>
180 std::stringstream stream;
194 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Export to SMT does not support this data type.");
199 uint64_t solverTimeout = 10;
211 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Analysis by SMT not supported for this data type.");
220 std::set<uint64_t> dontCareElements;
223 for (std::size_t i = 0; i < dft.
nrElements(); i++) {
224 dontCareElements.insert(dft.
getElement(i)->id());
233 std::shared_ptr<storm::gspn::GSPN> gspn(gspnTransformator.
obtainGSPN());
239 STORM_LOG_THROW(
false, storm::exceptions::NotSupportedException,
"Transformation to GSPN not supported for this data type.");
245 std::shared_ptr<storm::jani::Model> model(builder.
build(
"dft_gspn"));
248 std::shared_ptr<storm::expressions::ExpressionManager>
const& exprManager = gspn.
getExpressionManager();
253 auto failedFormula = std::make_shared<storm::logic::AtomicExpressionFormula>(targetExpression);
254 auto properties = builder.
getStandardProperties(model.get(), failedFormula,
"Failed",
"a failed state",
true);
259 auto const& jani = storm::settings::getModule<storm::settings::modules::JaniExportSettings>();
267 std::vector<std::string>
const& additionalRelevantEventNames) {
storm::jani::Model * build(std::string const &automatonName="gspn_automaton")
std::vector< storm::jani::Property > getStandardProperties(storm::jani::Model *model, std::shared_ptr< storm::logic::AtomicExpressionFormula > atomicFormula, std::string name, std::string description, bool maximal)
Get standard properties (reachability, time bounded reachability, expected time) for a given atomic f...
storm::jani::Variable const & getPlaceVariable(uint64_t placeId) const
storm::jani::Variable const & addTransientVariable(storm::jani::Model *model, std::string name, storm::expressions::Expression expression)
Add transient variable representing given expression.
void setSolverTimeout(uint_fast64_t milliseconds)
Set the timeout of the solver.
void toFile(std::string const &)
void convert()
Generate general variables and constraints for the DFT and store them in the corresponding maps and v...
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.
DFT analysis via modularization.
ValueType getProbabilityAtTimebound(ValueType const timebound)
Calculate the probability of failure for the given time bound.
This class represents the settings for operations concerning the DFT to GSPN transformation.
bool isExtendPriorities() const
Retrieves whether the experimental setting of priorities should be used.
bool isDisableSmartTransformation() const
Retrieves whether the smart transformation should be disabled.
bool isWriteToJaniSet() const
Retrieves whether the GSPN should be exported as a Jani file.
bool isMergeDCFailed() const
Retrieves whether the DC and failed place should be merged.
std::string getWriteToJaniFilename() const
Retrieves the jani filename for export.
This class represents the settings for DFT model checking.
bool isDisableDC() const
Retrieves whether the option to disable Dont Care propagation is set.
Represents a Dynamic Fault Tree.
DFTElementCPointer getElement(size_t index) const
Get a pointer to an element in the DFT.
size_t nrElements() const
static void toFile(storm::dft::storage::DFT< ValueType > const &dft, std::string const &filepath)
Export DFT to given file.
static void toStream(storm::dft::storage::DFT< ValueType > const &dft, std::ostream &os)
Export DFT to given stream.
void insertNamesFromProperties(ForwardIt first, ForwardIt last)
Add relevant event names required by the labels in properties of a range.
storm::expressions::Expression getExpression() const
Retrieves an expression that represents the variable.
std::shared_ptr< storm::expressions::ExpressionManager > const & getExpressionManager() const
Obtain the expression manager used for expressions over GSPNs.
storm::expressions::Variable const & getExpressionVariable() const
Retrieves the associated expression variable.
#define STORM_LOG_THROW(cond, exception, message)
void exportJaniToFile(storm::jani::Model const &model, std::vector< storm::jani::Property > const &properties, std::string const &filename, bool compact)
std::shared_ptr< storm::jani::Model > transformToJani(storm::gspn::GSPN const &gspn, uint64_t toplevelFailedPlace)
Transform GSPN to Jani model.
void exportDFTToJsonFile(storm::dft::storage::DFT< ValueType > const &dft, std::string const &file)
Export DFT to JSON file.
void analyzeDFTBdd(std::shared_ptr< storm::dft::storage::DFT< double > > const &dft, bool const exportToDot, std::string const &filename, bool const calculateMttf, double const mttfPrecision, double const mttfStepsize, std::string const mttfAlgorithmName, bool const calculateMCS, bool const calculateProbability, bool const useModularisation, std::string const importanceMeasureName, std::vector< double > const &timepoints, std::vector< std::shared_ptr< storm::logic::Formula const > > const &properties, std::vector< std::string > const &additionalRelevantEventNames, size_t const chunksize)
std::pair< std::shared_ptr< storm::gspn::GSPN >, uint64_t > transformToGSPN(storm::dft::storage::DFT< double > const &dft)
std::string exportDFTToJsonString(storm::dft::storage::DFT< ValueType > const &dft)
Export DFT to JSON string.
storm::dft::utility::RelevantEvents computeRelevantEvents(std::vector< std::shared_ptr< storm::logic::Formula const > > const &properties, std::vector< std::string > const &additionalRelevantEventNames)
Get relevant event ids from given relevant event names and labels in properties.
void exportDFTToSMT(storm::dft::storage::DFT< double > const &dft, std::string const &file)
void analyzeDFTSMT(storm::dft::storage::DFT< double > const &dft, bool printOutput)
double MTTFHelperVariableChange(std::shared_ptr< storm::dft::storage::DFT< double > > const dft, double const stepsize)
Tries to numerically approximate the mttf of the given dft by integrating 1 - cdf(dft) by changing th...
double MTTFHelperProceeding(std::shared_ptr< storm::dft::storage::DFT< double > > const dft, double const stepsize, double const precision)
Tries to numerically approximate the mttf of the given dft by integrating 1 - cdf(dft) with Simpson's...