Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DftIOSettings.cpp
Go to the documentation of this file.
1#include "DftIOSettings.h"
2
9
10namespace storm::dft {
11namespace settings {
12namespace modules {
13
14const std::string DftIOSettings::moduleName = "dftIO";
15const std::string DftIOSettings::dftFileOptionName = "dftfile";
16const std::string DftIOSettings::dftFileOptionShortName = "dft";
17const std::string DftIOSettings::dftJsonFileOptionName = "dftfile-json";
18const std::string DftIOSettings::dftJsonFileOptionShortName = "dftjson";
19const std::string DftIOSettings::propExpectedTimeOptionName = "expectedtime";
20const std::string DftIOSettings::propExpectedTimeOptionShortName = "mttf";
21const std::string DftIOSettings::propProbabilityOptionName = "probability";
22const std::string DftIOSettings::propTimeboundOptionName = "timebound";
23const std::string DftIOSettings::propTimepointsOptionName = "timepoints";
24const std::string DftIOSettings::minValueOptionName = "min";
25const std::string DftIOSettings::maxValueOptionName = "max";
26const std::string DftIOSettings::analyzeWithBdds = "bdd";
27const std::string DftIOSettings::minimalCutSets = "mcs";
28const std::string DftIOSettings::exportToJsonOptionName = "export-json";
29const std::string DftIOSettings::exportToSmtOptionName = "export-smt";
30const std::string DftIOSettings::exportToBddDotOptionName = "export-bdd-dot";
31const std::string DftIOSettings::dftStatisticsOptionName = "dft-statistics";
32const std::string DftIOSettings::dftStatisticsOptionShortName = "dftstats";
33const std::string DftIOSettings::importanceMeasureOptionName = "importance";
34const std::string DftIOSettings::variableOrderingFileOptionName = "be-order";
35
37 this->addOption(
38 storm::settings::OptionBuilder(moduleName, dftFileOptionName, false, "Parses the model given in the Galileo format.")
39 .setShortName(dftFileOptionShortName)
40 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the DFT model.")
42 .build())
43 .build());
44 this->addOption(
45 storm::settings::OptionBuilder(moduleName, dftJsonFileOptionName, false, "Parses the model given in the Cytoscape JSON format.")
46 .setShortName(dftJsonFileOptionShortName)
47 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the JSON file from which to read the DFT model.")
49 .build())
50 .build());
51 this->addOption(storm::settings::OptionBuilder(moduleName, propExpectedTimeOptionName, false, "Compute expected time of system failure.")
52 .setShortName(propExpectedTimeOptionShortName)
53 .build());
54 this->addOption(storm::settings::OptionBuilder(moduleName, propProbabilityOptionName, false, "Compute probability of system failure.").build());
55 this->addOption(storm::settings::OptionBuilder(moduleName, propTimeboundOptionName, false, "Compute probability of system failure up to given timebound.")
56 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("time", "The timebound to use.")
58 .build())
59 .build());
60 this->addOption(storm::settings::OptionBuilder(moduleName, propTimepointsOptionName, false,
61 "Compute probability of system failure up to given timebound for a set of given timepoints [starttime, "
62 "starttime+inc, starttime+2inc, ... ,endtime]")
63 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("starttime", "The timebound to start from.")
65 .build())
66 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("endtime", "The timebound to end with.")
68 .build())
69 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("inc", "The value to increment with to get the next timepoint.")
71 .setDefaultValueDouble(1.0)
72 .makeOptional()
73 .build())
74 .build());
75 this->addOption(storm::settings::OptionBuilder(moduleName, minValueOptionName, false, "Compute minimal value in case of non-determinism.").build());
76 this->addOption(storm::settings::OptionBuilder(moduleName, maxValueOptionName, false, "Compute maximal value in case of non-determinism.").build());
77
78 this->addOption(
79 storm::settings::OptionBuilder(moduleName, analyzeWithBdds, false, "Try to use Bdds for the analysis. Unsupportet properties will be ignored.")
80 .build());
81 this->addOption(storm::settings::OptionBuilder(moduleName, minimalCutSets, false, "Calculate minimal cut sets.").build());
82
83 this->addOption(storm::settings::OptionBuilder(moduleName, exportToJsonOptionName, false, "Export the model to the Cytoscape JSON format.")
84 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the JSON file to export to.").build())
85 .build());
86 this->addOption(storm::settings::OptionBuilder(moduleName, exportToSmtOptionName, false, "Export the model as SMT encoding to the smtlib2 format.")
87 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the smtlib2 file to export to.").build())
88 .build());
89 this->addOption(storm::settings::OptionBuilder(moduleName, exportToBddDotOptionName, false, "Export the model as the graph of a BDD in the dot format.")
90 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the dot file to export to.").build())
91 .build());
92 this->addOption(storm::settings::OptionBuilder(moduleName, dftStatisticsOptionName, false, "Sets whether to display DFT statistics if available.")
93 .setShortName(dftStatisticsOptionShortName)
94 .build());
95 this->addOption(
96 storm::settings::OptionBuilder(moduleName, importanceMeasureOptionName, false, "Calculate importance measures for all basic events in the SFT.")
97 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("measure", "The name of the measure. Valid values: [MIF,DIF,CIF,RAW,RRW]")
98 .addValidatorString(storm::settings::ArgumentValidatorFactory::createMultipleChoiceValidator({"MIF", "DIF", "CIF", "RAW", "RRW"}))
99 .build())
100 .build());
101 this->addOption(
102 storm::settings::OptionBuilder(moduleName, variableOrderingFileOptionName, false,
103 "File containing the order of BEs used as variable ordering for the BDD.")
104 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the variable ordering.")
106 .build())
107 .build());
108}
109
111 return this->getOption(dftFileOptionName).getHasOptionBeenSet();
112}
113
114std::string DftIOSettings::getDftFilename() const {
115 return this->getOption(dftFileOptionName).getArgumentByName("filename").getValueAsString();
116}
117
119 return this->getOption(dftJsonFileOptionName).getHasOptionBeenSet();
120}
121
123 return this->getOption(dftJsonFileOptionName).getArgumentByName("filename").getValueAsString();
124}
125
127 return this->getOption(propExpectedTimeOptionName).getHasOptionBeenSet();
128}
129
131 return this->getOption(propProbabilityOptionName).getHasOptionBeenSet();
132}
133
135 return this->getOption(propTimeboundOptionName).getHasOptionBeenSet();
136}
137
139 return this->getOption(propTimeboundOptionName).getArgumentByName("time").getValueAsDouble();
140}
141
143 return this->getOption(propTimepointsOptionName).getHasOptionBeenSet();
144}
145
146std::vector<double> DftIOSettings::getPropTimepoints() const {
147 double starttime = this->getOption(propTimepointsOptionName).getArgumentByName("starttime").getValueAsDouble();
148 double endtime = this->getOption(propTimepointsOptionName).getArgumentByName("endtime").getValueAsDouble();
149 double inc = this->getOption(propTimepointsOptionName).getArgumentByName("inc").getValueAsDouble();
150 std::vector<double> timepoints;
151 for (double time = starttime; time <= endtime; time += inc) {
152 timepoints.push_back(time);
153 }
154 return timepoints;
155}
156
158 return this->getOption(minValueOptionName).getHasOptionBeenSet();
159}
160
162 return this->getOption(maxValueOptionName).getHasOptionBeenSet();
163}
164
166 return this->getOption(analyzeWithBdds).getHasOptionBeenSet();
167}
168
170 return this->getOption(minimalCutSets).getHasOptionBeenSet();
171}
172
174 return this->getOption(exportToJsonOptionName).getHasOptionBeenSet();
175}
176
178 return this->getOption(exportToJsonOptionName).getArgumentByName("filename").getValueAsString();
179}
180
182 return this->getOption(exportToSmtOptionName).getHasOptionBeenSet();
183}
184
186 return this->getOption(exportToSmtOptionName).getArgumentByName("filename").getValueAsString();
187}
188
190 return this->getOption(exportToBddDotOptionName).getHasOptionBeenSet();
191}
192
194 return this->getOption(exportToBddDotOptionName).getArgumentByName("filename").getValueAsString();
195}
196
198 return this->getOption(dftStatisticsOptionName).getHasOptionBeenSet();
199}
200
202 return this->getOption(importanceMeasureOptionName).getHasOptionBeenSet();
203}
204
206 return this->getOption(importanceMeasureOptionName).getArgumentByName("measure").getValueAsString();
207}
208
210 return this->getOption(variableOrderingFileOptionName).getHasOptionBeenSet();
211}
212
214 return this->getOption(variableOrderingFileOptionName).getArgumentByName("filename").getValueAsString();
215}
216
218
220 // Ensure that at most one input file is set
221 STORM_LOG_THROW(!isDftFileSet() || !isDftJsonFileSet(), storm::exceptions::InvalidSettingsException,
222 "The DFT may be either given in Galileo or JSON format, but not both.");
223 // Ensure that at most one of min or max is set
224 STORM_LOG_THROW(!isComputeMinimalValue() || !isComputeMaximalValue(), storm::exceptions::InvalidSettingsException, "Min and max can not both be set.");
225 return true;
226}
227
228} // namespace modules
229} // namespace settings
230} // namespace storm::dft
bool usePropTimepoints() const
Retrieves whether the property timepoints should be used.
void finalize() override
Prepares the modules for further usage, should be called at the end of the initialization,...
DftIOSettings()
Creates a new set of IO settings for DFTs.
bool usePropTimebound() const
Retrieves whether the property timebound should be used.
bool usePropExpectedTime() const
Retrieves whether the property expected time should be used.
bool isDftFileSet() const
Retrieves whether the dft file option was set.
std::string getDftJsonFilename() const
Retrieves the name of the json file that contains the dft specification.
bool isAnalyzeWithBdds() const
Retrieves whether the analyze with Bdds option was set.
bool isMinimalCutSets() const
Retrieves whether the minimal cut sets option was set.
double getPropTimebound() const
Retrieves the timebound for the timebound property.
std::string getVariableOrderingFilename() const
Retrieves the name of the file that contains the variable ordering.
bool usePropProbability() const
Retrieves whether the property probability should be used.
bool isComputeMaximalValue() const
Retrieves whether the maximal value should be computed for non-determinism.
bool isShowDftStatisticsSet() const
Retrieves whether statistics about the DFT analysis should be displayed.
bool isExportToSmt() const
Retrieves whether the export to smtlib2 file option was set.
bool isDftJsonFileSet() const
Retrieves whether the dft file option for Json was set.
bool isVariableOrderingFileSet() const
Retrieves whether the varialble ordering file option was set.
std::string getExportSmtFilename() const
Retrieves the name of the smtlib2 file to export to.
bool isExportToJson() const
Retrieves whether the export to Json file option was set.
std::string getDftFilename() const
Retrieves the name of the file that contains the dft specification.
bool isImportanceMeasureSet() const
Retrieves whether to calculate an importance measure.
bool isComputeMinimalValue() const
Retrieves whether the minimal value should be computed for non-determinism.
bool check() const override
Checks whether the settings are consistent.
std::string getImportanceMeasure() const
Retrieves the name of the importance measure to calculate.
std::vector< double > getPropTimepoints() const
Retrieves the settings for the timepoints property.
std::string getExportBddDotFilename() const
Retrieves the name of the dot file to export to.
bool isExportToBddDot() const
Retrieves whether the export to Bdd Dot file option was set.
std::string getExportJsonFilename() const
Retrieves the name of the json file to export to.
virtual std::string getValueAsString() const =0
Retrieves the value of this argument as a string.
virtual double getValueAsDouble() const =0
Retrieves the value of this argument as a double.
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 > > createDoubleGreaterValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleGreaterEqualValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
static std::shared_ptr< ArgumentValidator< std::string > > createExistingFileValidator()
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