Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BeliefExplorationSettings.cpp
Go to the documentation of this file.
2
6
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string BeliefExplorationSettings::moduleName = "beliefExploration";
16
17const std::string refineOption = "refine";
18const std::string explorationTimeLimitOption = "exploration-time";
19const std::string resolutionOption = "resolution";
20const std::string clipGridResolutionOption = "clip-resolution";
21const std::string sizeThresholdOption = "size-threshold";
22const std::string gapThresholdOption = "gap-threshold";
23const std::string optimalChoiceValueThresholdOption = "optimal-choice-value-threshold";
24const std::string observationThresholdOption = "obs-threshold";
25const std::string numericPrecisionOption = "numeric-precision";
26const std::string triangulationModeOption = "triangulationmode";
27const std::string clippingOption = "use-clipping";
28const std::string cutZeroGapOption = "cut-zero-gap";
29const std::string stateEliminationCutoffOption = "state-elimination-cutoff";
30
32 this->addOption(
34 "Refines the result bounds until reaching either the goal precision or the refinement step limit")
35 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("prec", "The goal precision.")
37 .makeOptional()
39 .build())
40 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("steps", "The number of allowed refinement steps (0 means no limit).")
42 .makeOptional()
43 .build())
44 .build());
45
46 this->addOption(
47 storm::settings::OptionBuilder(moduleName, explorationTimeLimitOption, false, "Sets after which time no further states shall be explored.")
49 .build());
50
51 this->addOption(
53 "Sets the resolution of the discretization and how it is increased in case of refinement")
54 .setIsAdvanced()
55 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("init", "the initial resolution (higher means more precise)")
58 .build())
60 "factor", "Multiplied to the resolution of refined observations (higher means more precise).")
62 .makeOptional()
64 .build())
65 .build());
66
67 this->addOption(storm::settings::OptionBuilder(moduleName, clipGridResolutionOption, false, "Sets the resolution of the clipping grid")
68 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("resolution", "the resolution (higher means more precise)")
71 .build())
72 .build());
73
74 this->addOption(
75 storm::settings::OptionBuilder(moduleName, observationThresholdOption, false, "Only observations whose score is below this threshold will be refined.")
76 .setIsAdvanced()
77 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("init", "initial threshold (higher means more precise")
80 .build())
82 "factor", "Controlls how fast the threshold is increased in each refinement step (higher means more precise).")
84 .makeOptional()
86 .build())
87 .build());
88
89 this->addOption(
92 "Sets how many new states are explored or rewired in a refinement step and how this value is increased in case of refinement.")
93 .setIsAdvanced()
94 .addArgument(
95 storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("init", "initial limit (higher means more precise, 0 means automatic choice)")
97 .build())
99 "factor", "Before each step the new threshold is set to the current state count times this number (higher means more precise).")
101 .makeOptional()
103 .build())
104 .build());
105
106 this->addOption(
108 "Sets how large the gap between known lower- and upper bounds at a beliefstate needs to be in order to explore")
109 .setIsAdvanced()
110 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("init", "initial threshold (higher means less precise")
113 .build())
114 .addArgument(
115 storm::settings::ArgumentBuilder::createDoubleArgument("factor", "Multiplied to the gap in each refinement step (higher means less precise).")
117 .makeOptional()
119 .build())
120 .build());
121
123 "Sets how much worse a sub-optimal choice can be in order to be included in the relevant explored fragment")
124 .setIsAdvanced()
125 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("init", "initial threshold (higher means more precise")
128 .build())
130 "factor", "Multiplied to the threshold in each refinement step (higher means more precise).")
132 .makeOptional()
134 .build())
135 .build());
136
137 this->addOption(
138 storm::settings::OptionBuilder(moduleName, numericPrecisionOption, false, "Sets the precision used to determine whether two belief-states are equal.")
139 .setIsAdvanced()
140 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "the precision")
142 .makeOptional()
144 .build())
145 .build());
146
147 this->addOption(storm::settings::OptionBuilder(moduleName, triangulationModeOption, false, "Sets how to triangulate beliefs when discretizing.")
148 .setIsAdvanced()
149 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("value", "the triangulation mode")
150 .setDefaultValueString("dynamic")
152 .build())
153 .build());
154 this->addOption(
155 storm::settings::OptionBuilder(moduleName, clippingOption, false, "If this is set, unfolding will use (grid) clipping instead of cut-offs only.")
156 .build());
157 this->addOption(
158 storm::settings::OptionBuilder(moduleName, cutZeroGapOption, false, "Cut beliefs where the gap between over- and underapproximation is 0.").build());
160 "If this is set, an additional unfolding step for cut-off beliefs is performed.")
161 .build());
162}
163
165 return this->getOption(refineOption).getHasOptionBeenSet();
166}
167
169 return this->getOption(stateEliminationCutoffOption).getHasOptionBeenSet();
170}
171
173 return this->getOption(refineOption).getArgumentByName("prec").getValueAsDouble();
174}
175
179
181 return this->getOption(explorationTimeLimitOption).getArgumentByName("time").getValueAsUnsignedInteger();
182}
183
187
189 return this->getOption(clipGridResolutionOption).getArgumentByName("resolution").getValueAsUnsignedInteger();
190}
191
193 return this->getOption(resolutionOption).getArgumentByName("factor").getValueAsDouble();
194}
195
199
201 return this->getOption(sizeThresholdOption).getArgumentByName("factor").getValueAsDouble();
202}
203
205 return this->getOption(gapThresholdOption).getArgumentByName("init").getValueAsDouble();
206}
207
209 return this->getOption(gapThresholdOption).getArgumentByName("factor").getValueAsDouble();
210}
211
213 return this->getOption(optimalChoiceValueThresholdOption).getArgumentByName("init").getValueAsDouble();
214}
215
217 return this->getOption(optimalChoiceValueThresholdOption).getArgumentByName("factor").getValueAsDouble();
218}
219
221 return this->getOption(observationThresholdOption).getArgumentByName("init").getValueAsDouble();
222}
223
225 return this->getOption(observationThresholdOption).getArgumentByName("factor").getValueAsDouble();
226}
227
229 return !this->getOption(numericPrecisionOption).getHasOptionBeenSet() ||
230 this->getOption(numericPrecisionOption).getArgumentByName("value").wasSetFromDefaultValue();
231}
232
234 return this->getOption(numericPrecisionOption).getArgumentByName("value").getValueAsDouble();
235}
236
238 return this->getOption(triangulationModeOption).getArgumentByName("value").getValueAsString() == "dynamic";
239}
241 return this->getOption(triangulationModeOption).getArgumentByName("value").getValueAsString() == "static";
242}
243
245 return this->getOption(clippingOption).getHasOptionBeenSet();
246}
247
249 return this->getOption(cutZeroGapOption).getHasOptionBeenSet();
250}
251
252template<typename ValueType>
254 options.refine = isRefineSet();
255 options.refinePrecision = storm::utility::convertNumber<ValueType>(getRefinePrecision());
258
261 options.resolutionFactor = storm::utility::convertNumber<ValueType>(getResolutionFactor());
263 options.sizeThresholdFactor = storm::utility::convertNumber<ValueType>(getSizeThresholdFactor());
264 options.gapThresholdInit = storm::utility::convertNumber<ValueType>(getGapThresholdInit());
265 options.gapThresholdFactor = storm::utility::convertNumber<ValueType>(getGapThresholdFactor());
266 options.optimalChoiceValueThresholdInit = storm::utility::convertNumber<ValueType>(getOptimalChoiceValueThresholdInit());
267 options.optimalChoiceValueThresholdFactor = storm::utility::convertNumber<ValueType>(getOptimalChoiceValueThresholdFactor());
268 options.obsThresholdInit = storm::utility::convertNumber<ValueType>(getObservationScoreThresholdInit());
269 options.obsThresholdIncrementFactor = storm::utility::convertNumber<ValueType>(getObservationScoreThresholdFactor());
270 options.useClipping = isUseClippingSet();
272
273 options.numericPrecision = storm::utility::convertNumber<ValueType>(getNumericPrecision());
276 STORM_LOG_WARN_COND(storm::utility::isZero(options.numericPrecision), "Setting numeric precision to zero because exact arithmethic is used.");
277 options.numericPrecision = storm::utility::zero<ValueType>();
278 } else {
280 "A non-zero numeric precision was set although exact arithmethic is used. Results might be inexact.");
281 }
282 }
284 options.cutZeroGap = isCutZeroGapSet();
285}
286
287template void BeliefExplorationSettings::setValuesInOptionsStruct<double>(
289template void BeliefExplorationSettings::setValuesInOptionsStruct<storm::RationalNumber>(
291
292} // namespace modules
293} // namespace settings
294} // 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 > > createDoubleGreaterValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< uint64_t > > createUnsignedGreaterValidator(uint64_t lowerBound)
static std::shared_ptr< ArgumentValidator< double > > createDoubleGreaterEqualValidator(double lowerBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
static std::shared_ptr< ArgumentValidator< double > > createDoubleRangeValidatorIncluding(double lowerBound, double upperBound)
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
uint64_t getClippingGridResolution() const
Clipping Grid Resolution.
double getGapThresholdInit() const
Controls how large the gap between known lower- and upper bounds at a beliefstate needs to be in orde...
double getObservationScoreThresholdInit() const
Controls which observations are refined.
BeliefExplorationSettings()
Creates a new set of POMDP settings.
uint64_t getSizeThresholdInit() const
The maximal number of newly expanded MDP states in a refinement step.
bool isUseClippingSet() const
Controls if (grid) clipping is to be used.
double getOptimalChoiceValueThresholdInit() const
Controls whether "almost optimal" choices will be considered optimal.
void setValuesInOptionsStruct(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions< ValueType > &options) const
bool isNumericPrecisionSetFromDefault() const
Used to determine whether two beliefs are equal.
uint64_t getResolutionInit() const
Discretization Resolution.
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_WARN_COND(cond, message)
Definition macros.h:38
const std::string optimalChoiceValueThresholdOption
SettingsType const & getModule()
Get module.
bool isZero(ValueType const &a)
Definition constants.cpp:41
LabParser.cpp.
Definition cli.cpp:18