Tim Quatmann
5 years ago
6 changed files with 124 additions and 46 deletions
-
2src/storm-pomdp-cli/settings/PomdpSettings.cpp
-
63src/storm-pomdp-cli/settings/modules/GridApproximationSettings.cpp
-
40src/storm-pomdp-cli/settings/modules/GridApproximationSettings.h
-
17src/storm-pomdp-cli/settings/modules/POMDPSettings.cpp
-
3src/storm-pomdp-cli/settings/modules/POMDPSettings.h
-
45src/storm-pomdp-cli/storm-pomdp.cpp
@ -0,0 +1,63 @@ |
|||
#include "storm-pomdp-cli/settings/modules/GridApproximationSettings.h"
|
|||
|
|||
#include "storm/settings/SettingsManager.h"
|
|||
#include "storm/settings/SettingMemento.h"
|
|||
#include "storm/settings/Option.h"
|
|||
#include "storm/settings/OptionBuilder.h"
|
|||
#include "storm/settings/ArgumentBuilder.h"
|
|||
|
|||
#include "storm/exceptions/InvalidArgumentException.h"
|
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
const std::string GridApproximationSettings::moduleName = "grid"; |
|||
|
|||
const std::string refineOption = "refine"; |
|||
const std::string resolutionOption = "resolution"; |
|||
const std::string limitBeliefExplorationOption = "limit-exploration"; |
|||
const std::string numericPrecisionOption = "numeric-precision"; |
|||
|
|||
GridApproximationSettings::GridApproximationSettings() : ModuleSettings(moduleName) { |
|||
|
|||
this->addOption(storm::settings::OptionBuilder(moduleName, refineOption, false,"Enables automatic refinement of the grid until the goal precision is reached").addArgument( |
|||
storm::settings::ArgumentBuilder::createDoubleArgument("precision","Allowed difference between upper and lower bound of the result.").setDefaultValueDouble(1e-6).makeOptional().addValidatorDouble(storm::settings::ArgumentValidatorFactory::createDoubleGreaterEqualValidator(0)).build()).build()); |
|||
|
|||
this->addOption(storm::settings::OptionBuilder(moduleName, resolutionOption, false,"Sets the (initial-) resolution of the grid (higher means more precise results)").addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("value","the resolution").setDefaultValueUnsignedInteger(10).addValidatorUnsignedInteger(storm::settings::ArgumentValidatorFactory::createUnsignedGreaterValidator(0)).build()).build()); |
|||
|
|||
this->addOption(storm::settings::OptionBuilder(moduleName, limitBeliefExplorationOption, false,"Sets whether the belief space exploration is stopped if upper and lower bound are close").addArgument( |
|||
storm::settings::ArgumentBuilder::createDoubleArgument("threshold","the difference between upper and lower bound when to stop").setDefaultValueDouble(0.0).addValidatorDouble(storm::settings::ArgumentValidatorFactory::createDoubleGreaterEqualValidator(0)).build()).build()); |
|||
|
|||
this->addOption(storm::settings::OptionBuilder(moduleName, numericPrecisionOption, false,"Sets the precision used to determine whether two belief-states are equal.").addArgument( |
|||
storm::settings::ArgumentBuilder::createDoubleArgument("value","the precision").setDefaultValueDouble(1e-9).makeOptional().addValidatorDouble(storm::settings::ArgumentValidatorFactory::createDoubleRangeValidatorIncluding(0, 1)).build()).build()); |
|||
|
|||
} |
|||
|
|||
bool GridApproximationSettings::isRefineSet() const { |
|||
return this->getOption(refineOption).getHasOptionBeenSet(); |
|||
} |
|||
|
|||
double GridApproximationSettings::getRefinementPrecision() const { |
|||
return this->getOption(refineOption).getArgumentByName("precision").getValueAsDouble(); |
|||
} |
|||
|
|||
uint64_t GridApproximationSettings::getGridResolution() const { |
|||
return this->getOption(resolutionOption).getArgumentByName("value").getValueAsUnsignedInteger(); |
|||
} |
|||
|
|||
double GridApproximationSettings::getExplorationThreshold() const { |
|||
return this->getOption(limitBeliefExplorationOption).getArgumentByName("threshold").getValueAsDouble(); |
|||
} |
|||
|
|||
bool GridApproximationSettings::isNumericPrecisionSetFromDefault() const { |
|||
return !this->getOption(numericPrecisionOption).getHasOptionBeenSet() || this->getOption(numericPrecisionOption).getArgumentByName("value").wasSetFromDefaultValue(); |
|||
} |
|||
|
|||
double GridApproximationSettings::getNumericPrecision() const { |
|||
return this->getOption(numericPrecisionOption).getArgumentByName("value").getValueAsDouble(); |
|||
} |
|||
|
|||
} // namespace modules
|
|||
} // namespace settings
|
|||
} // namespace storm
|
@ -0,0 +1,40 @@ |
|||
#pragma once |
|||
|
|||
#include "storm-config.h" |
|||
#include "storm/settings/modules/ModuleSettings.h" |
|||
|
|||
namespace storm { |
|||
namespace settings { |
|||
namespace modules { |
|||
|
|||
/*! |
|||
* This class represents the settings for POMDP model checking. |
|||
*/ |
|||
class GridApproximationSettings : public ModuleSettings { |
|||
public: |
|||
|
|||
/*! |
|||
* Creates a new set of POMDP settings. |
|||
*/ |
|||
GridApproximationSettings(); |
|||
|
|||
virtual ~GridApproximationSettings() = default; |
|||
|
|||
bool isRefineSet() const; |
|||
double getRefinementPrecision() const; |
|||
uint64_t getGridResolution() const; |
|||
double getExplorationThreshold() const; |
|||
bool isNumericPrecisionSetFromDefault() const; |
|||
double getNumericPrecision() const; |
|||
|
|||
// The name of the module. |
|||
static const std::string moduleName; |
|||
|
|||
private: |
|||
|
|||
|
|||
}; |
|||
|
|||
} // namespace modules |
|||
} // namespace settings |
|||
} // namespace storm |
Write
Preview
Loading…
Cancel
Save
Reference in new issue