Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
POMDPSettings.cpp
Go to the documentation of this file.
2
7
9
10namespace storm {
11namespace settings {
12namespace modules {
13
14const std::string POMDPSettings::moduleName = "pomdp";
15const std::string noCanonicOption = "nocanonic";
16const std::string exportAsParametricModelOption = "parametric-drn";
17const std::string beliefExplorationOption = "belief-exploration";
18const std::vector<std::string> beliefExplorationModes = {"both", "discretize", "unfold"};
19const std::string qualitativeReductionOption = "qualitativereduction";
20const std::string analyzeUniqueObservationsOption = "uniqueobservations";
21const std::string selfloopReductionOption = "selfloopreduction";
22const std::string memoryBoundOption = "memorybound";
23const std::string memoryPatternOption = "memorypattern";
24const std::vector<std::string> memoryPatterns = {"trivial", "fixedcounter", "selectivecounter", "ring", "fixedring", "settablebits", "full"};
25const std::string checkFullyObservableOption = "check-fully-observable";
26const std::string isQualitativeOption = "qualitative-analysis";
27
30 "If this is set, actions will not be ordered canonically. Could yield incorrect results.")
31 .build());
32 this->addOption(
33 storm::settings::OptionBuilder(moduleName, exportAsParametricModelOption, false, "Export the parametric file.")
34 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file to which to write the model.").build())
35 .build());
37 "Reduces the model size by performing qualitative analysis (E.g. merge states with prob. 1.")
38 .build());
39 this->addOption(
40 storm::settings::OptionBuilder(moduleName, analyzeUniqueObservationsOption, false, "Computes the states with a unique observation").build());
41 this->addOption(storm::settings::OptionBuilder(moduleName, selfloopReductionOption, false, "Reduces the model size by removing self loop actions").build());
43 "Sets the maximal number of allowed memory states (1 means memoryless schedulers).")
44 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("bound", "The maximal number of memory states.")
45 .setDefaultValueUnsignedInteger(1)
47 .build())
48 .build());
49 this->addOption(storm::settings::OptionBuilder(moduleName, memoryPatternOption, false, "Sets the pattern of the considered memory structure")
50 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "Pattern name.")
52 .setDefaultValueString("full")
53 .build())
54 .build());
55 this->addOption(
56 storm::settings::OptionBuilder(moduleName, beliefExplorationOption, false, "Analyze the POMDP by exploring the belief state-space.")
57 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "Sets whether lower, upper, or interval result bounds are computed.")
59 .setDefaultValueString("both")
60 .makeOptional()
61 .build())
62 .build());
63 this->addOption(
64 storm::settings::OptionBuilder(moduleName, checkFullyObservableOption, false, "Performs standard model checking on the underlying MDP").build());
65 this->addOption(storm::settings::OptionBuilder(moduleName, isQualitativeOption, false, "Sets the option qualitative analysis").build());
66}
67
69 return this->getOption(noCanonicOption).getHasOptionBeenSet();
70}
71
73 return this->getOption(exportAsParametricModelOption).getHasOptionBeenSet();
74}
75
77 return this->getOption(exportAsParametricModelOption).getArgumentByName("filename").getValueAsString();
78}
79
81 return this->getOption(qualitativeReductionOption).getHasOptionBeenSet();
82}
83
85 return this->getOption(analyzeUniqueObservationsOption).getHasOptionBeenSet();
86}
87
89 return this->getOption(selfloopReductionOption).getHasOptionBeenSet();
90}
91
93 return this->getOption(beliefExplorationOption).getHasOptionBeenSet();
94}
95
97 std::string arg = this->getOption(beliefExplorationOption).getArgumentByName("mode").getValueAsString();
98 return isBeliefExplorationSet() && (arg == "discretize" || arg == "both");
99}
100
102 std::string arg = this->getOption(beliefExplorationOption).getArgumentByName("mode").getValueAsString();
103 return isBeliefExplorationSet() && (arg == "unfold" || arg == "both");
104}
105
107 return this->getOption(checkFullyObservableOption).getHasOptionBeenSet();
108}
109
111 return this->getOption(isQualitativeOption).getHasOptionBeenSet();
112}
113
115 return this->getOption(memoryBoundOption).getArgumentByName("bound").getValueAsUnsignedInteger();
116}
117
119 auto pattern = this->getOption(memoryPatternOption).getArgumentByName("name").getValueAsString();
120 if (pattern == "trivial") {
122 } else if (pattern == "fixedcounter") {
124 } else if (pattern == "selectivecounter") {
126 } else if (pattern == "ring") {
128 } else if (pattern == "fixedring") {
130 } else if (pattern == "settablebits") {
132 } else if (pattern == "full") {
134 }
135 STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "The name of the memory pattern is unknown.");
136}
137
139
141 STORM_LOG_THROW(getMemoryPattern() != storm::storage::PomdpMemoryPattern::Trivial || getMemoryBound() == 1, storm::exceptions::InvalidArgumentException,
142 "Memory bound greater one is not possible with the trivial memory pattern.");
143 return true;
144}
145
146} // namespace modules
147} // namespace settings
148} // 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.
static ArgumentBuilder createUnsignedIntegerArgument(std::string const &name, std::string const &description)
Creates an unsigned integer 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< uint64_t > > createUnsignedGreaterValidator(uint64_t lowerBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
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
ModuleSettings(std::string const &moduleName)
Constructs a new settings object.
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.
void finalize() override
Prepares the modules for further usage, should be called at the end of the initialization,...
POMDPSettings()
Creates a new set of POMDP settings.
bool check() const override
Checks whether the settings are consistent.
std::string getExportToParametricFilename() const
storm::storage::PomdpMemoryPattern getMemoryPattern() const
static const std::string moduleName
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
const std::string memoryPatternOption
const std::string beliefExplorationOption
const std::string isQualitativeOption
const std::string analyzeUniqueObservationsOption
const std::string memoryBoundOption
const std::string noCanonicOption
const std::string checkFullyObservableOption
const std::string exportAsParametricModelOption
const std::vector< std::string > beliefExplorationModes
const std::string selfloopReductionOption
const std::string qualitativeReductionOption
const std::vector< std::string > memoryPatterns