Storm 1.14.0.1
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
15namespace {
16// The defaults of the options are taken from the library's default-constructed options.
17storm::gbar::abstraction::AbstractionOptions const defaultOptions;
18
19std::string flagToString(bool value) {
20 return value ? "on" : "off";
21}
22
24 switch (mode) {
26 return "all";
28 return "none";
30 return "non-guard";
31 }
32 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown split mode.");
33}
34
36 switch (mode) {
38 return "dd";
40 return "sparse";
41 }
42 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown solve mode.");
43}
44
46 switch (heuristic) {
48 return "nearest-max-dev";
50 return "most-prob-path";
52 return "max-weighted-dev";
53 }
54 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown pivot selection heuristic.");
55}
56
58 switch (mode) {
60 return "all";
62 return "none";
64 return "qualitative";
66 return "quantitative";
67 }
68 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown reuse mode.");
69}
70
71std::string validBlockModeToString(bool restrictToValidBlocks) {
72 return restrictToValidBlocks ? "blockenum" : "morepreds";
73}
74} // namespace
75
76const std::string AbstractionSettings::methodOptionName = "method";
77const std::string AbstractionSettings::moduleName = "abstraction";
78const std::string AbstractionSettings::useDecompositionOptionName = "decomposition";
79const std::string AbstractionSettings::splitModeOptionName = "split";
80const std::string AbstractionSettings::addAllGuardsOptionName = "all-guards";
81const std::string AbstractionSettings::addInitialExpressionsOptionName = "all-inits";
82const std::string AbstractionSettings::useInterpolationOptionName = "interpolation";
83const std::string AbstractionSettings::precisionOptionName = "precision";
84const std::string AbstractionSettings::relativeOptionName = "relative";
85const std::string AbstractionSettings::pivotHeuristicOptionName = "pivot-heuristic";
86const std::string AbstractionSettings::reuseResultsOptionName = "reuse";
87const std::string AbstractionSettings::restrictToRelevantStatesOptionName = "relevant";
88const std::string AbstractionSettings::solveModeOptionName = "solve";
89const std::string AbstractionSettings::maximalAbstractionOptionName = "maxabs";
90const std::string AbstractionSettings::rankRefinementPredicatesOptionName = "rankpred";
91const std::string AbstractionSettings::constraintsOptionName = "constraints";
92const std::string AbstractionSettings::useEagerRefinementOptionName = "eagerref";
93const std::string AbstractionSettings::debugOptionName = "debug";
94const std::string AbstractionSettings::injectRefinementPredicatesOptionName = "injectref";
95const std::string AbstractionSettings::fixPlayer1StrategyOptionName = "fixpl1strat";
96const std::string AbstractionSettings::fixPlayer2StrategyOptionName = "fixpl2strat";
97const std::string AbstractionSettings::validBlockModeOptionName = "validmode";
98
100 std::vector<std::string> methods = {"games", "bisimulation", "bisim"};
101 this->addOption(storm::settings::OptionBuilder(moduleName, methodOptionName, true, "Sets which abstraction-refinement method to use.")
102 .setIsAdvanced()
103 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the method to use.")
105 .setDefaultValueString("bisim")
106 .build())
107 .build());
108
109 this->addOption(storm::settings::OptionBuilder(moduleName, maximalAbstractionOptionName, false,
110 "The maximal number of abstraction to perform before solving is aborted.")
111 .setIsAdvanced()
112 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("count", "The maximal abstraction count.")
113 .setDefaultValueUnsignedInteger(defaultOptions.maximalNumberOfAbstractions)
114 .build())
115 .build());
116
117 std::vector<std::string> onOff = {"on", "off"};
118
119 this->addOption(storm::settings::OptionBuilder(moduleName, useDecompositionOptionName, true, "Sets whether to apply decomposition during the abstraction.")
120 .setIsAdvanced()
121 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
123 .setDefaultValueString(flagToString(defaultOptions.useDecomposition))
124 .build())
125 .build());
126
127 std::vector<std::string> splitModes = {"all", "none", "non-guard"};
128 this->addOption(storm::settings::OptionBuilder(moduleName, splitModeOptionName, true, "Sets which predicates are split into atoms for the refinement.")
129 .setIsAdvanced()
130 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
131 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(splitModes))
132 .setDefaultValueString(toString(defaultOptions.splitMode))
133 .build())
134 .build());
135
136 std::vector<std::string> solveModes = {"dd", "sparse"};
137 this->addOption(storm::settings::OptionBuilder(moduleName, solveModeOptionName, true, "Sets how the abstractions are solved.")
138 .setIsAdvanced()
139 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
140 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(solveModes))
141 .setDefaultValueString(toString(defaultOptions.solveMode))
142 .build())
143 .build());
144
145 this->addOption(storm::settings::OptionBuilder(moduleName, addAllGuardsOptionName, true, "Sets whether all guards are added as initial predicates.")
146 .setIsAdvanced()
147 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
149 .setDefaultValueString(flagToString(defaultOptions.addAllGuards))
150 .build())
151 .build());
152
153 this->addOption(storm::settings::OptionBuilder(moduleName, addInitialExpressionsOptionName, true,
154 "Sets whether all initial expressions are added as initial predicates.")
155 .setIsAdvanced()
156 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
158 .setDefaultValueString(flagToString(defaultOptions.addAllInitialExpressions))
159 .build())
160 .build());
161
162 this->addOption(storm::settings::OptionBuilder(moduleName, useInterpolationOptionName, true,
163 "Sets whether interpolation is to be used to eliminate spurious pivot blocks.")
164 .setIsAdvanced()
165 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
167 .setDefaultValueString(flagToString(defaultOptions.useInterpolation))
168 .build())
169 .build());
170
171 this->addOption(storm::settings::OptionBuilder(moduleName, precisionOptionName, true, "The precision used for detecting convergence.")
172 .setIsAdvanced()
173 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision to achieve.")
174 .setDefaultValueDouble(defaultOptions.precision)
176 .build())
177 .build());
178
179 this->addOption(storm::settings::OptionBuilder(moduleName, relativeOptionName, true, "Sets whether to use a relative termination criterion.")
180 .setIsAdvanced()
181 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
183 .setDefaultValueString(flagToString(defaultOptions.relativeTerminationCriterion))
184 .build())
185 .build());
186
187 std::vector<std::string> pivotHeuristic = {"nearest-max-dev", "most-prob-path", "max-weighted-dev"};
188 this->addOption(storm::settings::OptionBuilder(moduleName, pivotHeuristicOptionName, true, "Sets the pivot selection heuristic.")
189 .setIsAdvanced()
190 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of an available heuristic.")
191 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(pivotHeuristic))
192 .setDefaultValueString(toString(defaultOptions.pivotSelectionHeuristic))
193 .build())
194 .build());
195
196 std::vector<std::string> reuseModes = {"all", "none", "qualitative", "quantitative"};
197 this->addOption(storm::settings::OptionBuilder(moduleName, reuseResultsOptionName, true, "Sets whether to reuse all results.")
198 .setIsAdvanced()
199 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
200 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(reuseModes))
201 .setDefaultValueString(toString(defaultOptions.reuseMode))
202 .build())
203 .build());
204
205 this->addOption(storm::settings::OptionBuilder(moduleName, restrictToRelevantStatesOptionName, true,
206 "Sets whether to restrict to relevant states during the abstraction.")
207 .setIsAdvanced()
208 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
210 .setDefaultValueString(flagToString(defaultOptions.restrictToRelevantStates))
211 .build())
212 .build());
213
214 this->addOption(storm::settings::OptionBuilder(moduleName, rankRefinementPredicatesOptionName, true,
215 "Sets whether to rank the refinement predicates if there are multiple.")
216 .setIsAdvanced()
217 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
219 .setDefaultValueString(flagToString(defaultOptions.rankRefinementPredicates))
220 .build())
221 .build());
222
223 this->addOption(storm::settings::OptionBuilder(moduleName, useEagerRefinementOptionName, true, "Sets whether to refine eagerly.")
224 .setIsAdvanced()
225 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
227 .setDefaultValueString(flagToString(defaultOptions.useEagerRefinement))
228 .build())
229 .build());
230
231 this->addOption(
232 storm::settings::OptionBuilder(moduleName, constraintsOptionName, true, "Specifies additional constraints used by the abstraction.")
233 .setIsAdvanced()
234 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("constraints", "The constraints to use.").setDefaultValueString("").build())
235 .build());
236
237 this->addOption(
238 storm::settings::OptionBuilder(moduleName, injectRefinementPredicatesOptionName, true,
239 "Specifies predicates used by the refinement instead of the derived predicates.")
240 .setIsAdvanced()
241 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("predicates", "The (semicolon-separated) refinement predicates to use.")
242 .setDefaultValueString("")
243 .build())
244 .build());
245
246 this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer1StrategyOptionName, true, "Sets whether to fix player 1 strategies.")
247 .setIsAdvanced()
248 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
250 .setDefaultValueString(flagToString(defaultOptions.fixPlayer1Strategy))
251 .build())
252 .build());
253
254 this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer2StrategyOptionName, true, "Sets whether to fix player 2 strategies.")
255 .setIsAdvanced()
256 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
258 .setDefaultValueString(flagToString(defaultOptions.fixPlayer2Strategy))
259 .build())
260 .build());
261
262 this->addOption(storm::settings::OptionBuilder(moduleName, debugOptionName, true, "Sets whether to enable debug mode.")
263 .setIsAdvanced()
264 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "The value of the flag.")
266 .setDefaultValueString(flagToString(defaultOptions.debug))
267 .build())
268 .build());
269
270 std::vector<std::string> validModes = {"morepreds", "blockenum"};
271 this->addOption(storm::settings::OptionBuilder(moduleName, validBlockModeOptionName, true, "Sets the mode to guarantee valid blocks only.")
272 .setIsAdvanced()
273 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
274 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(validModes))
275 .setDefaultValueString(validBlockModeToString(defaultOptions.restrictToValidBlocks))
276 .build())
277 .build());
278}
279
281 std::string methodAsString = this->getOption(methodOptionName).getArgumentByName("name").getValueAsString();
282 if (methodAsString == "games") {
283 return Method::Games;
284 } else if (methodAsString == "bisimulation" || methodAsString == "bisim") {
286 }
287 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown abstraction-refinement method '" << methodAsString << "'.");
288}
289
291 return this->getOption(useDecompositionOptionName).getArgumentByName("value").getValueAsString() == "on";
292}
293
295 std::string splitModeAsString = this->getOption(splitModeOptionName).getArgumentByName("mode").getValueAsString();
296 if (splitModeAsString == "all") {
297 return SplitMode::All;
298 } else if (splitModeAsString == "none") {
299 return SplitMode::None;
300 } else if (splitModeAsString == "non-guard") {
301 return SplitMode::NonGuard;
302 }
303 return SplitMode::All;
304}
305
307 std::string solveModeAsString = this->getOption(solveModeOptionName).getArgumentByName("mode").getValueAsString();
308 if (solveModeAsString == "dd") {
309 return SolveMode::Dd;
310 }
311 return SolveMode::Sparse;
312}
313
315 return this->getOption(addAllGuardsOptionName).getArgumentByName("value").getValueAsString() == "on";
316}
317
319 return this->getOption(addInitialExpressionsOptionName).getArgumentByName("value").getValueAsString() == "on";
320}
321
323 this->getOption(addAllGuardsOptionName).getArgumentByName("value").setFromStringValue(value ? "on" : "off");
324}
325
327 this->getOption(addInitialExpressionsOptionName).getArgumentByName("value").setFromStringValue(value ? "on" : "off");
328}
329
331 return this->getOption(useInterpolationOptionName).getArgumentByName("value").getValueAsString() == "on";
332}
333
335 return this->getOption(restrictToRelevantStatesOptionName).getArgumentByName("value").getValueAsString() == "on";
336}
337
339 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
340}
341
343 return this->getOption(relativeOptionName).getArgumentByName("value").getValueAsString() == "on";
344}
345
347 std::string heuristicName = this->getOption(pivotHeuristicOptionName).getArgumentByName("name").getValueAsString();
348 if (heuristicName == "nearest-max-dev") {
349 return AbstractionSettings::PivotSelectionHeuristic::NearestMaximalDeviation;
350 } else if (heuristicName == "most-prob-path") {
351 return AbstractionSettings::PivotSelectionHeuristic::MostProbablePath;
352 } else if (heuristicName == "max-weighted-dev") {
353 return AbstractionSettings::PivotSelectionHeuristic::MaxWeightedDeviation;
354 }
355 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::IllegalArgumentValueException, "Unknown pivot selection heuristic '" << heuristicName << "'.");
356}
357
359 std::string reuseModeAsString = this->getOption(reuseResultsOptionName).getArgumentByName("mode").getValueAsString();
360 if (reuseModeAsString == "all") {
361 return ReuseMode::All;
362 } else if (reuseModeAsString == "none") {
363 return ReuseMode::None;
364 } else if (reuseModeAsString == "qualitative") {
365 return ReuseMode::Qualitative;
366 } else if (reuseModeAsString == "quantitative") {
367 return ReuseMode::Quantitative;
368 }
369 return ReuseMode::All;
370}
371
373 return this->getOption(maximalAbstractionOptionName).getArgumentByName("count").getValueAsUnsignedInteger();
374}
375
377 return this->getOption(rankRefinementPredicatesOptionName).getArgumentByName("value").getValueAsString() == "on";
378}
379
381 return this->getOption(constraintsOptionName).getHasOptionBeenSet();
382}
383
385 return this->getOption(constraintsOptionName).getArgumentByName("constraints").getValueAsString();
386}
387
389 return this->getOption(useEagerRefinementOptionName).getArgumentByName("value").getValueAsString() == "on";
390}
391
393 return this->getOption(debugOptionName).getArgumentByName("value").getValueAsString() == "on";
394}
395
397 return this->getOption(injectRefinementPredicatesOptionName).getHasOptionBeenSet();
398}
399
401 return this->getOption(injectRefinementPredicatesOptionName).getArgumentByName("predicates").getValueAsString();
402}
403
405 return this->getOption(fixPlayer1StrategyOptionName).getArgumentByName("value").getValueAsString() == "on";
406}
407
409 return this->getOption(fixPlayer2StrategyOptionName).getArgumentByName("value").getValueAsString() == "on";
410}
411
413 std::string modeAsString = this->getOption(validBlockModeOptionName).getArgumentByName("mode").getValueAsString();
414 if (modeAsString == "morepreds") {
415 return ValidBlockMode::MorePredicates;
416 } else if (modeAsString == "blockenum") {
417 return ValidBlockMode::BlockEnumeration;
418 }
419 return ValidBlockMode::MorePredicates;
420}
421
422} // namespace modules
423} // namespace settings
424} // 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...
std::shared_ptr< Option > build()
Builds an option from the data that was added to this builder.
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.
storm::gbar::abstraction::PivotSelectionHeuristic PivotSelectionHeuristic
storm::gbar::abstraction::SolveMode SolveMode
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.
storm::gbar::abstraction::ReuseMode ReuseMode
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.
storm::gbar::abstraction::ValidBlockMode ValidBlockMode
std::string getConstraintString() const
Retrieves the string that specifies additional constraints.
storm::gbar::abstraction::SplitMode SplitMode
ModuleSettings(std::string const &moduleName)
Constructs a new settings object.
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_UNCONDITIONALLY(exception, message)
Definition macros.h:48
std::string toString(DFTElementType const &type)
bool useDecomposition
A flag indicating whether decomposition is to be used during the abstraction.
bool relativeTerminationCriterion
A flag indicating whether to use a relative termination criterion.
SolveMode solveMode
The mode with which to solve the abstractions.
bool restrictToValidBlocks
A flag indicating whether the abstractor restricts the initial states to valid blocks.
bool useInterpolation
A flag indicating whether interpolation is to be used to eliminate spurious pivot blocks.
ReuseMode reuseMode
The mode determining which results are reused.
bool fixPlayer1Strategy
A flag indicating whether player 1 strategies are to be fixed.
bool debug
A flag indicating whether debug mode is enabled.
bool fixPlayer2Strategy
A flag indicating whether player 2 strategies are to be fixed.
bool addAllInitialExpressions
A flag indicating whether all initial expressions are added as initial predicates.
bool useEagerRefinement
A flag indicating whether to refine eagerly.
SplitMode splitMode
The mode that determines which predicates are split into atoms for the refinement.
bool rankRefinementPredicates
A flag indicating whether refinement predicates are to be ranked.
bool addAllGuards
A flag indicating whether all guards are added as initial predicates.
bool restrictToRelevantStates
A flag indicating whether the abstractor restricts the abstraction to relevant states.
uint_fast64_t maximalNumberOfAbstractions
The maximal number of abstractions to perform until giving up on converging.
double precision
The precision used for detecting convergence.
PivotSelectionHeuristic pivotSelectionHeuristic
The heuristic to use for pivot block selection.