Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
CounterexampleGeneratorSettings.cpp
Go to the documentation of this file.
2
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::counterexamples::CounterexampleOptions const defaultOptions;
19} // namespace
20
21const std::string CounterexampleGeneratorSettings::moduleName = "counterexample";
22const std::string CounterexampleGeneratorSettings::counterexampleOptionName = "counterexample";
23const std::string CounterexampleGeneratorSettings::counterexampleOptionShortName = "cex";
24const std::string CounterexampleGeneratorSettings::counterexampleTypeOptionName = "cextype";
25const std::string CounterexampleGeneratorSettings::shortestPathMaxKOptionName = "shortestpath-maxk";
26const std::string CounterexampleGeneratorSettings::minimalCommandMethodOptionName = "mincmdmethod";
27const std::string CounterexampleGeneratorSettings::encodeReachabilityOptionName = "encreach";
28const std::string CounterexampleGeneratorSettings::schedulerCutsOptionName = "schedcuts";
29const std::string CounterexampleGeneratorSettings::noDynamicConstraintsOptionName = "nodyn";
30
32 this->addOption(storm::settings::OptionBuilder(moduleName, counterexampleOptionName, false,
33 "Generates a counterexample for the given PRCTL formulas if not satisfied by the model.")
34 .setShortName(counterexampleOptionShortName)
35 .build());
36 std::vector<std::string> cextype = {"mincmd", "shortestpath"};
37 this->addOption(storm::settings::OptionBuilder(moduleName, counterexampleTypeOptionName, false,
38 "Generates a counterexample of the given type if the given PRCTL formula is not satisfied by the model.")
39 .setIsAdvanced()
40 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("type", "The type of the counterexample to compute.")
41 .setDefaultValueString("mincmd")
43 .build())
44 .build());
45 this->addOption(storm::settings::OptionBuilder(moduleName, shortestPathMaxKOptionName, false, "Maximal number K of shortest paths to generate.")
46 .setIsAdvanced()
47 .addArgument(storm::settings::ArgumentBuilder::createUnsignedIntegerArgument("maxk", "Upper bound on number of generated paths.")
48 .setDefaultValueUnsignedInteger(defaultOptions.shortestPathMaxK)
49 .build())
50 .build());
51 std::vector<std::string> method = {"maxsat", "milp"};
52 this->addOption(storm::settings::OptionBuilder(moduleName, minimalCommandMethodOptionName, true,
53 "Sets which method is used to derive the counterexample in terms of a minimal command/edge set.")
54 .setIsAdvanced()
55 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("method", "The name of the method to use.")
56 .setDefaultValueString("maxsat")
58 .build())
59 .build());
60 this->addOption(storm::settings::OptionBuilder(moduleName, encodeReachabilityOptionName, true,
61 "Sets whether to encode reachability for MAXSAT-based counterexample generation.")
62 .setIsAdvanced()
63 .build());
64 this->addOption(storm::settings::OptionBuilder(moduleName, schedulerCutsOptionName, true,
65 "Sets whether to add the scheduler cuts for MILP-based counterexample generation.")
66 .setIsAdvanced()
67 .build());
68 this->addOption(storm::settings::OptionBuilder(moduleName, noDynamicConstraintsOptionName, true,
69 "Disables the generation of dynamic constraints in the MAXSAT-based counterexample generation.")
70 .setIsAdvanced()
71 .build());
72}
73
75 return this->getOption(counterexampleOptionName).getHasOptionBeenSet();
76}
77
79 return this->getOption(counterexampleTypeOptionName).getHasOptionBeenSet();
80}
81
83 return this->getOption(counterexampleTypeOptionName).getArgumentByName("type").getValueAsString() == "mincmd";
84}
85
87 return this->getOption(counterexampleTypeOptionName).getArgumentByName("type").getValueAsString() == "shortestpath";
88}
89
91 return this->getOption(shortestPathMaxKOptionName).getArgumentByName("maxk").getValueAsUnsignedInteger();
92}
93
95 return this->getOption(minimalCommandMethodOptionName).getArgumentByName("method").getValueAsString() == "milp";
96}
97
99 return this->getOption(minimalCommandMethodOptionName).getArgumentByName("method").getValueAsString() == "maxsat";
100}
101
103 return this->getOption(encodeReachabilityOptionName).getHasOptionBeenSet();
104}
105
107 return this->getOption(schedulerCutsOptionName).getHasOptionBeenSet();
108}
109
111 return !this->getOption(noDynamicConstraintsOptionName).getHasOptionBeenSet();
112}
113
115 STORM_LOG_THROW(isCounterexampleSet() || !isCounterexampleTypeSet(), storm::exceptions::InvalidSettingsException,
116 "Counterexample type was set but counterexample flag '-cex' is missing.");
117 // Ensure that the model was given either symbolically or explicitly.
121 storm::exceptions::InvalidSettingsException, "For the generation of a minimal command set, the model has to be specified in the PRISM/JANI format.");
122
125 "Encoding reachability is only available for the MaxSat-based minimal command set generation, so selecting it has no effect.");
127 "Using scheduler cuts is only available for the MaxSat-based minimal command set generation, so selecting it has no effect.");
128 }
129
130 return true;
131}
132
133} // namespace modules
134} // namespace settings
135} // 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.
static std::shared_ptr< ArgumentValidator< std::string > > createMultipleChoiceValidator(std::vector< std::string > const &choices)
This class provides the interface to create an 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
bool isCounterexampleSet() const
Retrieves whether the counterexample option was set.
CounterexampleGeneratorSettings()
Creates a new set of counterexample settings.
bool isShortestPathGenerationSet() const
Retrieves whether the option to generate a shortest path counterexample was set.
bool isUseMaxSatBasedMinimalCommandSetGenerationSet() const
Retrieves whether the MAXSAT-based technique is to be used to generate a minimal command set countere...
bool check() const override
Checks whether the settings are consistent.
size_t getShortestPathMaxK() const
Retrieves the maximal number K of shortest paths which should be generated.
bool isUseDynamicConstraintsSet() const
Retrieves whether to use the dynamic constraints in the MAXSAT-based technique.
bool isUseSchedulerCutsSet() const
Retrieves whether scheduler cuts are to be used if the MAXSAT-based technique is used to generate a m...
bool isEncodeReachabilitySet() const
Retrieves whether reachability of a target state is to be encoded if the MAXSAT-based technique is us...
bool isCounterexampleTypeSet() const
Retrieves whether the type of counterexample was set.
bool isMinimalCommandSetGenerationSet() const
Retrieves whether the option to generate a minimal command set counterexample was set.
bool isUseMilpBasedMinimalCommandSetGenerationSet() const
Retrieves whether the MILP-based technique is to be used to generate a minimal command set counterexa...
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_WARN_COND(cond, message)
Definition macros.h:54
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:39
SettingsType const & getModule()
Get module.