Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BisimulationSettings.cpp
Go to the documentation of this file.
8
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string BisimulationSettings::moduleName = "bisimulation";
16const std::string BisimulationSettings::typeOptionName = "type";
17const std::string BisimulationSettings::representativeOptionName = "repr";
18const std::string BisimulationSettings::originalVariablesOptionName = "origvars";
19const std::string BisimulationSettings::quotientFormatOptionName = "quot";
20const std::string BisimulationSettings::signatureModeOptionName = "sigmode";
21const std::string BisimulationSettings::reuseOptionName = "reuse";
22const std::string BisimulationSettings::initialPartitionOptionName = "init";
23const std::string BisimulationSettings::refinementModeOptionName = "refine";
24const std::string BisimulationSettings::exactArithmeticDdOptionName = "ddexact";
25const std::string BisimulationSettings::toleranceOptionName = "tolerance";
26const std::string BisimulationSettings::actionSensitiveOptionName = "action-sensitive";
27
29 std::vector<std::string> types = {"strong", "weak"};
30 this->addOption(storm::settings::OptionBuilder(moduleName, typeOptionName, true, "Sets the kind of bisimulation quotienting used.")
31 .setIsAdvanced()
32 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the type to use.")
34 .setDefaultValueString("strong")
35 .build())
36 .build());
37
38 std::vector<std::string> quotTypes = {"sparse", "dd"};
39 this->addOption(storm::settings::OptionBuilder(moduleName, quotientFormatOptionName, true,
40 "Sets the format in which the quotient is extracted (only applies to DD-based bisimulation).")
41 .setIsAdvanced()
42 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("format", "The format of the quotient.")
44 .setDefaultValueString("dd")
45 .build())
46 .build());
47
48 this->addOption(storm::settings::OptionBuilder(moduleName, representativeOptionName, false,
49 "Sets whether to use representatives in the quotient rather than block numbers.")
50 .setIsAdvanced()
51 .build());
52 this->addOption(storm::settings::OptionBuilder(moduleName, originalVariablesOptionName, false,
53 "Sets whether to use the original variables in the quotient rather than the block variables.")
54 .setIsAdvanced()
55 .build());
56 this->addOption(
57 storm::settings::OptionBuilder(moduleName, exactArithmeticDdOptionName, false, "Sets whether to use exact arithmetic in dd-based bisimulation.")
58 .setIsAdvanced()
59 .build());
60
61 std::vector<std::string> signatureModes = {"eager", "lazy"};
62 this->addOption(storm::settings::OptionBuilder(moduleName, signatureModeOptionName, false, "Sets the signature computation mode.")
63 .setIsAdvanced()
64 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
65 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(signatureModes))
66 .setDefaultValueString("eager")
67 .build())
68 .build());
69
70 std::vector<std::string> reuseModes = {"none", "blocks"};
71 this->addOption(storm::settings::OptionBuilder(moduleName, reuseOptionName, true, "Sets whether to reuse all results.")
72 .setIsAdvanced()
73 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
74 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(reuseModes))
75 .setDefaultValueString("blocks")
76 .build())
77 .build());
78
79 std::vector<std::string> initialPartitionModes = {"regular", "finer"};
80 this->addOption(storm::settings::OptionBuilder(moduleName, initialPartitionOptionName, true, "Sets which initial partition mode to use.")
81 .setIsAdvanced()
82 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
83 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(initialPartitionModes))
84 .setDefaultValueString("finer")
85 .build())
86 .build());
87
88 std::vector<std::string> refinementModes = {"full", "changed"};
89 this->addOption(storm::settings::OptionBuilder(moduleName, refinementModeOptionName, true, "Sets which refinement mode to use.")
90 .setIsAdvanced()
91 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("mode", "The mode to use.")
92 .addValidatorString(ArgumentValidatorFactory::createMultipleChoiceValidator(refinementModes))
93 .setDefaultValueString("full")
94 .build())
95 .build());
96
97 this->addOption(storm::settings::OptionBuilder(moduleName, toleranceOptionName, true,
98 "Sets the tolerance to use for bisimulation minimization (only for sparse bisimulation).")
99 .setIsAdvanced()
100 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The tolerance. Defaults to 0 in exact mode.")
101 .setDefaultValueDouble(1e-9)
103 .build())
104 .build());
105
106 this->addOption(
107 storm::settings::OptionBuilder(moduleName, actionSensitiveOptionName, true,
108 "Sets whether choices are only lumped together if they belong to the same state-local action index (only for "
109 "sparse bisimulation).")
110 .setIsAdvanced()
111 .build());
112}
113
115 if (this->getOption(typeOptionName).getArgumentByName("name").getValueAsString() == "strong") {
116 return true;
117 }
118 return false;
119}
120
122 if (this->getOption(typeOptionName).getArgumentByName("name").getValueAsString() == "weak") {
123 return true;
124 }
125 return false;
126}
127
129 return !this->getOption(quotientFormatOptionName).getHasOptionBeenSet() ||
130 this->getOption(quotientFormatOptionName).getArgumentByName("format").wasSetFromDefaultValue();
131}
132
134 std::string quotientFormatAsString = this->getOption(quotientFormatOptionName).getArgumentByName("format").getValueAsString();
135 if (quotientFormatAsString == "sparse") {
137 }
138 STORM_LOG_ASSERT(quotientFormatAsString == "dd", "Invalid bisimulation quotient format: " << quotientFormatAsString << ".");
140}
141
143 return this->getOption(representativeOptionName).getHasOptionBeenSet();
144}
145
147 return this->getOption(originalVariablesOptionName).getHasOptionBeenSet();
148}
149
151 return this->getOption(exactArithmeticDdOptionName).getHasOptionBeenSet();
152}
153
155 std::string modeAsString = this->getOption(signatureModeOptionName).getArgumentByName("mode").getValueAsString();
156 if (modeAsString == "eager") {
158 } else if (modeAsString == "lazy") {
160 }
161 STORM_LOG_THROW_UNCONDITIONALLY(storm::exceptions::InvalidSettingsException, "Unknown signature mode '" << modeAsString << ".");
162}
163
165 std::string reuseModeAsString = this->getOption(reuseOptionName).getArgumentByName("mode").getValueAsString();
166 if (reuseModeAsString == "none") {
168 } else if (reuseModeAsString == "blocks") {
170 }
172}
173
175 std::string initialPartitionModeAsString = this->getOption(initialPartitionOptionName).getArgumentByName("mode").getValueAsString();
176 if (initialPartitionModeAsString == "regular") {
178 } else if (initialPartitionModeAsString == "finer") {
180 }
182}
183
185 std::string refinementModeAsString = this->getOption(refinementModeOptionName).getArgumentByName("mode").getValueAsString();
186 if (refinementModeAsString == "full") {
188 } else if (refinementModeAsString == "changed") {
190 }
192}
193
195 return this->getOption(toleranceOptionName).getHasOptionBeenSet();
196}
197
199 return this->getOption(toleranceOptionName).getArgumentByName("value").getValueAsDouble();
200}
201
203 return this->getOption(actionSensitiveOptionName).getHasOptionBeenSet();
204}
205
207 bool optionsSet = this->getOption(typeOptionName).getHasOptionBeenSet();
209 "Bisimulation minimization is not selected, so setting options for bisimulation has no effect.");
210 return true;
211}
212} // namespace modules
213} // namespace settings
214} // namespace storm
virtual std::string getValueAsString() const =0
Retrieves the value of this argument as a string.
virtual double getValueAsDouble() const =0
Retrieves the value of this argument as a double.
virtual bool wasSetFromDefaultValue() const =0
static ArgumentBuilder createDoubleArgument(std::string const &name, std::string const &description)
Creates a double 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< double > > createDoubleGreaterEqualValidator(double 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
virtual bool check() const override
Checks whether the settings are consistent.
storm::dd::bisimulation::ReuseMode getReuseMode() const
Retrieves the selected reuse mode.
bool isActionSensitiveSet() const
Retrieves whether action-sensitive bisimulation is to be used, i.e., choices are only lumped together...
storm::dd::bisimulation::QuotientFormat getQuotientFormat() const
Retrieves the format in which the quotient is to be extracted.
storm::dd::bisimulation::SignatureMode getSignatureMode() const
Retrieves the mode to compute signatures.
double getTolerance() const
Retrieves the tolerance to use for bisimulation minimization.
bool isUseOriginalVariablesSet() const
Retrieves whether the extracted quotient model is supposed to use the same variables as the original ...
BisimulationSettings()
Creates a new set of bisimulation settings.
storm::dd::bisimulation::InitialPartitionMode getInitialPartitionMode() const
Retrieves the initial partition mode.
bool isQuotientFormatSetFromDefaultValue() const
Retrieves whether the format in which the quotient is to be extracted has been set from its default v...
bool isUseRepresentativesSet() const
Retrieves whether representatives for blocks are to be used instead of the block numbers.
bool useExactArithmeticInDdBisimulation() const
Retrieves whether exact arithmetic is to be used in symbolic bisimulation minimization.
bool isStrongBisimulationSet() const
Retrieves whether strong bisimulation is to be used.
storm::dd::bisimulation::RefinementMode getRefinementMode() const
Retrieves the refinement mode to use.
bool isWeakBisimulationSet() const
Retrieves whether weak bisimulation is to be used.
bool isToleranceSet() const
Retrieves whether the tolerance to use for (approximate) bisimulation minimization has been set expli...
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.
#define STORM_LOG_THROW_UNCONDITIONALLY(exception, message)
Definition macros.h:48
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:54
SettingsType const & getModule()
Get module.