Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
GeneralSettings.cpp
Go to the documentation of this file.
2
10
12
14
15namespace storm {
16namespace settings {
17namespace modules {
18
19const std::string GeneralSettings::moduleName = "general";
20const std::string GeneralSettings::helpOptionName = "help";
21const std::string GeneralSettings::helpOptionShortName = "h";
22const std::string GeneralSettings::versionOptionName = "version";
23const std::string GeneralSettings::verboseOptionName = "verbose";
24const std::string GeneralSettings::verboseOptionShortName = "v";
25const std::string GeneralSettings::showProgressOptionName = "progress";
26const std::string GeneralSettings::precisionOptionName = "precision";
27const std::string GeneralSettings::precisionOptionShortName = "eps";
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).")
56 .makeOptional()
57 .build())
58 .build());
59 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, false, "The internally used precision.")
60 .setShortName(precisionOptionShortName)
61 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to use.")
64 .build())
65 .build());
66 this->addOption(
67 storm::settings::OptionBuilder(moduleName, configOptionName, false,
68 "If given, this file will be read and parsed for additional configuration settings.")
69 .setShortName(configOptionShortName)
70 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file from which to read the configuration.")
72 .build())
73 .build());
74 this->addOption(storm::settings::OptionBuilder(moduleName, bisimulationOptionName, false, "Sets whether to perform bisimulation minimization.")
75 .setShortName(bisimulationOptionShortName)
76 .build());
77 this->addOption(
78 storm::settings::OptionBuilder(moduleName, parametricOptionName, false, "Sets whether to enable parametric model checking.").setIsAdvanced().build());
79 this->addOption(
80 storm::settings::OptionBuilder(moduleName, exactOptionName, false, "Sets whether to enable exact model checking.")
81 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("valuetype", "The kind of datatype used to represent numeric values")
82 .setDefaultValueString("rationals")
83 .makeOptional()
85 .build())
86 .build());
87 this->addOption(storm::settings::OptionBuilder(moduleName, soundOptionName, false, "Sets whether to force sound model checking.").build());
88}
89
91 return this->getOption(helpOptionName).getHasOptionBeenSet();
92}
93
95 return this->getOption(versionOptionName).getHasOptionBeenSet();
96}
97
99 return this->getOption(helpOptionName).getArgumentByName("filter").getValueAsString();
100}
101
103 return this->getOption(verboseOptionName).getHasOptionBeenSet();
104}
105
107 return this->getOption(showProgressOptionName).getHasOptionBeenSet();
108}
109
111 return this->getOption(showProgressOptionName).getArgumentByName("delay").getValueAsUnsignedInteger();
112}
113
115 return this->getOption(precisionOptionName).getHasOptionBeenSet();
116}
117
118void GeneralSettings::setPrecision(std::string precision) {
119 this->getOption(precisionOptionName).getArgumentByName("value").setFromStringValue(precision);
120}
122 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
123}
124
126 return this->getOption(configOptionName).getHasOptionBeenSet();
127}
128
130 return this->getOption(configOptionName).getArgumentByName("filename").getValueAsString();
131}
132
134 return this->getOption(bisimulationOptionName).getHasOptionBeenSet();
135}
136
138 return this->getOption(parametricOptionName).getHasOptionBeenSet();
139}
140
142 return this->getOption(exactOptionName).getHasOptionBeenSet() &&
143 this->getOption(exactOptionName).getArgumentByName("valuetype").getValueAsString() == "rationals";
144}
145
147 return this->getOption(exactOptionName).getHasOptionBeenSet() &&
148 this->getOption(exactOptionName).getArgumentByName("valuetype").getValueAsString() == "floats";
149}
150
152 return this->getOption(soundOptionName).getHasOptionBeenSet();
153}
154
156 // Intentionally left empty.
157}
158
160 STORM_LOG_WARN_COND(!this->getOption(precisionOptionName).getHasOptionBeenSetWithModulePrefix(),
161 "Setting the precision option with module prefix does not effect all solvers. Consider setting --"
162 << precisionOptionName << " instead of --" << moduleName << ":" << precisionOptionName << ".");
163 return true;
164}
165
166} // namespace modules
167} // namespace settings
168} // 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.
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...
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.
This is the base class of the settings for a particular module.
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:38
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18