Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
FaultTreeSettings.cpp
Go to the documentation of this file.
1#include "FaultTreeSettings.h"
2
11
12namespace storm::dft {
13namespace settings {
14namespace modules {
15
16const std::string FaultTreeSettings::moduleName = "dft";
17const std::string FaultTreeSettings::noSymmetryReductionOptionName = "nosymmetryreduction";
18const std::string FaultTreeSettings::noSymmetryReductionOptionShortName = "nosymred";
19const std::string FaultTreeSettings::modularisationOptionName = "modularisation";
20const std::string FaultTreeSettings::disableDCOptionName = "disabledc";
21const std::string FaultTreeSettings::allowDCRelevantOptionName = "allowdcrelevant";
22const std::string FaultTreeSettings::relevantEventsOptionName = "relevantevents";
23const std::string FaultTreeSettings::addLabelsClaimingOptionName = "labels-claiming";
24const std::string FaultTreeSettings::approximationErrorOptionName = "approximation";
25const std::string FaultTreeSettings::approximationErrorOptionShortName = "approx";
26const std::string FaultTreeSettings::approximationHeuristicOptionName = "approximationheuristic";
27const std::string FaultTreeSettings::maxDepthOptionName = "maxdepth";
28const std::string FaultTreeSettings::firstDependencyOptionName = "firstdep";
29const std::string FaultTreeSettings::uniqueFailedBEOptionName = "uniquefailedbe";
30#ifdef STORM_HAVE_Z3
31const std::string FaultTreeSettings::solveWithSmtOptionName = "smt";
32#endif
33const std::string FaultTreeSettings::chunksizeOptionName = "chunksize";
34const std::string FaultTreeSettings::mttfPrecisionName = "mttf-precision";
35const std::string FaultTreeSettings::mttfStepsizeName = "mttf-stepsize";
36const std::string FaultTreeSettings::mttfAlgorithmName = "mttf-algorithm";
37
39 this->addOption(storm::settings::OptionBuilder(moduleName, noSymmetryReductionOptionName, false, "Do not exploit symmetric structure of model.")
40 .setShortName(noSymmetryReductionOptionShortName)
41 .build());
42 this->addOption(
43 storm::settings::OptionBuilder(moduleName, modularisationOptionName, false, "Use modularisation (not applicable for expected time).").build());
44 this->addOption(storm::settings::OptionBuilder(moduleName, disableDCOptionName, false, "Disable Don't Care propagation.").build());
45 this->addOption(
46 storm::settings::OptionBuilder(moduleName, firstDependencyOptionName, false, "Avoid non-determinism by always taking the first possible dependency.")
47 .build());
48 this->addOption(
49 storm::settings::OptionBuilder(moduleName, relevantEventsOptionName, false, "Specifies the relevant events from the DFT.")
51 "A comma separated list of names of relevant events. 'all' marks all events as "
52 "relevant, The default '' marks only the top level event as relevant.")
53 .setDefaultValueString("")
54 .build())
55 .build());
56 this->addOption(storm::settings::OptionBuilder(moduleName, allowDCRelevantOptionName, false, "Allow Don't Care propagation for relevant events.").build());
57 this->addOption(storm::settings::OptionBuilder(moduleName, addLabelsClaimingOptionName, false, "Add labels representing claiming operations.").build());
58 this->addOption(storm::settings::OptionBuilder(moduleName, approximationErrorOptionName, false, "Approximation error allowed.")
59 .setShortName(approximationErrorOptionShortName)
60 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("error", "The relative approximation error to use.")
62 .build())
63 .build());
64 this->addOption(storm::settings::OptionBuilder(moduleName, approximationHeuristicOptionName, false, "Set the heuristic used for approximation.")
65 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("heuristic", "The name of the heuristic used for approximation.")
66 .setDefaultValueString("depth")
68 {"depth", "probability", "bounddifference"}))
69 .build())
70 .build());
71 this->addOption(storm::settings::OptionBuilder(moduleName, maxDepthOptionName, false, "Maximal depth for state space exploration.")
72 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("depth", "The maximal depth.").build())
73 .build());
74 this->addOption(storm::settings::OptionBuilder(moduleName, uniqueFailedBEOptionName, false, "Use a unique constantly failed BE.").build());
75#ifdef STORM_HAVE_Z3
76 this->addOption(storm::settings::OptionBuilder(moduleName, solveWithSmtOptionName, true, "Solve the DFT with SMT.").build());
77#endif
78 this->addOption(storm::settings::OptionBuilder(moduleName, chunksizeOptionName, false, "Calculate probabilies in chunks.")
80 "chunksize", "The size of the chunks used to calculate probabilities. Set to 0 for maximal size.")
81 .setDefaultValueUnsignedInteger(1)
82 .build())
83 .build());
84 this->addOption(storm::settings::OptionBuilder(moduleName, mttfPrecisionName, false,
85 "The precision used for detecting convergence of the iterative MTTF approximation method.")
86 .setIsAdvanced()
87 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
88 .setDefaultValueDouble(1e-12)
90 .build())
91 .build());
92 this->addOption(storm::settings::OptionBuilder(moduleName, mttfStepsizeName, false,
93 "The stepsize used to iterativly approximate the integral in the MTTF approximation method.")
94 .setIsAdvanced()
95 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The stepsize to use.")
96 .setDefaultValueDouble(1e-10)
98 .build())
99 .build());
100 this->addOption(
101 storm::settings::OptionBuilder(moduleName, mttfAlgorithmName, false, "The algorithm used to approximate the MTTF.")
102 .setIsAdvanced()
103 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("algorithm", "The algorithm to use.")
104 .addValidatorString(storm::settings::ArgumentValidatorFactory::createMultipleChoiceValidator({"proceeding", "variableChange"}))
105 .setDefaultValueString("proceeding")
106 .build())
107 .build());
108}
109
111 return !this->getOption(noSymmetryReductionOptionName).getHasOptionBeenSet();
112}
113
115 return this->getOption(modularisationOptionName).getHasOptionBeenSet();
116}
117
119 return this->getOption(disableDCOptionName).getHasOptionBeenSet();
120}
121
123 return this->getOption(allowDCRelevantOptionName).getHasOptionBeenSet();
124}
125
127 return this->getOption(relevantEventsOptionName).getHasOptionBeenSet() &&
128 (this->getOption(relevantEventsOptionName).getArgumentByName("values").getValueAsString() != "");
129}
130
131std::vector<std::string> FaultTreeSettings::getRelevantEvents() const {
132 return storm::parser::parseCommaSeperatedValues(this->getOption(relevantEventsOptionName).getArgumentByName("values").getValueAsString());
133}
134
136 return this->getOption(addLabelsClaimingOptionName).getHasOptionBeenSet();
137}
138
140 return this->getOption(approximationErrorOptionName).getHasOptionBeenSet();
141}
142
144 return this->getOption(approximationErrorOptionName).getArgumentByName("error").getValueAsDouble();
145}
146
148 std::string heuristicAsString = this->getOption(approximationHeuristicOptionName).getArgumentByName("heuristic").getValueAsString();
149 if (heuristicAsString == "depth") {
151 } else if (heuristicAsString == "probability") {
153 } else if (heuristicAsString == "bounddifference") {
155 }
156 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Illegal value '" << heuristicAsString << "' set as heuristic for approximation.");
157}
158
160 return this->getOption(maxDepthOptionName).getHasOptionBeenSet();
161}
162
163uint_fast64_t FaultTreeSettings::getMaxDepth() const {
164 return this->getOption(maxDepthOptionName).getArgumentByName("depth").getValueAsUnsignedInteger();
165}
166
168 return this->getOption(firstDependencyOptionName).getHasOptionBeenSet();
169}
170
172 return this->getOption(uniqueFailedBEOptionName).getHasOptionBeenSet();
173}
174
175#ifdef STORM_HAVE_Z3
176
177bool FaultTreeSettings::solveWithSMT() const {
178 return this->getOption(solveWithSmtOptionName).getHasOptionBeenSet();
179}
180
181#endif
182
184 return this->getOption(chunksizeOptionName).getHasOptionBeenSet();
185}
186
188 return this->getOption(chunksizeOptionName).getArgumentByName("chunksize").getValueAsUnsignedInteger();
189}
190
192 return this->getOption(mttfPrecisionName).getArgumentByName("value").getValueAsDouble();
193}
194
196 return this->getOption(mttfStepsizeName).getArgumentByName("value").getValueAsDouble();
197}
198
200 return this->getOption(mttfAlgorithmName).getArgumentByName("algorithm").getValueAsString();
201}
202
204
206 // Ensure that disableDC and relevantEvents are not set at the same time
207 STORM_LOG_THROW(!isDisableDC() || !areRelevantEventsSet(), storm::exceptions::InvalidSettingsException, "DisableDC and relevantSets can not both be set.");
209 storm::exceptions::InvalidSettingsException, "Maximal depth requires approximation heuristic depth.");
210 return true;
211}
212
213} // namespace modules
214} // namespace settings
215} // 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
ModuleSettings(std::string const &moduleName)
Constructs a new settings object.
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:28
ApproximationHeuristic
Enum representing the heuristic used for deciding which states to expand.
std::vector< std::string > parseCommaSeperatedValues(std::string const &input)
Given a string separated by commas, returns the values.
Definition CSVParser.cpp:11