Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
TopologicalEquationSolverSettings.cpp
Go to the documentation of this file.
2
4
12
14
18
19namespace storm {
20namespace settings {
21namespace modules {
22
23const std::string TopologicalEquationSolverSettings::moduleName = "topological";
24const std::string TopologicalEquationSolverSettings::underlyingEquationSolverOptionName = "eqsolver";
25const std::string TopologicalEquationSolverSettings::underlyingMinMaxMethodOptionName = "minmax";
26const std::string TopologicalEquationSolverSettings::extendRelevantValuesOptionName = "relevant-values";
27
29 std::vector<std::string> linearEquationSolver = {"gmm++", "native", "eigen", "elimination"};
30 this->addOption(storm::settings::OptionBuilder(moduleName, underlyingEquationSolverOptionName, true,
31 "Sets which solver is considered for solving the underlying equation systems.")
32 .setIsAdvanced()
33 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the used solver.")
35 .setDefaultValueString("gmm++")
36 .build())
37 .build());
38 std::vector<std::string> minMaxSolvingTechniques = {
39 "vi", "value-iteration", "pi", "policy-iteration", "lp", "linear-programming", "rs", "ratsearch",
40 "ii", "interval-iteration", "svi", "sound-value-iteration", "ovi", "optimistic-value-iteration", "vi-to-pi", "vi-to-lp"};
41 this->addOption(storm::settings::OptionBuilder(moduleName, underlyingMinMaxMethodOptionName, true,
42 "Sets which minmax method is considered for solving the underlying minmax equation systems.")
43 .setIsAdvanced()
44 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the used min max method.")
46 .setDefaultValueString("value-iteration")
47 .build())
48 .build());
49
50 this->addOption(
51 storm::settings::OptionBuilder(moduleName, extendRelevantValuesOptionName, true, "Sets whether relevant values are set to the underlying solver.")
52 .setIsAdvanced()
53 .build());
54}
55
57 return this->getOption(underlyingEquationSolverOptionName).getHasOptionBeenSet();
58}
59
61 return !this->getOption(underlyingEquationSolverOptionName).getHasOptionBeenSet() ||
62 this->getOption(underlyingEquationSolverOptionName).getArgumentByName("name").wasSetFromDefaultValue();
63}
64
66 std::string equationSolverName = this->getOption(underlyingEquationSolverOptionName).getArgumentByName("name").getValueAsString();
67 if (equationSolverName == "gmm++") {
68 return storm::solver::EquationSolverType::Gmmxx;
69 } else if (equationSolverName == "native") {
70 return storm::solver::EquationSolverType::Native;
71 } else if (equationSolverName == "eigen") {
72 return storm::solver::EquationSolverType::Eigen;
73 } else if (equationSolverName == "elimination") {
74 return storm::solver::EquationSolverType::Elimination;
75 }
76 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown underlying equation solver '" << equationSolverName << "'.");
77}
78
80 return this->getOption(underlyingMinMaxMethodOptionName).getHasOptionBeenSet();
81}
82
84 return !this->getOption(underlyingMinMaxMethodOptionName).getHasOptionBeenSet() ||
85 this->getOption(underlyingMinMaxMethodOptionName).getArgumentByName("name").wasSetFromDefaultValue();
86}
87
89 std::string minMaxEquationSolvingTechnique = this->getOption(underlyingMinMaxMethodOptionName).getArgumentByName("name").getValueAsString();
90 if (minMaxEquationSolvingTechnique == "value-iteration" || minMaxEquationSolvingTechnique == "vi") {
91 return storm::solver::MinMaxMethod::ValueIteration;
92 } else if (minMaxEquationSolvingTechnique == "policy-iteration" || minMaxEquationSolvingTechnique == "pi") {
93 return storm::solver::MinMaxMethod::PolicyIteration;
94 } else if (minMaxEquationSolvingTechnique == "linear-programming" || minMaxEquationSolvingTechnique == "lp") {
95 return storm::solver::MinMaxMethod::LinearProgramming;
96 } else if (minMaxEquationSolvingTechnique == "ratsearch" || minMaxEquationSolvingTechnique == "rs") {
97 return storm::solver::MinMaxMethod::RationalSearch;
98 } else if (minMaxEquationSolvingTechnique == "interval-iteration" || minMaxEquationSolvingTechnique == "ii") {
99 return storm::solver::MinMaxMethod::IntervalIteration;
100 } else if (minMaxEquationSolvingTechnique == "sound-value-iteration" || minMaxEquationSolvingTechnique == "svi") {
101 return storm::solver::MinMaxMethod::SoundValueIteration;
102 } else if (minMaxEquationSolvingTechnique == "optimistic-value-iteration" || minMaxEquationSolvingTechnique == "ovi") {
103 return storm::solver::MinMaxMethod::OptimisticValueIteration;
104 } else if (minMaxEquationSolvingTechnique == "vi-to-pi") {
105 return storm::solver::MinMaxMethod::ViToPi;
106 } else if (minMaxEquationSolvingTechnique == "vi-to-lp") {
107 return storm::solver::MinMaxMethod::ViToLp;
108 }
109
110 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown underlying equation solver '" << minMaxEquationSolvingTechnique << "'.");
111}
112
114 return this->getOption(extendRelevantValuesOptionName).getHasOptionBeenSet();
115}
116
118 if (this->isUnderlyingEquationSolverTypeSet() && getUnderlyingEquationSolverType() == storm::solver::EquationSolverType::Topological) {
119 STORM_LOG_WARN("Underlying solver type of the topological solver can not be the topological solver.");
120 return false;
121 }
122 if (this->isUnderlyingMinMaxMethodSet() && getUnderlyingMinMaxMethod() == storm::solver::MinMaxMethod::Topological) {
123 STORM_LOG_WARN("Underlying minmax method of the topological solver can not be topological.");
124 return false;
125 }
126 return true;
127}
128
129} // namespace modules
130} // namespace settings
131} // namespace storm
virtual std::string getValueAsString() const =0
Retrieves the value of this argument as a string.
virtual bool wasSetFromDefaultValue() const =0
static ArgumentBuilder createStringArgument(std::string const &name, std::string const &description)
Creates a string argument with the given parameters.
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 check() const override
Checks whether the settings are consistent.
bool isUnderlyingMinMaxMethodSet() const
Retrieves whether the underlying equation solver type has been set.
bool isUnderlyingMinMaxMethodSetFromDefaultValue() const
Retrieves whether the underlying minmax method is set from its default value.
TopologicalEquationSolverSettings()
Creates a new set of native equation solver settings.
bool isUnderlyingEquationSolverTypeSetFromDefaultValue() const
Retrieves whether the underlying equation solver type is set from its default value.
bool isExtendRelevantValues() const
If true, the relevant states of each SCC are computed and passed to the underlying equation solver.
storm::solver::EquationSolverType getUnderlyingEquationSolverType() const
Retrieves the method that is to be used for solving systems of linear equations.
storm::solver::MinMaxMethod getUnderlyingMinMaxMethod() const
Retrieves the method that is to be used for solving systems of linear equations.
bool isUnderlyingEquationSolverTypeSet() const
Retrieves whether the underlying equation solver type has been set.
#define STORM_LOG_WARN(message)
Definition logging.h:30
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18