Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
FaultTreeSettings.cpp
Go to the documentation of this file.
1#include "FaultTreeSettings.h"
2
12
13namespace storm::dft {
14namespace settings {
15namespace modules {
16
17const std::string FaultTreeSettings::moduleName = "dft";
18const std::string FaultTreeSettings::noSymmetryReductionOptionName = "nosymmetryreduction";
19const std::string FaultTreeSettings::noSymmetryReductionOptionShortName = "nosymred";
20const std::string FaultTreeSettings::modularisationOptionName = "modularisation";
21const std::string FaultTreeSettings::disableDCOptionName = "disabledc";
22const std::string FaultTreeSettings::allowDCRelevantOptionName = "allowdcrelevant";
23const std::string FaultTreeSettings::relevantEventsOptionName = "relevantevents";
24const std::string FaultTreeSettings::addLabelsClaimingOptionName = "labels-claiming";
25const std::string FaultTreeSettings::approximationErrorOptionName = "approximation";
26const std::string FaultTreeSettings::approximationErrorOptionShortName = "approx";
27const std::string FaultTreeSettings::approximationHeuristicOptionName = "approximationheuristic";
28const std::string FaultTreeSettings::maxDepthOptionName = "maxdepth";
29const std::string FaultTreeSettings::firstDependencyOptionName = "firstdep";
30const std::string FaultTreeSettings::uniqueFailedBEOptionName = "uniquefailedbe";
31#ifdef STORM_HAVE_Z3
32const std::string FaultTreeSettings::solveWithSmtOptionName = "smt";
33#endif
34const std::string FaultTreeSettings::chunksizeOptionName = "chunksize";
35const std::string FaultTreeSettings::mttfPrecisionName = "mttf-precision";
36const std::string FaultTreeSettings::mttfStepsizeName = "mttf-stepsize";
37const std::string FaultTreeSettings::mttfAlgorithmName = "mttf-algorithm";
38
39FaultTreeSettings::FaultTreeSettings() : ModuleSettings(moduleName) {
40 this->addOption(storm::settings::OptionBuilder(moduleName, noSymmetryReductionOptionName, false, "Do not exploit symmetric structure of model.")
41 .setShortName(noSymmetryReductionOptionShortName)
42 .build());
43 this->addOption(
44 storm::settings::OptionBuilder(moduleName, modularisationOptionName, false, "Use modularisation (not applicable for expected time).").build());
45 this->addOption(storm::settings::OptionBuilder(moduleName, disableDCOptionName, false, "Disable Don't Care propagation.").build());
46 this->addOption(
47 storm::settings::OptionBuilder(moduleName, firstDependencyOptionName, false, "Avoid non-determinism by always taking the first possible dependency.")
48 .build());
49 this->addOption(
50 storm::settings::OptionBuilder(moduleName, relevantEventsOptionName, false, "Specifies the relevant events from the DFT.")
52 "A comma separated list of names of relevant events. 'all' marks all events as "
53 "relevant, The default '' marks only the top level event as relevant.")
54 .setDefaultValueString("")
55 .build())
56 .build());
57 this->addOption(storm::settings::OptionBuilder(moduleName, allowDCRelevantOptionName, false, "Allow Don't Care propagation for relevant events.").build());
58 this->addOption(storm::settings::OptionBuilder(moduleName, addLabelsClaimingOptionName, false, "Add labels representing claiming operations.").build());
59 this->addOption(storm::settings::OptionBuilder(moduleName, approximationErrorOptionName, false, "Approximation error allowed.")
60 .setShortName(approximationErrorOptionShortName)
61 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("error", "The relative approximation error to use.")
63 .build())
64 .build());
65 this->addOption(storm::settings::OptionBuilder(moduleName, approximationHeuristicOptionName, false, "Set the heuristic used for approximation.")
66 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("heuristic", "The name of the heuristic used for approximation.")
67 .setDefaultValueString("depth")
69 {"depth", "probability", "bounddifference"}))
70 .build())
71 .build());
72 this->addOption(storm::settings::OptionBuilder(moduleName, maxDepthOptionName, false, "Maximal depth for state space exploration.")
73 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("depth", "The maximal depth.").build())
74 .build());
75 this->addOption(storm::settings::OptionBuilder(moduleName, uniqueFailedBEOptionName, false, "Use a unique constantly failed BE.").build());
76#ifdef STORM_HAVE_Z3
77 this->addOption(storm::settings::OptionBuilder(moduleName, solveWithSmtOptionName, true, "Solve the DFT with SMT.").build());
78#endif
79 this->addOption(storm::settings::OptionBuilder(moduleName, chunksizeOptionName, false, "Calculate probabilies in chunks.")
81 "chunksize", "The size of the chunks used to calculate probabilities. Set to 0 for maximal size.")
82 .setDefaultValueUnsignedInteger(1)
83 .build())
84 .build());
85 this->addOption(storm::settings::OptionBuilder(moduleName, mttfPrecisionName, false,
86 "The precision used for detecting convergence of the iterative MTTF approximation method.")
87 .setIsAdvanced()
88 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
89 .setDefaultValueDouble(1e-12)
91 .build())
92 .build());
93 this->addOption(storm::settings::OptionBuilder(moduleName, mttfStepsizeName, false,
94 "The stepsize used to iterativly approximate the integral in the MTTF approximation method.")
95 .setIsAdvanced()
96 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The stepsize to use.")
97 .setDefaultValueDouble(1e-10)
99 .build())
100 .build());
101 this->addOption(
102 storm::settings::OptionBuilder(moduleName, mttfAlgorithmName, false, "The algorithm used to approximate the MTTF.")
103 .setIsAdvanced()
104 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("algorithm", "The algorithm to use.")
105 .addValidatorString(storm::settings::ArgumentValidatorFactory::createMultipleChoiceValidator({"proceeding", "variableChange"}))
106 .setDefaultValueString("proceeding")
107 .build())
108 .build());
109}
110
112 return !this->getOption(noSymmetryReductionOptionName).getHasOptionBeenSet();
113}
114
116 return this->getOption(modularisationOptionName).getHasOptionBeenSet();
117}
118
120 return this->getOption(disableDCOptionName).getHasOptionBeenSet();
121}
122
124 return this->getOption(allowDCRelevantOptionName).getHasOptionBeenSet();
125}
126
128 return this->getOption(relevantEventsOptionName).getHasOptionBeenSet() &&
129 (this->getOption(relevantEventsOptionName).getArgumentByName("values").getValueAsString() != "");
130}
131
132std::vector<std::string> FaultTreeSettings::getRelevantEvents() const {
133 return storm::parser::parseCommaSeperatedValues(this->getOption(relevantEventsOptionName).getArgumentByName("values").getValueAsString());
134}
135
137 return this->getOption(addLabelsClaimingOptionName).getHasOptionBeenSet();
138}
139
141 return this->getOption(approximationErrorOptionName).getHasOptionBeenSet();
142}
143
145 return this->getOption(approximationErrorOptionName).getArgumentByName("error").getValueAsDouble();
146}
147
149 std::string heuristicAsString = this->getOption(approximationHeuristicOptionName).getArgumentByName("heuristic").getValueAsString();
150 if (heuristicAsString == "depth") {
152 } else if (heuristicAsString == "probability") {
154 } else if (heuristicAsString == "bounddifference") {
156 }
157 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Illegal value '" << heuristicAsString << "' set as heuristic for approximation.");
158}
159
161 return this->getOption(maxDepthOptionName).getHasOptionBeenSet();
162}
163
164uint_fast64_t FaultTreeSettings::getMaxDepth() const {
165 return this->getOption(maxDepthOptionName).getArgumentByName("depth").getValueAsUnsignedInteger();
166}
167
169 return this->getOption(firstDependencyOptionName).getHasOptionBeenSet();
170}
171
173 return this->getOption(uniqueFailedBEOptionName).getHasOptionBeenSet();
174}
175
176#ifdef STORM_HAVE_Z3
177
178bool FaultTreeSettings::solveWithSMT() const {
179 return this->getOption(solveWithSmtOptionName).getHasOptionBeenSet();
180}
181
182#endif
183
185 return this->getOption(chunksizeOptionName).getHasOptionBeenSet();
186}
187
189 return this->getOption(chunksizeOptionName).getArgumentByName("chunksize").getValueAsUnsignedInteger();
190}
191
193 return this->getOption(mttfPrecisionName).getArgumentByName("value").getValueAsDouble();
194}
195
197 return this->getOption(mttfStepsizeName).getArgumentByName("value").getValueAsDouble();
198}
199
201 return this->getOption(mttfAlgorithmName).getArgumentByName("algorithm").getValueAsString();
202}
203
205
207 // Ensure that disableDC and relevantEvents are not set at the same time
208 STORM_LOG_THROW(!isDisableDC() || !areRelevantEventsSet(), storm::exceptions::InvalidSettingsException, "DisableDC and relevantSets can not both be set.");
210 storm::exceptions::InvalidSettingsException, "Maximal depth requires approximation heuristic depth.");
211 return true;
212}
213
214} // namespace modules
215} // namespace settings
216} // namespace storm::dft
size_t getChunksize() const
Retrieves the size of the chunks to calculate proabilities with.
std::string getMttfAlgorithm() const
Retrieves the name of the Algorithm to use to approximate the MTTF.
bool areRelevantEventsSet() const
Retrieves whether the option to give relevant events is set.
double getApproximationError() const
Retrieves the relative error allowed for approximating the model checking result.
void finalize() override
Prepares the modules for further usage, should be called at the end of the initialization,...
bool isAddLabelsClaiming() const
Retrieves whether the labels for claimings should be added in the Markov chain.
bool isAllowDCForRelevantEvents() const
Retrieves whether the option to allow Dont Care propagation for relevant events is set.
bool useModularisation() const
Retrieves whether the option to use modularisation is set.
bool isTakeFirstDependency() const
Retrieves whether the non-determinism should be avoided by always taking the first possible dependenc...
double getMttfPrecision() const
Retrieves the Precision to detect the convergence of the mttf algorithm.
bool useSymmetryReduction() const
Retrieves whether the option to use symmetry reduction is set.
bool isApproximationErrorSet() const
Retrieves whether the option to compute an approximation is set.
FaultTreeSettings()
Creates a new set of DFT settings.
std::vector< std::string > getRelevantEvents() const
Retrieves the relevant events which should be present throughout the analysis.
bool isDisableDC() const
Retrieves whether the option to disable Dont Care propagation is set.
bool isUniqueFailedBE() const
Retrieves whether the DFT should be transformed to contain at most one constantly failed BE.
bool isChunksizeSet() const
Retrieves whether to calculate probabilities in chunks.
bool check() const override
Checks whether the settings are consistent.
storm::dft::builder::ApproximationHeuristic getApproximationHeuristic() const
Retrieves the heuristic used for approximation.
bool isMaxDepthSet() const
Retrieves whether the option to set a maximal exploration depth is set.
double getMttfStepsize() const
Retrieves the Stepsize for the mttf algorithm.
uint_fast64_t getMaxDepth() const
Retrieves the maximal exploration depth.
virtual std::string getValueAsString() const =0
Retrieves the value of this argument as a string.
virtual uint_fast64_t getValueAsUnsignedInteger() const =0
Retrieves the value of this argument as an unsigned integer.
virtual double getValueAsDouble() const =0
Retrieves the value of this argument as a double.
static ArgumentBuilder createUnsignedIntegerArgument(std::string const &name, std::string const &description)
Creates an unsigned integer argument with the given parameters.
static ArgumentBuilder createDoubleArgument(std::string const &name, std::string const &description)
Creates a double argument with the given parameters.
static ArgumentBuilder createStringArgument(std::string const &name, std::string const &description)
Creates a string argument with the given parameters.
static std::shared_ptr< ArgumentValidator< double > > createDoubleRangeValidatorExcluding(double lowerBound, double upperBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleGreaterEqualValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
This class provides the interface to create an option...
ArgumentBase const & getArgumentByName(std::string const &argumentName) const
Returns a reference to the argument with the specified long name.
Definition Option.cpp:79
bool getHasOptionBeenSet() const
Retrieves whether the option has been set.
Definition Option.cpp:125
void addOption(std::shared_ptr< Option > const &option)
Adds and registers the given option.
Option & getOption(std::string const &longName)
Retrieves the option with the given long name.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
ApproximationHeuristic
Enum representing the heuristic used for deciding which states to expand.
std::vector< std::string > parseCommaSeperatedValues(std::string const &input)
Given a string seperated by commas, returns the values.
Definition CSVParser.cpp:11