Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
NativeEquationSolverSettings.cpp
Go to the documentation of this file.
2
10
13
14namespace storm {
15namespace settings {
16namespace modules {
17
18const std::string NativeEquationSolverSettings::moduleName = "native";
19const std::string NativeEquationSolverSettings::techniqueOptionName = "method";
20const std::string NativeEquationSolverSettings::omegaOptionName = "soromega";
21const std::string NativeEquationSolverSettings::maximalIterationsOptionName = "maxiter";
22const std::string NativeEquationSolverSettings::maximalIterationsOptionShortName = "i";
23const std::string NativeEquationSolverSettings::precisionOptionName = "precision";
24const std::string NativeEquationSolverSettings::absoluteOptionName = "absolute";
25const std::string NativeEquationSolverSettings::powerMethodMultiplicationStyleOptionName = "powmult";
26const std::string NativeEquationSolverSettings::intervalIterationSymmetricUpdatesOptionName = "symmetricupdates";
27
29 std::vector<std::string> methods = {"jacobi", "gaussseidel", "sor", "walkerchae",
30 "power", "sound-value-iteration", "svi", "optimistic-value-iteration",
31 "ovi", "interval-iteration", "ii", "ratsearch"};
32 this->addOption(storm::settings::OptionBuilder(moduleName, techniqueOptionName, true,
33 "The method to be used for solving linear equation systems with the native engine.")
34 .setIsAdvanced()
35 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the method to use.")
37 .setDefaultValueString("jacobi")
38 .build())
39 .build());
40
41 this->addOption(storm::settings::OptionBuilder(moduleName, maximalIterationsOptionName, false,
42 "The maximal number of iterations to perform before iterative solving is aborted.")
43 .setIsAdvanced()
44 .setShortName(maximalIterationsOptionShortName)
45 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count", "The maximal iteration count.").build())
46 .build());
47
48 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, false, "The precision used for detecting convergence of iterative methods.")
49 .setIsAdvanced()
50 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
53 .build())
54 .build());
55
56 this->addOption(storm::settings::OptionBuilder(moduleName, omegaOptionName, false, "The omega used for SOR.")
57 .setIsAdvanced()
58 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The value of the SOR parameter.")
61 .build())
62 .build());
63
64 this->addOption(storm::settings::OptionBuilder(moduleName, absoluteOptionName, false,
65 "Sets whether the relative or the absolute error is considered for detecting convergence.")
66 .setIsAdvanced()
67 .build());
68
69 std::vector<std::string> multiplicationStyles = {"gaussseidel", "regular", "gs", "r"};
70 this->addOption(storm::settings::OptionBuilder(moduleName, powerMethodMultiplicationStyleOptionName, false,
71 "Sets which method multiplication style to prefer for the power method.")
72 .setIsAdvanced()
73 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of a multiplication style.")
75 .setDefaultValueString("gaussseidel")
76 .build())
77 .build());
78
79 this->addOption(storm::settings::OptionBuilder(moduleName, intervalIterationSymmetricUpdatesOptionName, false,
80 "If set, interval iteration performs an update on both, lower and upper bound in each iteration")
81 .setIsAdvanced()
82 .build());
83}
84
88
90 return !this->getOption(techniqueOptionName).getHasOptionBeenSet() ||
91 this->getOption(techniqueOptionName).getArgumentByName("name").wasSetFromDefaultValue();
92}
93
94storm::solver::NativeLinearEquationSolverMethod NativeEquationSolverSettings::getLinearEquationSystemMethod() const {
95 std::string linearEquationSystemTechniqueAsString = this->getOption(techniqueOptionName).getArgumentByName("name").getValueAsString();
97 return storm::solver::NativeLinearEquationSolverMethod::Jacobi;
98 } else if (linearEquationSystemTechniqueAsString == "gaussseidel") {
99 return storm::solver::NativeLinearEquationSolverMethod::GaussSeidel;
100 } else if (linearEquationSystemTechniqueAsString == "sor") {
101 return storm::solver::NativeLinearEquationSolverMethod::SOR;
102 } else if (linearEquationSystemTechniqueAsString == "walkerchae") {
103 return storm::solver::NativeLinearEquationSolverMethod::WalkerChae;
104 } else if (linearEquationSystemTechniqueAsString == "power") {
105 return storm::solver::NativeLinearEquationSolverMethod::Power;
106 } else if (linearEquationSystemTechniqueAsString == "sound-value-iteration" || linearEquationSystemTechniqueAsString == "svi") {
107 return storm::solver::NativeLinearEquationSolverMethod::SoundValueIteration;
108 } else if (linearEquationSystemTechniqueAsString == "optimistic-value-iteration" || linearEquationSystemTechniqueAsString == "ovi") {
109 return storm::solver::NativeLinearEquationSolverMethod::OptimisticValueIteration;
110 } else if (linearEquationSystemTechniqueAsString == "interval-iteration" || linearEquationSystemTechniqueAsString == "ii") {
111 return storm::solver::NativeLinearEquationSolverMethod::IntervalIteration;
112 } else if (linearEquationSystemTechniqueAsString == "ratsearch") {
113 return storm::solver::NativeLinearEquationSolverMethod::RationalSearch;
114 }
115 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException,
116 "Unknown solution technique '" << linearEquationSystemTechniqueAsString << "' selected.");
117}
118
120 return this->getOption(maximalIterationsOptionName).getHasOptionBeenSet();
121}
122
126
128 return this->getOption(precisionOptionName).getHasOptionBeenSet();
129}
130
132 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
133}
134
136 return this->getOption(omegaOptionName).getArgumentByName("value").getValueAsDouble();
137}
138
140 return this->getOption(absoluteOptionName).getHasOptionBeenSet();
141}
142
147
149 std::string multiplicationStyleString = this->getOption(powerMethodMultiplicationStyleOptionName).getArgumentByName("name").getValueAsString();
150 if (multiplicationStyleString == "gaussseidel" || multiplicationStyleString == "gs") {
152 } else if (multiplicationStyleString == "regular" || multiplicationStyleString == "r") {
154 }
155 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown multiplication style '" << multiplicationStyleString << "'.");
156}
157
159 return this->getOption(intervalIterationSymmetricUpdatesOptionName).getHasOptionBeenSet();
160}
161
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 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.
virtual bool wasSetFromDefaultValue() const =0
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)
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
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.
bool isLinearEquationSystemTechniqueSetFromDefaultValue() const
Retrieves whether the linear equation system technique is set from its default value.
bool isPrecisionSet() const
Retrieves whether the precision has been set.
uint_fast64_t getMaximalIterationCount() const
Retrieves the maximal number of iterations to perform until giving up on converging.
bool isConvergenceCriterionSet() const
Retrieves whether the convergence criterion has been set.
bool check() const override
Checks whether the settings are consistent.
bool isForceIntervalIterationSymmetricUpdatesSet() const
Retrievew whether updates in interval iteration have to be made symmetrically.
bool isLinearEquationSystemTechniqueSet() const
Retrieves whether the linear equation system technique has been set.
double getOmega() const
Retrieves the value of omega to be used for the SOR method.
double getPrecision() const
Retrieves the precision that is used for detecting convergence.
bool isMaximalIterationCountSet() const
Retrieves whether the maximal iteration count has been set.
storm::solver::NativeLinearEquationSolverMethod getLinearEquationSystemMethod() const
Retrieves the method that is to be used for solving systems of linear equations.
NativeEquationSolverSettings()
Creates a new set of native equation solver settings.
storm::solver::MultiplicationStyle getPowerMethodMultiplicationStyle() const
Retrieves the multiplication style to use in the power method.
ConvergenceCriterion getConvergenceCriterion() const
Retrieves the selected convergence criterion.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18