Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
JaniExportSettings.cpp
Go to the documentation of this file.
2
8
9#include <boost/algorithm/string.hpp>
10
11namespace storm {
12namespace settings {
13namespace modules {
14const std::string JaniExportSettings::moduleName = "exportJani";
15
16const std::string JaniExportSettings::edgeAssignmentsOptionName = "edge-assignments";
17const std::string JaniExportSettings::exportFlattenOptionName = "flatten";
18const std::string JaniExportSettings::locationVariablesOptionName = "location-variables";
19const std::string JaniExportSettings::globalVariablesOptionName = "globalvars";
20const std::string JaniExportSettings::localVariablesOptionName = "localvars";
21const std::string JaniExportSettings::compactJsonOptionName = "compactjson";
22const std::string JaniExportSettings::eliminateArraysOptionName = "remove-arrays";
23const std::string JaniExportSettings::eliminateFunctionsOptionName = "remove-functions";
24const std::string JaniExportSettings::replaceUnassignedVariablesWithConstantsOptionName = "replace-unassigned-vars";
25const std::string JaniExportSettings::simplifyCompositionOptionName = "simplify-composition";
26const std::string JaniExportSettings::performLocationElimination = "location-elimination";
27
29 this->addOption(storm::settings::OptionBuilder(moduleName, locationVariablesOptionName, true, "Variables to export in the location")
31 "variables", "A comma separated list of automaton and local variable names seperated by a dot, e.g. A.x,B.y.")
32 .setDefaultValueString("")
33 .build())
34 .build());
35 this->addOption(
37 moduleName, edgeAssignmentsOptionName, false,
38 "If set, the output model can have transient edge assignments. This can simplify the jani model but is not compliant to the jani standard.")
39 .build());
40 this->addOption(storm::settings::OptionBuilder(moduleName, exportFlattenOptionName, false,
41 "Flattens the composition of Automata to obtain an equivalent model that contains exactly one automaton")
42 .build());
43 this->addOption(
44 storm::settings::OptionBuilder(moduleName, globalVariablesOptionName, false,
45 "If set, variables will preferably be made global, e.g., to guarantee the same variable order as in the input file.")
46 .build());
47 this->addOption(storm::settings::OptionBuilder(moduleName, localVariablesOptionName, false, "If set, variables will preferably be made local.").build());
48 this->addOption(storm::settings::OptionBuilder(moduleName, compactJsonOptionName, false,
49 "If set, the size of the resulting jani file will be reduced at the cost of (human-)readability.")
50 .build());
51 this->addOption(storm::settings::OptionBuilder(moduleName, eliminateArraysOptionName, false,
52 "If set, transforms the model such that array variables/expressions are eliminated.")
53 .build());
54 this->addOption(
55 storm::settings::OptionBuilder(moduleName, eliminateFunctionsOptionName, false, "If set, transforms the model such that functions are eliminated.")
56 .build());
57 this->addOption(
59 moduleName, replaceUnassignedVariablesWithConstantsOptionName, false,
60 "If set, local and global variables that are (a) not assigned to some value and (b) have a known initial value are replaced by constants.")
61 .build());
62 this->addOption(
63 storm::settings::OptionBuilder(moduleName, simplifyCompositionOptionName, false, "If set, attempts to simplify the system composition.").build());
64 this->addOption(storm::settings::OptionBuilder(moduleName, performLocationElimination, false,
65 "If set, location elimination will be performed before the model is built.")
66 .setIsAdvanced()
68 "location-heuristic", "If this number of locations is reached, no further unfolding will be performed")
69 .setDefaultValueUnsignedInteger(10)
70 .makeOptional()
71 .build())
73 "edges-heuristic", "Determines how many new edges may be created by a single elimination")
74 .setDefaultValueUnsignedInteger(10000)
75 .makeOptional()
76 .build())
77 .build());
78}
79
81 return this->getOption(edgeAssignmentsOptionName).getHasOptionBeenSet();
82}
83
85 return this->getOption(exportFlattenOptionName).getHasOptionBeenSet();
86}
87
89 return this->getOption(locationVariablesOptionName).getHasOptionBeenSet();
90}
91
92std::vector<std::pair<std::string, std::string>> JaniExportSettings::getLocationVariables() const {
93 std::vector<std::pair<std::string, std::string>> result;
95 std::string argument = this->getOption(locationVariablesOptionName).getArgumentByName("variables").getValueAsString();
96 std::vector<std::string> arguments;
97 boost::split(arguments, argument, boost::is_any_of(","));
98 for (auto const& pair : arguments) {
99 std::vector<std::string> keyvaluepair;
100 boost::split(keyvaluepair, pair, boost::is_any_of("."));
101 STORM_LOG_THROW(keyvaluepair.size() == 2, storm::exceptions::IllegalArgumentException,
102 "Expected a name of the form AUTOMATON.VARIABLE (with no further dots) but got " << pair << ".");
103 result.emplace_back(keyvaluepair.at(0), keyvaluepair.at(1));
104 }
105 }
106 return result;
107}
108
110 return this->getOption(globalVariablesOptionName).getHasOptionBeenSet();
111}
112
114 return this->getOption(localVariablesOptionName).getHasOptionBeenSet();
115}
116
118 return this->getOption(compactJsonOptionName).getHasOptionBeenSet();
119}
120
122 return this->getOption(eliminateArraysOptionName).getHasOptionBeenSet();
123}
124
126 return this->getOption(eliminateFunctionsOptionName).getHasOptionBeenSet();
127}
128
130 return this->getOption(replaceUnassignedVariablesWithConstantsOptionName).getHasOptionBeenSet();
131}
132
134 return this->getOption(simplifyCompositionOptionName).getHasOptionBeenSet();
135}
136
138 return this->getOption(performLocationElimination).getHasOptionBeenSet();
139}
140
142 return this->getOption(performLocationElimination).getArgumentByName("location-heuristic").getValueAsUnsignedInteger();
143}
144
146 return this->getOption(performLocationElimination).getArgumentByName("edges-heuristic").getValueAsUnsignedInteger();
147}
148
150
152 return true;
153}
154} // namespace modules
155} // namespace settings
156} // 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.
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
void finalize() override
Prepares the modules for further usage, should be called at the end of the initialization,...
std::vector< std::pair< std::string, std::string > > getLocationVariables() const
JaniExportSettings()
Creates a new JaniExport setting.
bool check() const override
Checks whether the settings are consistent.
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(cond, exception, message)
Definition macros.h:28