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 schedulerThresholdOption = "scheduler-threshold";
const std::string observationThresholdOption = "obs-threshold"; const std::string observationThresholdOption = "obs-threshold";
const std::string numericPrecisionOption = "numeric-precision"; const std::string numericPrecisionOption = "numeric-precision";
const std::string triangulationModeOption = "triangulationmode";
BeliefExplorationSettings::BeliefExplorationSettings() : ModuleSettings(moduleName) { 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( 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()); 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 { bool BeliefExplorationSettings::isRefineSet() const {
@ -121,6 +125,14 @@ namespace storm {
return this->getOption(numericPrecisionOption).getArgumentByName("value").getValueAsDouble(); 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> template<typename ValueType>
void BeliefExplorationSettings::setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const { void BeliefExplorationSettings::setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const {
options.refine = isRefineSet(); 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."); 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; template void BeliefExplorationSettings::setValuesInOptionsStruct<double>(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<double>& options) const;

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

@ -58,6 +58,9 @@ namespace storm {
bool isNumericPrecisionSetFromDefault() const; bool isNumericPrecisionSetFromDefault() const;
double getNumericPrecision() const; double getNumericPrecision() const;
bool isDynamicTriangulationModeSet() const;
bool isStaticTriangulationModeSet() const;
template<typename ValueType> template<typename ValueType>
void setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const; void setValuesInOptionsStruct(storm::pomdp::modelchecker::ApproximatePOMDPModelCheckerOptions<ValueType>& options) const;

Loading…
Cancel
Save