Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
JaniExportSettings.cpp
Go to the documentation of this file.
2
9
10#include <boost/algorithm/string.hpp>
11
12namespace storm {
13namespace settings {
14namespace modules {
15const std::string JaniExportSettings::moduleName = "exportJani";
16
17const std::string JaniExportSettings::edgeAssignmentsOptionName = "edge-assignments";
18const std::string JaniExportSettings::exportFlattenOptionName = "flatten";
19const std::string JaniExportSettings::locationVariablesOptionName = "location-variables";
20const std::string JaniExportSettings::globalVariablesOptionName = "globalvars";
21const std::string JaniExportSettings::localVariablesOptionName = "localvars";
22const std::string JaniExportSettings::compactJsonOptionName = "compactjson";
23const std::string JaniExportSettings::eliminateArraysOptionName = "remove-arrays";
24const std::string JaniExportSettings::eliminateFunctionsOptionName = "remove-functions";
25const std::string JaniExportSettings::replaceUnassignedVariablesWithConstantsOptionName = "replace-unassigned-vars";
26const std::string JaniExportSettings::simplifyCompositionOptionName = "simplify-composition";
27const std::string JaniExportSettings::performLocationElimination = "location-elimination";
28
30 this->addOption(storm::settings::OptionBuilder(moduleName, locationVariablesOptionName, true, "Variables to export in the location")
32 "variables", "A comma separated list of automaton and local variable names seperated by a dot, e.g. A.x,B.y.")
34 .build())
35 .build());
36 this->addOption(
38 moduleName, edgeAssignmentsOptionName, false,
39 "If set, the output model can have transient edge assignments. This can simplify the jani model but is not compliant to the jani standard.")
40 .build());
41 this->addOption(storm::settings::OptionBuilder(moduleName, exportFlattenOptionName, false,
42 "Flattens the composition of Automata to obtain an equivalent model that contains exactly one automaton")
43 .build());
44 this->addOption(
45 storm::settings::OptionBuilder(moduleName, globalVariablesOptionName, false,
46 "If set, variables will preferably be made global, e.g., to guarantee the same variable order as in the input file.")
47 .build());
48 this->addOption(storm::settings::OptionBuilder(moduleName, localVariablesOptionName, false, "If set, variables will preferably be made local.").build());
49 this->addOption(storm::settings::OptionBuilder(moduleName, compactJsonOptionName, false,
50 "If set, the size of the resulting jani file will be reduced at the cost of (human-)readability.")
51 .build());
52 this->addOption(storm::settings::OptionBuilder(moduleName, eliminateArraysOptionName, false,
53 "If set, transforms the model such that array variables/expressions are eliminated.")
54 .build());
55 this->addOption(
56 storm::settings::OptionBuilder(moduleName, eliminateFunctionsOptionName, false, "If set, transforms the model such that functions are eliminated.")
57 .build());
58 this->addOption(
60 moduleName, replaceUnassignedVariablesWithConstantsOptionName, false,
61 "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.")
62 .build());
63 this->addOption(
64 storm::settings::OptionBuilder(moduleName, simplifyCompositionOptionName, false, "If set, attempts to simplify the system composition.").build());
65 this->addOption(storm::settings::OptionBuilder(moduleName, performLocationElimination, false,
66 "If set, location elimination will be performed before the model is built.")
67 .setIsAdvanced()
69 "location-heuristic", "If this number of locations is reached, no further unfolding will be performed")
71 .makeOptional()
72 .build())
74 "edges-heuristic", "Determines how many new edges may be created by a single elimination")
76 .makeOptional()
77 .build())
78 .build());
79}
80
82 return this->getOption(edgeAssignmentsOptionName).getHasOptionBeenSet();
83}
84
86 return this->getOption(exportFlattenOptionName).getHasOptionBeenSet();
87}
88
90 return this->getOption(locationVariablesOptionName).getHasOptionBeenSet();
91}
92
93std::vector<std::pair<std::string, std::string>> JaniExportSettings::getLocationVariables() const {
94 std::vector<std::pair<std::string, std::string>> result;
96 std::string argument = this->getOption(locationVariablesOptionName).getArgumentByName("variables").getValueAsString();
97 std::vector<std::string> arguments;
98 boost::split(arguments, argument, boost::is_any_of(","));
99 for (auto const& pair : arguments) {
100 std::vector<std::string> keyvaluepair;
101 boost::split(keyvaluepair, pair, boost::is_any_of("."));
102 STORM_LOG_THROW(keyvaluepair.size() == 2, storm::exceptions::IllegalArgumentException,
103 "Expected a name of the form AUTOMATON.VARIABLE (with no further dots) but got " << pair);
104 result.emplace_back(keyvaluepair.at(0), keyvaluepair.at(1));
105 }
106 }
107 return result;
108}
109
111 return this->getOption(globalVariablesOptionName).getHasOptionBeenSet();
112}
113
115 return this->getOption(localVariablesOptionName).getHasOptionBeenSet();
116}
117
119 return this->getOption(compactJsonOptionName).getHasOptionBeenSet();
120}
121
123 return this->getOption(eliminateArraysOptionName).getHasOptionBeenSet();
124}
125
127 return this->getOption(eliminateFunctionsOptionName).getHasOptionBeenSet();
128}
129
131 return this->getOption(replaceUnassignedVariablesWithConstantsOptionName).getHasOptionBeenSet();
132}
133
135 return this->getOption(simplifyCompositionOptionName).getHasOptionBeenSet();
136}
137
139 return this->getOption(performLocationElimination).getHasOptionBeenSet();
140}
141
143 return this->getOption(performLocationElimination).getArgumentByName("location-heuristic").getValueAsUnsignedInteger();
144}
145
147 return this->getOption(performLocationElimination).getArgumentByName("edges-heuristic").getValueAsUnsignedInteger();
148}
149
151
153 return true;
154}
155} // namespace modules
156} // namespace settings
157} // 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.
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.
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18