Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
AbstractionSettings.cpp
Go to the documentation of this file.
2
7
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string AbstractionSettings::methodOptionName = "method";
16const std::string AbstractionSettings::moduleName = "abstraction";
17const std::string AbstractionSettings::useDecompositionOptionName = "decomposition";
18const std::string AbstractionSettings::splitModeOptionName = "split";
19const std::string AbstractionSettings::addAllGuardsOptionName = "all-guards";
20const std::string AbstractionSettings::addInitialExpressionsOptionName = "all-inits";
21const std::string AbstractionSettings::useInterpolationOptionName = "interpolation";
22const std::string AbstractionSettings::precisionOptionName = "precision";
23const std::string AbstractionSettings::relativeOptionName = "relative";
24const std::string AbstractionSettings::pivotHeuristicOptionName = "pivot-heuristic";
25const std::string AbstractionSettings::reuseResultsOptionName = "reuse";
26const std::string AbstractionSettings::restrictToRelevantStatesOptionName = "relevant";
27const std::string AbstractionSettings::solveModeOptionName = "solve";
28const std::string AbstractionSettings::maximalAbstractionOptionName = "maxabs";
29const std::string AbstractionSettings::rankRefinementPredicatesOptionName = "rankpred";
30const std::string AbstractionSettings::constraintsOptionName = "constraints";
31const std::string AbstractionSettings::useEagerRefinementOptionName = "eagerref";
32const std::string AbstractionSettings::debugOptionName = "debug";
33const std::string AbstractionSettings::injectRefinementPredicatesOptionName = "injectref";
34const std::string AbstractionSettings::fixPlayer1StrategyOptionName = "fixpl1strat";
35const std::string AbstractionSettings::fixPlayer2StrategyOptionName = "fixpl2strat";
36const std::string AbstractionSettings::validBlockModeOptionName = "validmode";
37
39 std::vector<std::string> methods = {"games", "bisimulation", "bisim"};
40 this->addOption(storm::settings::OptionBuilder(moduleName, methodOptionName, true, "Sets which abstraction-refinement method to use.")
41 .setIsAdvanced()
42 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the method to use.")
44 .setDefaultValueString("bisim")
45 .build())
46 .build());
47
48 this->addOption(storm::settings::OptionBuilder(moduleName, maximalAbstractionOptionName, false,
49 "The maximal number of abstraction to perform before solving is aborted.")
50 .setIsAdvanced()
51 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count", "The maximal abstraction count.")
52 .setDefaultValueUnsignedInteger(20000)
53 .build())
54 .build());
55
56 std::vector<std::string> onOff = {"on", "off"};
57
58 this->addOption(storm::settings::OptionBuilder(moduleName, useDecompositionOptionName, true, "Sets whether to apply decomposition during the abstraction.")
59 .setIsAdvanced()
60 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
62 .setDefaultValueString("on")
63 .build())
64 .build());
65
66 std::vector<std::string> splitModes = {"all", "none", "non-guard"};
67 this->addOption(storm::settings::OptionBuilder(moduleName, splitModeOptionName, true, "Sets which predicates are split into atoms for the refinement.")
68 .setIsAdvanced()
69 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
70 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(splitModes))
71 .setDefaultValueString("all")
72 .build())
73 .build());
74
75 std::vector<std::string> solveModes = {"dd", "sparse"};
76 this->addOption(storm::settings::OptionBuilder(moduleName, solveModeOptionName, true, "Sets how the abstractions are solved.")
77 .setIsAdvanced()
78 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
79 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(solveModes))
80 .setDefaultValueString("sparse")
81 .build())
82 .build());
83
84 this->addOption(storm::settings::OptionBuilder(moduleName, addAllGuardsOptionName, true, "Sets whether all guards are added as initial predicates.")
85 .setIsAdvanced()
86 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
88 .setDefaultValueString("on")
89 .build())
90 .build());
91
92 this->addOption(storm::settings::OptionBuilder(moduleName, addInitialExpressionsOptionName, true,
93 "Sets whether all initial expressions are added as initial predicates.")
94 .setIsAdvanced()
95 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
97 .setDefaultValueString("on")
98 .build())
99 .build());
100
101 this->addOption(storm::settings::OptionBuilder(moduleName, useInterpolationOptionName, true,
102 "Sets whether interpolation is to be used to eliminate spurious pivot blocks.")
103 .setIsAdvanced()
104 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
106 .setDefaultValueString("on")
107 .build())
108 .build());
109
110 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, true, "The precision used for detecting convergence.")
111 .setIsAdvanced()
112 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
113 .setDefaultValueDouble(1e-03)
115 .build())
116 .build());
117
118 this->addOption(storm::settings::OptionBuilder(moduleName, relativeOptionName, true, "Sets whether to use a relative termination criterion.")
119 .setIsAdvanced()
120 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
122 .setDefaultValueString("off")
123 .build())
124 .build());
125
126 std::vector<std::string> pivotHeuristic = {"nearest-max-dev", "most-prob-path", "max-weighted-dev"};
127 this->addOption(storm::settings::OptionBuilder(moduleName, pivotHeuristicOptionName, true, "Sets the pivot selection heuristic.")
128 .setIsAdvanced()
129 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of an available heuristic.")
130 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(pivotHeuristic))
131 .setDefaultValueString("nearest-max-dev")
132 .build())
133 .build());
134
135 std::vector<std::string> reuseModes = {"all", "none", "qualitative", "quantitative"};
136 this->addOption(storm::settings::OptionBuilder(moduleName, reuseResultsOptionName, true, "Sets whether to reuse all results.")
137 .setIsAdvanced()
138 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
139 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(reuseModes))
140 .setDefaultValueString("all")
141 .build())
142 .build());
143
144 this->addOption(storm::settings::OptionBuilder(moduleName, restrictToRelevantStatesOptionName, true,
145 "Sets whether to restrict to relevant states during the abstraction.")
146 .setIsAdvanced()
147 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
149 .setDefaultValueString("on")
150 .build())
151 .build());
152
153 this->addOption(storm::settings::OptionBuilder(moduleName, rankRefinementPredicatesOptionName, true,
154 "Sets whether to rank the refinement predicates if there are multiple.")
155 .setIsAdvanced()
156 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
158 .setDefaultValueString("off")
159 .build())
160 .build());
161
162 this->addOption(storm::settings::OptionBuilder(moduleName, useEagerRefinementOptionName, true, "Sets whether to refine eagerly.")
163 .setIsAdvanced()
164 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
166 .setDefaultValueString("off")
167 .build())
168 .build());
169
170 this->addOption(
171 storm::settings::OptionBuilder(moduleName, constraintsOptionName, true, "Specifies additional constraints used by the abstraction.")
172 .setIsAdvanced()
173 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("constraints", "The constraints to use.").setDefaultValueString("").build())
174 .build());
175
176 this->addOption(
177 storm::settings::OptionBuilder(moduleName, injectRefinementPredicatesOptionName, true,
178 "Specifies predicates used by the refinement instead of the derived predicates.")
179 .setIsAdvanced()
180 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("predicates", "The (semicolon-separated) refinement predicates to use.")
181 .setDefaultValueString("")
182 .build())
183 .build());
184
185 this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer1StrategyOptionName, true, "Sets whether to fix player 1 strategies.")
186 .setIsAdvanced()
187 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
189 .setDefaultValueString("on")
190 .build())
191 .build());
192
193 this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer2StrategyOptionName, true, "Sets whether to fix player 2 strategies.")
194 .setIsAdvanced()
195 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
197 .setDefaultValueString("on")
198 .build())
199 .build());
200
201 this->addOption(storm::settings::OptionBuilder(moduleName, debugOptionName, true, "Sets whether to enable debug mode.")
202 .setIsAdvanced()
203 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
205 .setDefaultValueString("off")
206 .build())
207 .build());
208
209 std::vector<std::string> validModes = {"morepreds", "blockenum"};
210 this->addOption(storm::settings::OptionBuilder(moduleName, validBlockModeOptionName, true, "Sets the mode to guarantee valid blocks only.")
211 .setIsAdvanced()
212 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
213 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(validModes))
214 .setDefaultValueString("morepreds")
215 .build())
216 .build());
217}
218
220 std::string methodAsString = this->getOption(methodOptionName).getArgumentByName("name").getValueAsString();
221 if (methodAsString == "games") {
222 return Method::Games;
223 } else if (methodAsString == "bisimulation" || methodAsString == "bisim") {
225 }
226 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown abstraction-refinement method '" << methodAsString << "'.");
227}
228
230 return this->getOption(useDecompositionOptionName).getArgumentByName("value").getValueAsString() == "on";
231}
232
234 std::string splitModeAsString = this->getOption(splitModeOptionName).getArgumentByName("mode").getValueAsString();
235 if (splitModeAsString == "all") {
236 return SplitMode::All;
237 } else if (splitModeAsString == "none") {
238 return SplitMode::None;
239 } else if (splitModeAsString == "non-guard") {
240 return SplitMode::NonGuard;
241 }
242 return SplitMode::All;
243}
244
246 std::string solveModeAsString = this->getOption(solveModeOptionName).getArgumentByName("mode").getValueAsString();
247 if (solveModeAsString == "dd") {
248 return SolveMode::Dd;
249 }
250 return SolveMode::Sparse;
251}
252
254 return this->getOption(addAllGuardsOptionName).getArgumentByName("value").getValueAsString() == "on";
255}
256
258 return this->getOption(addInitialExpressionsOptionName).getArgumentByName("value").getValueAsString() == "on";
259}
260
262 this->getOption(addAllGuardsOptionName).getArgumentByName("value").setFromStringValue(value ? "on" : "off");
263}
264
266 this->getOption(addInitialExpressionsOptionName).getArgumentByName("value").setFromStringValue(value ? "on" : "off");
267}
268
270 return this->getOption(useInterpolationOptionName).getArgumentByName("value").getValueAsString() == "on";
271}
272
274 return this->getOption(restrictToRelevantStatesOptionName).getArgumentByName("value").getValueAsString() == "on";
275}
276
278 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
279}
280
282 return this->getOption(relativeOptionName).getArgumentByName("value").getValueAsString() == "on";
283}
284
286 std::string heuristicName = this->getOption(pivotHeuristicOptionName).getArgumentByName("name").getValueAsString();
287 if (heuristicName == "nearest-max-dev") {
289 } else if (heuristicName == "most-prob-path") {
291 } else if (heuristicName == "max-weighted-dev") {
293 }
294 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown pivot selection heuristic '" << heuristicName << "'.");
295}
296
298 std::string reuseModeAsString = this->getOption(reuseResultsOptionName).getArgumentByName("mode").getValueAsString();
299 if (reuseModeAsString == "all") {
300 return ReuseMode::All;
301 } else if (reuseModeAsString == "none") {
302 return ReuseMode::None;
303 } else if (reuseModeAsString == "qualitative") {
305 } else if (reuseModeAsString == "quantitative") {
307 }
308 return ReuseMode::All;
309}
310
312 return this->getOption(maximalAbstractionOptionName).getArgumentByName("count").getValueAsUnsignedInteger();
313}
314
316 return this->getOption(rankRefinementPredicatesOptionName).getArgumentByName("value").getValueAsString() == "on";
317}
318
320 return this->getOption(constraintsOptionName).getHasOptionBeenSet();
321}
322
324 return this->getOption(constraintsOptionName).getArgumentByName("constraints").getValueAsString();
325}
326
328 return this->getOption(useEagerRefinementOptionName).getArgumentByName("value").getValueAsString() == "on";
329}
330
332 return this->getOption(debugOptionName).getArgumentByName("value").getValueAsString() == "on";
333}
334
336 return this->getOption(injectRefinementPredicatesOptionName).getHasOptionBeenSet();
337}
338
340 return this->getOption(injectRefinementPredicatesOptionName).getArgumentByName("predicates").getValueAsString();
341}
342
344 return this->getOption(fixPlayer1StrategyOptionName).getArgumentByName("value").getValueAsString() == "on";
345}
346
348 return this->getOption(fixPlayer2StrategyOptionName).getArgumentByName("value").getValueAsString() == "on";
349}
350
352 std::string modeAsString = this->getOption(validBlockModeOptionName).getArgumentByName("mode").getValueAsString();
353 if (modeAsString == "morepreds") {
355 } else if (modeAsString == "blockenum") {
357 }
359}
360
361} // namespace modules
362} // namespace settings
363} // 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)
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
PivotSelectionHeuristic getPivotSelectionHeuristic() const
Retrieves the selected heuristic to select pivot blocks.
bool isUseEagerRefinementSet() const
Retrieves whether to refine eagerly.
bool isFixPlayer1StrategySet() const
Retrieves whether player 1 strategies are to be fixed.
bool isAddAllInitialExpressionsSet() const
Retrieves whether the option to add all initial expressions was set.
double getPrecision() const
Retrieves the precision that is used for detecting convergence.
SolveMode getSolveMode() const
Retrieves the mode with which to solve the games.
uint_fast64_t getMaximalAbstractionCount() const
Retrieves the maximal number of abstractions to perform until giving up on converging.
void setAddAllInitialExpressions(bool value)
Sets the option to add all initial expressions to the specified value.
std::string getInjectedRefinementPredicates() const
Retrieves a string containing refinement predicates to inject (if there are any).
SplitMode getSplitMode() const
Retrieves the selected split mode.
Method getAbstractionRefinementMethod() const
Retrieves the selected abstraction refinement method.
bool isUseInterpolationSet() const
Retrieves whether the option to use interpolation was set.
bool isUseDecompositionSet() const
Retrieves whether the option to use the decomposition was set.
bool isAddAllGuardsSet() const
Retrieves whether the option to add all guards was set.
ValidBlockMode getValidBlockMode() const
Retrieves the selected mode to guarantee valid blocks.
void setAddAllGuards(bool value)
Sets the option to add all guards to the specified value.
bool getRelativeTerminationCriterion() const
Retrieves whether to use a relative termination criterion for detecting convergence.
bool isConstraintsSet() const
Retrieves whether the constraints option was set.
ReuseMode getReuseMode() const
Retrieves the selected reuse mode.
bool isInjectRefinementPredicatesSet() const
Retrieves whether the option to inject the refinement predicates is set.
bool isDebugSet() const
Retrieves whether the debug option was set.
AbstractionSettings()
Creates a new set of abstraction settings.
bool isFixPlayer2StrategySet() const
Retrieves whether player 2 strategies are to be fixed.
bool isRestrictToRelevantStatesSet() const
Retrieves whether only relevant states are to be considered.
std::string getConstraintString() const
Retrieves the string that specifies additional constraints.
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
LabParser.cpp.
Definition cli.cpp:18