Browse Source

Added settings to switch between different triangulation modes.

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
71c410a3be
  1. 13
      src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.cpp
  2. 3
      src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.h

13
src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.cpp

@ -27,6 +27,7 @@ namespace storm {
const std::string schedulerThresholdOption = "scheduler-threshold";
const std::string observationThresholdOption = "obs-threshold";
const std::string numericPrecisionOption = "numeric-precision";
const std::string triangulationModeOption = "triangulationmode";
BeliefExplorationSettings::BeliefExplorationSettings() : ModuleSettings(moduleName) {
@ -46,6 +47,9 @@ namespace storm {
this->addOption(storm::settings::OptionBuilder(moduleName, numericPrecisionOption, false,"Sets the precision used to determine whether two belief-states are equal.").setIsAdvanced().addArgument(
storm::settings::ArgumentBuilder::createDoubleArgument("value","the precision").setDefaultValueDouble(1e-9).makeOptional().addValidatorDouble(storm::settings::ArgumentValidatorFactory::createDoubleRangeValidatorIncluding(0, 1)).build()).build());
this->addOption(storm::settings::OptionBuilder(moduleName, triangulationModeOption, false,"Sets how to triangulate beliefs when discretizing.").setIsAdvanced().addArgument(
storm::settings::ArgumentBuilder::createStringArgument("value","the triangulation mode").setDefaultValueString("dynamic").addValidatorString(storm::settings::ArgumentValidatorFactory::createMultipleChoiceValidator({"dynamic", "static"})).build()).build());
}
bool BeliefExplorationSettings::isRefineSet() const {
@ -121,6 +125,14 @@ namespace storm {
return this->getOption(numericPrecisionOption).getArgumentByName("value").getValueAsDouble();
}
bool BeliefExplorationSettings::isDynamicTriangulationModeSet() const {
return this->getOption(triangulationModeOption).getArgumentByName("value").getValueAsString() == "dynamic";
}
bool BeliefExplorationSettings::isStaticTriangulationModeSet() const {
return this->getOption(triangulationModeOption).getArgumentByName("value").getValueAsString() == "static";
}
template<typename ValueType>
void BeliefExplorationSettings::setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const {
options.refine = isRefineSet();
@ -155,6 +167,7 @@ namespace storm {
STORM_LOG_WARN_COND(storm::utility::isZero(options.numericPrecision), "A non-zero numeric precision was set although exact arithmethic is used. Results might be inexact.");
}
}
options.dynamicTriangulation = isDynamicTriangulationModeSet();
}
template void BeliefExplorationSettings::setValuesInOptionsStruct<double>(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<double>& options) const;

3
src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.h

@ -57,6 +57,9 @@ namespace storm {
/// Used to determine whether two beliefs are equal
bool isNumericPrecisionSetFromDefault() const;
double getNumericPrecision() const;
bool isDynamicTriangulationModeSet() const;
bool isStaticTriangulationModeSet() const;
template<typename ValueType>
void setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const;

Loading…
Cancel
Save