Storm 1.10.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
MinMaxEquationSolverSettings.cpp
Go to the documentation of this file.
2
6
9
10namespace storm {
11namespace settings {
12namespace modules {
13
14const std::string MinMaxEquationSolverSettings::moduleName = "minmax";
15const std::string solvingMethodOptionName = "method";
16const std::string maximalIterationsOptionName = "maxiter";
17const std::string maximalIterationsOptionShortName = "i";
18const std::string precisionOptionName = "precision";
19const std::string absoluteOptionName = "absolute";
21const std::string forceUniqueSolutionRequirementOptionName = "force-require-unique";
22const std::string lpEqualityForUniqueActionsOptionName = "lp-eq-unique-actions";
23const std::string lpUseNonTrivialBoundsOptionName = "lp-use-nontrivial-bounds";
24const std::string lpOptimizeOnlyInitialStateOptionName = "lp-objective-type";
25
27 std::vector<std::string> minMaxSolvingTechniques = {"vi", "value-iteration",
28 "pi", "policy-iteration",
29 "lp", "linear-programming",
30 "rs", "ratsearch",
31 "ii", "interval-iteration",
32 "svi", "sound-value-iteration",
33 "ovi", "optimistic-value-iteration",
34 "gvi", "guessing-value-iteration",
35 "topological", "vi-to-pi",
36 "vi-to-lp", "acyclic"};
37 this->addOption(
38 storm::settings::OptionBuilder(moduleName, solvingMethodOptionName, false, "Sets which min/max linear equation solving technique is preferred.")
39 .setIsAdvanced()
40 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of a min/max linear equation solving technique.")
41 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(minMaxSolvingTechniques))
42 .setDefaultValueString("topological")
43 .build())
44 .build());
45
47 "The maximal number of iterations to perform before iterative solving is aborted.")
49 .setIsAdvanced()
50 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count", "The maximal iteration count.").build())
51 .build());
52
53 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, false, "The precision used for detecting convergence of iterative methods.")
54 .setIsAdvanced()
55 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
56 .setDefaultValueDouble(1e-06)
58 .build())
59 .build());
60
62 "Sets whether the relative or the absolute error is considered for detecting convergence.")
63 .setIsAdvanced()
64 .build());
65
66 std::vector<std::string> multiplicationStyles = {"gaussseidel", "regular", "gs", "r"};
68 "Sets which method multiplication style to prefer for value iteration.")
69 .setIsAdvanced()
70 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of a multiplication style.")
71 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(multiplicationStyles))
72 .setDefaultValueString("gaussseidel")
73 .build())
74 .build());
75
77 "Enforces end component collapsing for MinMax equation systems so that their solution becomes unique. May "
78 "simplify solving but causes some overhead.")
79 .setIsAdvanced()
80 .build());
81
83 "If set, enforce equality in the LP encoding for actions with a unique state.")
84 .setIsAdvanced()
85 .build());
86
87 this->addOption(storm::settings::OptionBuilder(moduleName, lpUseNonTrivialBoundsOptionName, false, "If set, use nontrivial bounds in the LP encoding")
88 .setIsAdvanced()
89 .build());
90
91 std::vector<std::string> optimizationObjectiveTypes = {"all", "onlyinitial"};
92 this->addOption(
94 .setIsAdvanced()
95 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("optimization-type", "What kind of optimization objective to prefer.")
96 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(optimizationObjectiveTypes))
97 .setDefaultValueString("all")
98 .build())
99 .build());
100}
101
103 std::string minMaxEquationSolvingTechnique = this->getOption(solvingMethodOptionName).getArgumentByName("name").getValueAsString();
104 if (minMaxEquationSolvingTechnique == "value-iteration" || minMaxEquationSolvingTechnique == "vi") {
105 return storm::solver::MinMaxMethod::ValueIteration;
106 } else if (minMaxEquationSolvingTechnique == "policy-iteration" || minMaxEquationSolvingTechnique == "pi") {
107 return storm::solver::MinMaxMethod::PolicyIteration;
108 } else if (minMaxEquationSolvingTechnique == "linear-programming" || minMaxEquationSolvingTechnique == "lp") {
109 return storm::solver::MinMaxMethod::LinearProgramming;
110 } else if (minMaxEquationSolvingTechnique == "ratsearch" || minMaxEquationSolvingTechnique == "rs") {
111 return storm::solver::MinMaxMethod::RationalSearch;
112 } else if (minMaxEquationSolvingTechnique == "interval-iteration" || minMaxEquationSolvingTechnique == "ii") {
113 return storm::solver::MinMaxMethod::IntervalIteration;
114 } else if (minMaxEquationSolvingTechnique == "sound-value-iteration" || minMaxEquationSolvingTechnique == "svi") {
115 return storm::solver::MinMaxMethod::SoundValueIteration;
116 } else if (minMaxEquationSolvingTechnique == "optimistic-value-iteration" || minMaxEquationSolvingTechnique == "ovi") {
117 return storm::solver::MinMaxMethod::OptimisticValueIteration;
118 } else if (minMaxEquationSolvingTechnique == "guessing-value-iteration" || minMaxEquationSolvingTechnique == "gvi") {
119 return storm::solver::MinMaxMethod::GuessingValueIteration;
120 } else if (minMaxEquationSolvingTechnique == "topological") {
121 return storm::solver::MinMaxMethod::Topological;
122 } else if (minMaxEquationSolvingTechnique == "vi-to-pi") {
123 return storm::solver::MinMaxMethod::ViToPi;
124 } else if (minMaxEquationSolvingTechnique == "vi-to-lp") {
125 return storm::solver::MinMaxMethod::ViToLp;
126 } else if (minMaxEquationSolvingTechnique == "acyclic") {
127 return storm::solver::MinMaxMethod::Acyclic;
128 }
129
130 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException,
131 "Unknown min/max equation solving technique '" << minMaxEquationSolvingTechnique << "'.");
132}
133
135 return !this->getOption(solvingMethodOptionName).getArgumentByName("name").getHasBeenSet() ||
136 this->getOption(solvingMethodOptionName).getArgumentByName("name").wasSetFromDefaultValue();
137}
138
140 return this->getOption(solvingMethodOptionName).getHasOptionBeenSet();
141}
142
144 return this->getOption(maximalIterationsOptionName).getHasOptionBeenSet();
145}
146
148 return this->getOption(maximalIterationsOptionName).getArgumentByName("count").getValueAsUnsignedInteger();
149}
150
152 return this->getOption(precisionOptionName).getHasOptionBeenSet();
153}
154
156 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
157}
158
160 return this->getOption(absoluteOptionName).getHasOptionBeenSet();
161}
162
167
169 std::string multiplicationStyleString = this->getOption(valueIterationMultiplicationStyleOptionName).getArgumentByName("name").getValueAsString();
170 if (multiplicationStyleString == "gaussseidel" || multiplicationStyleString == "gs") {
172 } else if (multiplicationStyleString == "regular" || multiplicationStyleString == "r") {
174 }
175 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown multiplication style '" << multiplicationStyleString << "'.");
176}
177
179 return this->getOption(forceUniqueSolutionRequirementOptionName).getHasOptionBeenSet();
180}
181
183 return this->getOption(lpOptimizeOnlyInitialStateOptionName).getArgumentByName("optimization-type").getValueAsString() == "onlyinitial";
184}
185
187 return this->getOption(lpUseNonTrivialBoundsOptionName).getHasOptionBeenSet();
188}
189
191 return this->getOption(lpEqualityForUniqueActionsOptionName).getHasOptionBeenSet();
192}
193
194} // namespace modules
195} // namespace settings
196} // 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 bool getHasBeenSet() const
Retrieves whether the argument has been set.
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
bool getLpUseOnlyInitialStateAsObjective() const
Retrieves whether only initial states should occur in the optimization objective.
bool getLpUseNonTrivialBounds() const
Retrieves whether additional bounds should be used when constructing the LP.
bool isMinMaxEquationSolvingMethodSetFromDefaultValue() const
Retrieves whether the min/max equation solving method is set from its default value.
bool isConvergenceCriterionSet() const
Retrieves whether the convergence criterion has been set.
uint_fast64_t getMaximalIterationCount() const
Retrieves the maximal number of iterations to perform until giving up on converging.
bool isMaximalIterationCountSet() const
Retrieves whether the maximal iteration count has been set.
bool isMinMaxEquationSolvingMethodSet() const
Retrieves whether a min/max equation solving technique has been set.
double getPrecision() const
Retrieves the precision that is used for detecting convergence.
ConvergenceCriterion getConvergenceCriterion() const
Retrieves the selected convergence criterion.
bool getLpUseEqualityForTrivialActions() const
Retrieves whether equality should be enforced where possible.
bool isPrecisionSet() const
Retrieves whether the precision has been set.
storm::solver::MultiplicationStyle getValueIterationMultiplicationStyle() const
Retrieves the multiplication style to use in the min-max methods.
storm::solver::MinMaxMethod getMinMaxEquationSolvingMethod() const
Retrieves the selected min/max equation solving method.
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_THROW(cond, exception, message)
Definition macros.h:30
const std::string forceUniqueSolutionRequirementOptionName
const std::string lpOptimizeOnlyInitialStateOptionName
const std::string valueIterationMultiplicationStyleOptionName
const std::string lpEqualityForUniqueActionsOptionName
LabParser.cpp.
Definition cli.cpp:18