Storm 1.14.0.1
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 {
15
16namespace {
17// The defaults of the options are taken from the library's default-constructed options.
18storm::converter::JaniConversionOptions const defaultOptions;
19} // namespace
20
21const std::string JaniExportSettings::moduleName = "exportJani";
22
23const std::string JaniExportSettings::edgeAssignmentsOptionName = "edge-assignments";
24const std::string JaniExportSettings::exportFlattenOptionName = "flatten";
25const std::string JaniExportSettings::locationVariablesOptionName = "location-variables";
26const std::string JaniExportSettings::globalVariablesOptionName = "globalvars";
27const std::string JaniExportSettings::localVariablesOptionName = "localvars";
28const std::string JaniExportSettings::compactJsonOptionName = "compactjson";
29const std::string JaniExportSettings::eliminateArraysOptionName = "remove-arrays";
30const std::string JaniExportSettings::eliminateFunctionsOptionName = "remove-functions";
31const std::string JaniExportSettings::replaceUnassignedVariablesWithConstantsOptionName = "replace-unassigned-vars";
32const std::string JaniExportSettings::simplifyCompositionOptionName = "simplify-composition";
33const std::string JaniExportSettings::performLocationElimination = "location-elimination";
34
36 this->addOption(storm::settings::OptionBuilder(moduleName, locationVariablesOptionName, true, "Variables to export in the location")
38 "variables", "A comma separated list of automaton and local variable names seperated by a dot, e.g. A.x,B.y.")
39 .setDefaultValueString("")
40 .build())
41 .build());
42 this->addOption(
44 moduleName, edgeAssignmentsOptionName, false,
45 "If set, the output model can have transient edge assignments. This can simplify the jani model but is not compliant to the jani standard.")
46 .build());
47 this->addOption(storm::settings::OptionBuilder(moduleName, exportFlattenOptionName, false,
48 "Flattens the composition of Automata to obtain an equivalent model that contains exactly one automaton")
49 .build());
50 this->addOption(
51 storm::settings::OptionBuilder(moduleName, globalVariablesOptionName, false,
52 "If set, variables will preferably be made global, e.g., to guarantee the same variable order as in the input file.")
53 .build());
54 this->addOption(storm::settings::OptionBuilder(moduleName, localVariablesOptionName, false, "If set, variables will preferably be made local.").build());
55 this->addOption(storm::settings::OptionBuilder(moduleName, compactJsonOptionName, false,
56 "If set, the size of the resulting jani file will be reduced at the cost of (human-)readability.")
57 .build());
58 this->addOption(storm::settings::OptionBuilder(moduleName, eliminateArraysOptionName, false,
59 "If set, transforms the model such that array variables/expressions are eliminated.")
60 .build());
61 this->addOption(
62 storm::settings::OptionBuilder(moduleName, eliminateFunctionsOptionName, false, "If set, transforms the model such that functions are eliminated.")
63 .build());
64 this->addOption(
66 moduleName, replaceUnassignedVariablesWithConstantsOptionName, false,
67 "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.")
68 .build());
69 this->addOption(
70 storm::settings::OptionBuilder(moduleName, simplifyCompositionOptionName, false, "If set, attempts to simplify the system composition.").build());
71 this->addOption(storm::settings::OptionBuilder(moduleName, performLocationElimination, false,
72 "If set, location elimination will be performed before the model is built.")
73 .setIsAdvanced()
75 "location-heuristic", "If this number of locations is reached, no further unfolding will be performed")
76 .setDefaultValueUnsignedInteger(defaultOptions.locationEliminationLocationHeuristic)
77 .makeOptional()
78 .build())
80 "edges-heuristic", "Determines how many new edges may be created by a single elimination")
81 .setDefaultValueUnsignedInteger(defaultOptions.locationEliminationEdgeHeuristic)
82 .makeOptional()
83 .build())
84 .build());
85}
86
88 return this->getOption(edgeAssignmentsOptionName).getHasOptionBeenSet();
89}
90
92 return this->getOption(exportFlattenOptionName).getHasOptionBeenSet();
93}
94
96 return this->getOption(locationVariablesOptionName).getHasOptionBeenSet();
97}
98
99std::vector<std::pair<std::string, std::string>> JaniExportSettings::getLocationVariables() const {
100 std::vector<std::pair<std::string, std::string>> result;
102 std::string argument = this->getOption(locationVariablesOptionName).getArgumentByName("variables").getValueAsString();
103 std::vector<std::string> arguments;
104 boost::split(arguments, argument, boost::is_any_of(","));
105 for (auto const& pair : arguments) {
106 std::vector<std::string> keyvaluepair;
107 boost::split(keyvaluepair, pair, boost::is_any_of("."));
108 STORM_LOG_THROW(keyvaluepair.size() == 2, storm::exceptions::IllegalArgumentException,
109 "Expected a name of the form AUTOMATON.VARIABLE (with no further dots) but got " << pair << ".");
110 result.emplace_back(keyvaluepair.at(0), keyvaluepair.at(1));
111 }
112 }
113 return result;
114}
115
117 return this->getOption(globalVariablesOptionName).getHasOptionBeenSet();
118}
119
121 return this->getOption(localVariablesOptionName).getHasOptionBeenSet();
122}
123
125 return this->getOption(compactJsonOptionName).getHasOptionBeenSet();
126}
127
129 return this->getOption(eliminateArraysOptionName).getHasOptionBeenSet();
130}
131
133 return this->getOption(eliminateFunctionsOptionName).getHasOptionBeenSet();
134}
135
137 return this->getOption(replaceUnassignedVariablesWithConstantsOptionName).getHasOptionBeenSet();
138}
139
141 return this->getOption(simplifyCompositionOptionName).getHasOptionBeenSet();
142}
143
145 return this->getOption(performLocationElimination).getHasOptionBeenSet();
146}
147
149 return this->getOption(performLocationElimination).getArgumentByName("location-heuristic").getValueAsUnsignedInteger();
150}
151
153 return this->getOption(performLocationElimination).getArgumentByName("edges-heuristic").getValueAsUnsignedInteger();
154}
155
157
159 return true;
160}
161} // namespace modules
162} // namespace settings
163} // 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...
OptionBuilder & addArgument(std::shared_ptr< ArgumentBase > argument)
Adds the given argument to the arguments of this option.
std::shared_ptr< Option > build()
Builds an option from the data that was added to this builder.
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:39