Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
GeneralSettings.cpp
Go to the documentation of this file.
2
9
11
13
14namespace storm {
15namespace settings {
16namespace modules {
17
18const std::string GeneralSettings::moduleName = "general";
19const std::string GeneralSettings::helpOptionName = "help";
20const std::string GeneralSettings::helpOptionShortName = "h";
21const std::string GeneralSettings::versionOptionName = "version";
22const std::string GeneralSettings::verboseOptionName = "verbose";
23const std::string GeneralSettings::verboseOptionShortName = "v";
24const std::string GeneralSettings::showProgressOptionName = "progress";
25const std::string GeneralSettings::precisionOptionName = "precision";
26const std::string GeneralSettings::precisionOptionShortName = "eps";
27const std::string GeneralSettings::toleranceOptionName = "tolerance";
28const std::string GeneralSettings::configOptionName = "config";
29const std::string GeneralSettings::configOptionShortName = "c";
30const std::string GeneralSettings::bisimulationOptionName = "bisimulation";
31const std::string GeneralSettings::bisimulationOptionShortName = "bisim";
32const std::string GeneralSettings::parametricOptionName = "parametric";
33const std::string GeneralSettings::exactOptionName = "exact";
34const std::string GeneralSettings::soundOptionName = "sound";
35
37 this->addOption(
38 storm::settings::OptionBuilder(moduleName, helpOptionName, false, "Shows available options, arguments and descriptions.")
39 .setShortName(helpOptionShortName)
40 .addArgument(
42 "filter",
43 "'frequent' for frequently used options, 'all' for the complete help, or a regular expression to show help for all matching entities.")
44 .setDefaultValueString("frequent")
45 .makeOptional()
46 .build())
47 .build());
48 this->addOption(storm::settings::OptionBuilder(moduleName, versionOptionName, false, "Prints the version information.").build());
49 this->addOption(
50 storm::settings::OptionBuilder(moduleName, verboseOptionName, false, "Enables more verbose output.").setShortName(verboseOptionShortName).build());
51 this->addOption(storm::settings::OptionBuilder(moduleName, showProgressOptionName, false,
52 "Sets when additional information (if available) about the progress is printed.")
54 "delay", "The delay to wait (in seconds) between emitting information (0 means never print progress).")
55 .setDefaultValueUnsignedInteger(5)
56 .makeOptional()
57 .build())
58 .build());
59 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, false,
60 "The internally used precision; for sound methods, this bounds the "
61 "returned midpoint's relative (or absolute) error.")
62 .setShortName(precisionOptionShortName)
63 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to use.")
64 .setDefaultValueDouble(1e-06)
66 .build())
67 .build());
68 this->addOption(
69 storm::settings::OptionBuilder(moduleName, toleranceOptionName, false, "The tolerance up to which probabilities and rates are considered equal.")
70 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The tolerance to use.")
71 .setDefaultValueDouble(1e-09)
73 .build())
74 .build());
75 this->addOption(
76 storm::settings::OptionBuilder(moduleName, configOptionName, false,
77 "If given, this file will be read and parsed for additional configuration settings.")
78 .setShortName(configOptionShortName)
79 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the configuration.")
81 .build())
82 .build());
83 this->addOption(storm::settings::OptionBuilder(moduleName, bisimulationOptionName, false, "Sets whether to perform bisimulation minimization.")
84 .setShortName(bisimulationOptionShortName)
85 .build());
86 this->addOption(
87 storm::settings::OptionBuilder(moduleName, parametricOptionName, false, "Sets whether to enable parametric model checking.").setIsAdvanced().build());
88 this->addOption(
89 storm::settings::OptionBuilder(moduleName, exactOptionName, false, "Sets whether to enable exact model checking.")
90 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("valuetype", "The kind of datatype used to represent numeric values")
91 .setDefaultValueString("rationals")
92 .makeOptional()
93 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator({"rationals", "floats"}))
94 .build())
95 .build());
96 this->addOption(storm::settings::OptionBuilder(moduleName, soundOptionName, false, "Sets whether to force sound model checking.").build());
97}
98
100 return this->getOption(helpOptionName).getHasOptionBeenSet();
101}
102
104 return this->getOption(versionOptionName).getHasOptionBeenSet();
105}
106
108 return this->getOption(helpOptionName).getArgumentByName("filter").getValueAsString();
109}
110
112 return this->getOption(verboseOptionName).getHasOptionBeenSet();
113}
114
116 return this->getOption(showProgressOptionName).getHasOptionBeenSet();
117}
118
120 return this->getOption(showProgressOptionName).getArgumentByName("delay").getValueAsUnsignedInteger();
121}
122
124 return this->getOption(precisionOptionName).getHasOptionBeenSet();
125}
126
127void GeneralSettings::setPrecision(std::string precision) {
128 this->getOption(precisionOptionName).getArgumentByName("value").setFromStringValue(precision);
129}
131 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
132}
133
135 return this->getOption(toleranceOptionName).getHasOptionBeenSet();
136}
137
139 return this->getOption(toleranceOptionName).getArgumentByName("value").getValueAsDouble();
140}
141
143 return this->getOption(configOptionName).getHasOptionBeenSet();
144}
145
147 return this->getOption(configOptionName).getArgumentByName("filename").getValueAsString();
148}
149
151 return this->getOption(bisimulationOptionName).getHasOptionBeenSet();
152}
153
155 return this->getOption(parametricOptionName).getHasOptionBeenSet();
156}
157
159 return this->getOption(exactOptionName).getHasOptionBeenSet() &&
160 this->getOption(exactOptionName).getArgumentByName("valuetype").getValueAsString() == "rationals";
161}
162
164 return this->getOption(exactOptionName).getHasOptionBeenSet() &&
165 this->getOption(exactOptionName).getArgumentByName("valuetype").getValueAsString() == "floats";
166}
167
169 return this->getOption(soundOptionName).getHasOptionBeenSet();
170}
171
173 // Intentionally left empty.
174}
175
177 STORM_LOG_WARN_COND(!this->getOption(precisionOptionName).getHasOptionBeenSetWithModulePrefix(),
178 "Setting the precision option with module prefix does not effect all solvers. Consider setting --"
179 << precisionOptionName << " instead of --" << moduleName << ":" << precisionOptionName << ".");
180 return true;
181}
182
183} // namespace modules
184} // namespace settings
185} // namespace storm
virtual std::string getValueAsString() const =0
Retrieves the value of this argument as a string.
virtual bool setFromStringValue(std::string const &stringValue)=0
Tries to set the value of the argument from the given 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< 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
bool isHelpSet() const
Retrieves whether the help option was set.
bool isBisimulationSet() const
Retrieves whether the option to perform bisimulation minimization is set.
uint64_t getShowProgressDelay() const
Retrieves the delay for printing information about the exploration progress.
bool isExactSet() const
Retrieves whether the option enabling exact model checking is set and we should use infinite precisio...
std::string getConfigFilename() const
Retrieves the name of the file that is to be scanned for settings.
bool isToleranceSet() const
Retrieves whether the tolerance option was set.
void finalize() override
Prepares the modules for further usage, should be called at the end of the initialization,...
bool isVerboseSet() const
Retrieves whether the verbose option was set.
bool isParametricSet() const
Retrieves whether the option enabling parametric model checking is set.
bool isVersionSet() const
Retrieves whether the version option was set.
bool isSoundSet() const
Retrieves whether the option forcing soundnet is set.
bool isExactFinitePrecisionSet() const
Retrieves whether the option enabling exact model checking is set.
bool isShowProgressSet() const
Retrieves whether the progress option was set.
std::string getHelpFilterExpression() const
Retrieves the name of the module for which to show the help or "all" to indicate that the full help n...
double getTolerance() const
Retrieves the tolerance to use for comparing probabilities and rates.
bool isConfigSet() const
Retrieves whether the config option was set.
bool check() const override
Checks whether the settings are consistent.
GeneralSettings()
Creates a new set of general settings.
double getPrecision() const
Retrieves the precision to use for numerical operations.
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_WARN_COND(cond, message)
Definition macros.h:54