Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/examples/testfiles/pomdp/simple.prism
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module main
[alpha] s>0 & s<5 -> (1-slippery): (s'=s+2) + slippery: true;
[beta] s=3 -> (1-slippery): (s'=6) + slippery: true;
[beta] s=4 -> (1-slippery): (s'=5) + slippery: true;
[alpha] s=5 | s=6 -> 1: true;
endmodule

rewards
Expand Down
254 changes: 40 additions & 214 deletions src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.cpp

Large diffs are not rendered by default.

52 changes: 7 additions & 45 deletions src/storm-pomdp-cli/settings/modules/BeliefExplorationSettings.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
#pragma once

#include "storm-config.h"
#include "storm/settings/modules/ModuleSettings.h"

namespace storm {
namespace builder {
template<typename PomdpType, typename BeliefValueType>
class BeliefMdpExplorer;
}
namespace pomdp {
namespace modelchecker {
template<typename ValueType>
struct BeliefExplorationPomdpModelCheckerOptions;
}

enum BeliefNumberType { Default, Float, Rational };
} // namespace pomdp

namespace settings {
namespace modules {
namespace storm::settings::modules {

/*!
* This class represents the settings for POMDP model checking.
Expand All @@ -33,56 +17,34 @@ class BeliefExplorationSettings : public ModuleSettings {
virtual ~BeliefExplorationSettings() = default;

bool isCutZeroGapSet() const;
bool isRefineSet() const;
double getRefinePrecision() const;
uint64_t getRefineStepLimit() const;

uint64_t getExplorationTimeLimit() const;

/// Discretization Resolution
uint64_t getResolutionInit() const;
double getResolutionFactor() const;

/// Clipping Grid Resolution
uint64_t getClippingGridResolution() const;

/// The maximal number of newly expanded MDP states in a refinement step
uint64_t getSizeThresholdInit() const;
double getSizeThresholdFactor() const;

/// Controls how large the gap between known lower- and upper bounds at a beliefstate needs to be in order to explore
double getGapThresholdInit() const;
double getGapThresholdFactor() const;

/// Controls whether "almost optimal" choices will be considered optimal
double getOptimalChoiceValueThresholdInit() const;
double getOptimalChoiceValueThresholdFactor() const;

/// Controls which observations are refined.
double getObservationScoreThresholdInit() const;
double getObservationScoreThresholdFactor() const;

/// Used to determine whether two beliefs are equal
bool isNumericPrecisionSetFromDefault() const;
double getNumericPrecision() const;

bool isDynamicTriangulationModeSet() const;
bool isStaticTriangulationModeSet() const;

/// Controls if (grid) clipping is to be used
/// Controls if grid clipping is to be used
bool isUseClippingSet() const;

bool isStateEliminationCutoffSet() const;
bool isBeliefMDPNumberTypeDouble() const;
bool isBeliefMDPNumberTypeRational() const;
bool isBeliefMDPNumberTypeMatch() const;

template<typename ValueType>
void setValuesInOptionsStruct(storm::pomdp::modelchecker::BeliefExplorationPomdpModelCheckerOptions<ValueType>& options) const;
bool isInexactPreprocessingSet() const;

// The name of the module.
static const std::string moduleName;

private:
};

} // namespace modules
} // namespace settings
} // namespace storm
} // namespace storm::settings::modules
48 changes: 40 additions & 8 deletions src/storm-pomdp-cli/settings/modules/POMDPSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const std::string memoryPatternOption = "memorypattern";
const std::vector<std::string> memoryPatterns = {"trivial", "fixedcounter", "selectivecounter", "ring", "fixedring", "settablebits", "full"};
const std::string checkFullyObservableOption = "check-fully-observable";
const std::string isQualitativeOption = "qualitative-analysis";
const std::string isBoundedToUnboundedReachabilityTransformationOption = "unfold-reward-bound";
const std::string isRewardObservableOption = "reward-aware";

POMDPSettings::POMDPSettings() : ModuleSettings(moduleName) {
this->addOption(storm::settings::OptionBuilder(moduleName, noCanonicOption, false,
Expand Down Expand Up @@ -52,17 +54,28 @@ POMDPSettings::POMDPSettings() : ModuleSettings(moduleName) {
.setDefaultValueString("full")
.build())
.build());
this->addOption(
storm::settings::OptionBuilder(moduleName, beliefExplorationOption, false, "Analyze the POMDP by exploring the belief state-space.")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "Sets whether lower, upper, or interval result bounds are computed.")
.addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(beliefExplorationModes))
.setDefaultValueString("both")
.makeOptional()
.build())
.build());
this->addOption(storm::settings::OptionBuilder(moduleName, beliefExplorationOption, false, "Analyze the POMDP by exploring the belief space.")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument(
"mode", "Sets whether lower bounds, upper bounds, or interval bounds are computed.")
.addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(beliefExplorationModes))
.setDefaultValueString("both")
.makeOptional()
.build())
.build());
this->addOption(
storm::settings::OptionBuilder(moduleName, checkFullyObservableOption, false, "Performs standard model checking on the underlying MDP").build());
this->addOption(storm::settings::OptionBuilder(moduleName, isQualitativeOption, false, "Sets the option qualitative analysis").build());
this->addOption(storm::settings::OptionBuilder(
moduleName, isBoundedToUnboundedReachabilityTransformationOption, false,
"Sets the option that reward bounded reachability properties are transformed to an unbounded problem on an unfolded POMDP.")
.build());
this->addOption(storm::settings::OptionBuilder(moduleName, isRewardObservableOption, false,
"Sets the option that rewards are observable for bounded reachability properties.")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("levelwidths", "comma separated list of width of reward levels.")
.setDefaultValueString("")
.makeOptional()
.build())
.build());
}

bool POMDPSettings::isNoCanonicSet() const {
Expand Down Expand Up @@ -111,6 +124,25 @@ bool POMDPSettings::isQualitativeAnalysisSet() const {
return this->getOption(isQualitativeOption).getHasOptionBeenSet();
}

bool POMDPSettings::isBoundedToUnboundedReachabilityTransformationSet() const {
return this->getOption(isBoundedToUnboundedReachabilityTransformationOption).getHasOptionBeenSet();
}

bool POMDPSettings::isRewardObservableSet() const {
return this->getOption(isRewardObservableOption).getHasOptionBeenSet();
}

std::vector<uint64_t> POMDPSettings::getLevelWidthForBoundedReachability() const {
auto const input = this->getOption(isRewardObservableOption).getArgumentByName("levelwidths").getValueAsString();
if (input.empty()) {
return {};
}
// split the string by comma
auto result = input | std::ranges::views::split(',') |
std::ranges::views::transform([](auto&& r) -> uint64_t { return std::stoull(std::string(r.begin(), r.end())); });
return {result.begin(), result.end()};
}

uint64_t POMDPSettings::getMemoryBound() const {
return this->getOption(memoryBoundOption).getArgumentByName("bound").getValueAsUnsignedInteger();
}
Expand Down
3 changes: 3 additions & 0 deletions src/storm-pomdp-cli/settings/modules/POMDPSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class POMDPSettings : public ModuleSettings {
bool isSelfloopReductionSet() const;
bool isCheckFullyObservableSet() const;
bool isQualitativeAnalysisSet() const;
bool isBoundedToUnboundedReachabilityTransformationSet() const;
std::vector<uint64_t> getLevelWidthForBoundedReachability() const;
bool isRewardObservableSet() const;
uint64_t getMemoryBound() const;

storm::storage::PomdpMemoryPattern getMemoryPattern() const;
Expand Down
Loading
Loading