Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
MultiObjectiveSettings.cpp
Go to the documentation of this file.
2
8
9namespace storm {
10namespace settings {
11namespace modules {
12
13const std::string MultiObjectiveSettings::moduleName = "multiobjective";
14const std::string MultiObjectiveSettings::methodOptionName = "method";
15const std::string MultiObjectiveSettings::exportPlotOptionName = "exportplot";
16const std::string MultiObjectiveSettings::precisionOptionName = "precision";
17const std::string MultiObjectiveSettings::maxStepsOptionName = "maxsteps";
18const std::string MultiObjectiveSettings::schedulerRestrictionOptionName = "purescheds";
19const std::string MultiObjectiveSettings::printResultsOptionName = "printres";
20const std::string MultiObjectiveSettings::encodingOptionName = "encoding";
21const std::string MultiObjectiveSettings::lexicographicOptionName = "lex";
22
24 std::vector<std::string> methods = {"pcaa", "constraintbased"};
25 this->addOption(storm::settings::OptionBuilder(moduleName, methodOptionName, true, "The method to be used for multi objective model checking.")
26 .setIsAdvanced()
27 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the method to use.")
30 .build())
31 .build());
32 this->addOption(storm::settings::OptionBuilder(moduleName, exportPlotOptionName, true, "Saves data for plotting of pareto curves and achievable values.")
33 .setIsAdvanced()
35 "directory", "A path to an existing directory in which the results will be saved.")
36 .build())
37 .build());
38 std::vector<std::string> precTypes = {"abs", "reldiff"};
39 this->addOption(
40 storm::settings::OptionBuilder(moduleName, precisionOptionName, true, "The precision used for the approximation of numerical- and pareto queries.")
41 .setIsAdvanced()
42 .addArgument(storm::settings::ArgumentBuilder::createDoubleArgument("value", "The precision.")
45 .build())
46 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("type", "The type of precision.")
48 .makeOptional()
50 .build())
51 .build());
52 this->addOption(storm::settings::OptionBuilder(moduleName, maxStepsOptionName, true,
53 "Aborts the computation after the given number of refinement steps (= computed pareto optimal points).")
54 .setIsAdvanced()
56 "value", "the threshold for the number of refinement steps to be performed.")
57 .build())
58 .build());
59 std::vector<std::string> memoryPatterns = {"positional", "goalmemory", "arbitrary", "counter"};
60 this->addOption(
61 storm::settings::OptionBuilder(moduleName, schedulerRestrictionOptionName, false,
62 "Restricts the class of considered schedulers to non-randomized schedulers with the provided memory pattern.")
63 .setIsAdvanced()
64 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("memorypattern", "The pattern of the memory.")
65 .setDefaultValueString("positional")
67 .makeOptional()
68 .build())
70 "The Number of memory states (only if supported by the pattern).")
72 .makeOptional()
73 .build())
74 .build());
75 this->addOption(
76 storm::settings::OptionBuilder(moduleName, printResultsOptionName, true, "Prints intermediate results of the computation to standard output.")
77 .setIsAdvanced()
78 .build());
79 this->addOption(storm::settings::OptionBuilder(moduleName, encodingOptionName, true, "The preferred for encoding for constraint-based methods.")
80 .setIsAdvanced()
81 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("style", "The main type of encoding.")
84 .build())
85 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("constraints", "type of constraints.")
88 .makeOptional()
89 .build())
90 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("bscc", "bscc encoding.")
93 .makeOptional()
94 .build())
95 .addArgument(storm::settings::ArgumentBuilder::createBooleanArgument("redundant", "enable redundant bscc constraints.")
97 .makeOptional()
98 .build())
99 .build());
100
101 this->addOption(storm::settings::OptionBuilder(moduleName, lexicographicOptionName, false,
102 "If set, lexicographic model checking instead of normal multi objective is performed.")
103 .build());
104}
105
106storm::modelchecker::multiobjective::MultiObjectiveMethod MultiObjectiveSettings::getMultiObjectiveMethod() const {
107 std::string methodAsString = this->getOption(methodOptionName).getArgumentByName("name").getValueAsString();
108 if (methodAsString == "pcaa") {
109 return storm::modelchecker::multiobjective::MultiObjectiveMethod::Pcaa;
110 } else {
111 STORM_LOG_ASSERT(methodAsString == "constraintbased", "Unexpected method name for multi objective model checking method.");
112 return storm::modelchecker::multiobjective::MultiObjectiveMethod::ConstraintBased;
113 }
114}
115
117 return this->getOption(exportPlotOptionName).getHasOptionBeenSet();
118}
119
121 std::string result = this->getOption(exportPlotOptionName).getArgumentByName("directory").getValueAsString();
122 if (result.back() != '/') {
123 result.push_back('/');
124 }
125 return result;
126}
127
129 return this->getOption(precisionOptionName).getArgumentByName("value").getValueAsDouble();
130}
131
133 return this->getOption(precisionOptionName).getArgumentByName("type").getValueAsString() == "reldiff";
134}
135
137 return this->getOption(precisionOptionName).getArgumentByName("type").getValueAsString() == "abs";
138}
139
141 return this->getOption(maxStepsOptionName).getHasOptionBeenSet();
142}
143
145 return this->getOption(maxStepsOptionName).getArgumentByName("value").getValueAsUnsignedInteger();
146}
147
149 return this->getOption(schedulerRestrictionOptionName).getHasOptionBeenSet();
150}
151
155
156 std::string pattern = this->getOption(schedulerRestrictionOptionName).getArgumentByName("memorypattern").getValueAsString();
157 uint64_t states = this->getOption(schedulerRestrictionOptionName).getArgumentByName("memorystates").getValueAsUnsignedInteger();
158 if (pattern == "positional") {
159 result.setPositional();
160 STORM_LOG_THROW(states <= 1, storm::exceptions::IllegalArgumentException,
161 "The number of memory states should not be provided for the given memory pattern.");
162 } else if (pattern == "goalmemory") {
164 STORM_LOG_THROW(states == 0, storm::exceptions::IllegalArgumentException,
165 "The number of memory states should not be provided for the given memory pattern.");
166 } else if (pattern == "arbitrary") {
167 STORM_LOG_THROW(states > 0, storm::exceptions::IllegalArgumentException,
168 "Invalid number of memory states for provided pattern. Please specify a positive number.");
170 result.setMemoryStates(states);
171 } else if (pattern == "counter") {
172 STORM_LOG_THROW(states > 0, storm::exceptions::IllegalArgumentException,
173 "Invalid number of memory states for provided pattern. Please specify a positive number.");
175 result.setMemoryStates(states);
176 } else {
177 STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Invalid memory pattern: " + pattern + ".");
178 }
179 return result;
180}
181
183 return this->getOption(printResultsOptionName).getHasOptionBeenSet();
184}
185
187 return this->getOption(encodingOptionName).getArgumentByName("style").getValueAsString() == "classic";
188}
189
191 return this->getOption(encodingOptionName).getArgumentByName("style").getValueAsString() == "flow";
192}
193
195 return this->getOption(encodingOptionName).getArgumentByName("style").getValueAsString() == "auto";
196}
197
199 return this->getOption(encodingOptionName).getArgumentByName("bscc").getValueAsString() == "flow";
200}
201
203 return this->getOption(encodingOptionName).getArgumentByName("bscc").getValueAsString() == "order";
204}
205
207 return this->getOption(encodingOptionName).getArgumentByName("constraints").getValueAsString() == "bigm";
208}
209
211 return this->getOption(encodingOptionName).getArgumentByName("constraints").getValueAsString() == "indicator";
212}
213
215 return this->getOption(encodingOptionName).getArgumentByName("redundant").getValueAsBoolean();
216}
217
219 return this->getOption(lexicographicOptionName).getHasOptionBeenSet();
220}
221
223 std::shared_ptr<storm::settings::ArgumentValidator<std::string>> validator = ArgumentValidatorFactory::createWritableFileValidator();
224
225 if (isExportPlotSet()) {
226 if (!(validator->isValid(getExportPlotDirectory() + "boundaries.csv") && validator->isValid(getExportPlotDirectory() + "overapproximation.csv") &&
227 validator->isValid(getExportPlotDirectory() + "underapproximation.csv") && validator->isValid(getExportPlotDirectory() + "paretopoints.csv"))) {
228 return false;
229 }
230 }
231
234 }
235
236 return true;
237}
238
239} // namespace modules
240} // namespace settings
241} // 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.
virtual bool getValueAsBoolean() const =0
Retrieves the value of this argument as a boolean.
virtual double getValueAsDouble() const =0
Retrieves the value of this argument as a double.
static ArgumentBuilder createUnsignedIntegerArgument(std::string const &name, std::string const &description)
Creates an unsigned integer argument with the given parameters.
static ArgumentBuilder createDoubleArgument(std::string const &name, std::string const &description)
Creates a double argument with the given parameters.
static ArgumentBuilder createBooleanArgument(std::string const &name, std::string const &description)
Creates a boolean 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 > > createDoubleRangeValidatorExcluding(double lowerBound, double upperBound)
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
static std::shared_ptr< ArgumentValidator< std::string > > createWritableFileValidator()
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.
bool isClassicEncodingSet() const
Retrieves whether the classic encoding for constraint-based methods is to be preferred.
storm::modelchecker::multiobjective::MultiObjectiveMethod getMultiObjectiveMethod() const
Returns the preferred method for multi objective model checking.
bool isPrintResultsSet() const
Retrieves whether output of intermediate results is enabled.
bool isAutoEncodingSet() const
Retrieves whether the encoding for constraint-based methods should be picked automatically.
storm::storage::SchedulerClass getSchedulerRestriction() const
Retrieves the scheduler restriction if it has been set.
bool isRedundantBsccConstraintsSet() const
Retrieves whether redundant BSCC constraints are to be added.
bool getPrecisionAbsolute() const
Retrieves whether the desired precision is considered to be absolute.
bool isBsccDetectionViaFlowConstraintsSet() const
Retrieves whether the encoding for constraint-based methods should use flow constraints for BSCC dete...
bool isMaxStepsSet() const
Retrieves whether or not a threshold for the number of performed refinement steps is given.
bool getPrecisionRelativeToDiff() const
Retrieves whether the desired precision is considered to be relative to the difference between highes...
std::string getExportPlotDirectory() const
The path to a directory in which the plot data should be stored.
virtual bool check() const override
Checks whether the settings are consistent.
MultiObjectiveSettings()
Creates a new set of multi-objective model checking settings.
bool hasSchedulerRestriction() const
Retrieves whether a scheduler restriction has been set.
uint_fast64_t getMaxSteps() const
Retrieves The maximum number of refinement steps that should be performed (if given).
bool isFlowEncodingSet() const
Retrieves whether the flow encoding for constraint-based methods is to be preferred.
bool isBsccDetectionViaOrderConstraintsSet() const
Retrieves whether the encoding for constraint-based methods should use order constraints for BSCC det...
bool isLexicographicModelCheckingSet() const
Retrieves whether lexicographic model checking has been set.
double getPrecision() const
Retrieves the desired precision for quantitative- and pareto queries.
bool isIndicatorConstraintsSet() const
Retrieves whether the encoding for constraint-based methods should use indicator constraints.
bool isBigMConstraintsSet() const
Retrieves whether the encoding for constraint-based methods should use BigM constraints.
bool isExportPlotSet() const
Retrieves whether the data for plotting should be exported.
SchedulerClass & setIsDeterministic(bool value=true)
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
std::vector< std::string > memoryPatterns
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18