Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
POMDPSettings.cpp
Go to the documentation of this file.
2
8
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string POMDPSettings::moduleName = "pomdp";
16const std::string noCanonicOption = "nocanonic";
17const std::string exportAsParametricModelOption = "parametric-drn";
18const std::string beliefExplorationOption = "belief-exploration";
19std::vector<std::string> beliefExplorationModes = {"both", "discretize", "unfold"};
20const std::string qualitativeReductionOption = "qualitativereduction";
21const std::string analyzeUniqueObservationsOption = "uniqueobservations";
22const std::string selfloopReductionOption = "selfloopreduction";
23const std::string memoryBoundOption = "memorybound";
24const std::string memoryPatternOption = "memorypattern";
25std::vector<std::string> memoryPatterns = {"trivial", "fixedcounter", "selectivecounter", "ring", "fixedring", "settablebits", "full"};
26const std::string checkFullyObservableOption = "check-fully-observable";
27const std::string isQualitativeOption = "qualitative-analysis";
28
31 "If this is set, actions will not be ordered canonically. Could yield incorrect results.")
32 .build());
33 this->addOption(
34 storm::settings::OptionBuilder(moduleName, exportAsParametricModelOption, false, "Export the parametric file.")
35 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The name of the file to which to write the model.").build())
36 .build());
38 "Reduces the model size by performing qualitative analysis (E.g. merge states with prob. 1.")
39 .build());
40 this->addOption(
41 storm::settings::OptionBuilder(moduleName, analyzeUniqueObservationsOption, false, "Computes the states with a unique observation").build());
42 this->addOption(storm::settings::OptionBuilder(moduleName, selfloopReductionOption, false, "Reduces the model size by removing self loop actions").build());
44 "Sets the maximal number of allowed memory states (1 means memoryless schedulers).")
45 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("bound", "The maximal number of memory states.")
48 .build())
49 .build());
50 this->addOption(storm::settings::OptionBuilder(moduleName, memoryPatternOption, false, "Sets the pattern of the considered memory structure")
51 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "Pattern name.")
54 .build())
55 .build());
56 this->addOption(
57 storm::settings::OptionBuilder(moduleName, beliefExplorationOption, false, "Analyze the POMDP by exploring the belief state-space.")
58 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "Sets whether lower, upper, or interval result bounds are computed.")
61 .makeOptional()
62 .build())
63 .build());
64 this->addOption(
65 storm::settings::OptionBuilder(moduleName, checkFullyObservableOption, false, "Performs standard model checking on the underlying MDP").build());
66 this->addOption(storm::settings::OptionBuilder(moduleName, isQualitativeOption, false, "Sets the option qualitative analysis").build());
67}
68
70 return this->getOption(noCanonicOption).getHasOptionBeenSet();
71}
72
74 return this->getOption(exportAsParametricModelOption).getHasOptionBeenSet();
75}
76
78 return this->getOption(exportAsParametricModelOption).getArgumentByName("filename").getValueAsString();
79}
80
82 return this->getOption(qualitativeReductionOption).getHasOptionBeenSet();
83}
84
86 return this->getOption(analyzeUniqueObservationsOption).getHasOptionBeenSet();
87}
88
90 return this->getOption(selfloopReductionOption).getHasOptionBeenSet();
91}
92
94 return this->getOption(beliefExplorationOption).getHasOptionBeenSet();
95}
96
98 std::string arg = this->getOption(beliefExplorationOption).getArgumentByName("mode").getValueAsString();
99 return isBeliefExplorationSet() && (arg == "discretize" || arg == "both");
100}
101
103 std::string arg = this->getOption(beliefExplorationOption).getArgumentByName("mode").getValueAsString();
104 return isBeliefExplorationSet() && (arg == "unfold" || arg == "both");
105}
106
108 return this->getOption(checkFullyObservableOption).getHasOptionBeenSet();
109}
110
112 return this->getOption(isQualitativeOption).getHasOptionBeenSet();
113}
114
116 return this->getOption(memoryBoundOption).getArgumentByName("bound").getValueAsUnsignedInteger();
117}
118
120 auto pattern = this->getOption(memoryPatternOption).getArgumentByName("name").getValueAsString();
121 if (pattern == "trivial") {
123 } else if (pattern == "fixedcounter") {
125 } else if (pattern == "selectivecounter") {
127 } else if (pattern == "ring") {
129 } else if (pattern == "fixedring") {
131 } else if (pattern == "settablebits") {
133 } else if (pattern == "full") {
135 }
136 STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "The name of the memory pattern is unknown.");
137}
138
140
142 STORM_LOG_THROW(getMemoryPattern() != storm::storage::PomdpMemoryPattern::Trivial || getMemoryBound() == 1, storm::exceptions::InvalidArgumentException,
143 "Memory bound greater one is not possible with the trivial memory pattern.");
144 return true;
145}
146
147} // namespace modules
148} // namespace settings
149} // 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
This is the base class of the settings for a particular module.
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:30
const std::string memoryPatternOption
const std::string beliefExplorationOption
const std::string isQualitativeOption
const std::string analyzeUniqueObservationsOption
const std::string memoryBoundOption
std::vector< std::string > memoryPatterns
const std::string noCanonicOption
const std::string checkFullyObservableOption
const std::string exportAsParametricModelOption
std::vector< std::string > beliefExplorationModes
const std::string selfloopReductionOption
const std::string qualitativeReductionOption
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18