Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
CounterexampleGeneratorSettings.cpp
Go to the documentation of this file.
2
10
11namespace storm {
12namespace settings {
13namespace modules {
14
15const std::string CounterexampleGeneratorSettings::moduleName = "counterexample";
16const std::string CounterexampleGeneratorSettings::counterexampleOptionName = "counterexample";
17const std::string CounterexampleGeneratorSettings::counterexampleOptionShortName = "cex";
18const std::string CounterexampleGeneratorSettings::counterexampleTypeOptionName = "cextype";
19const std::string CounterexampleGeneratorSettings::shortestPathMaxKOptionName = "shortestpath-maxk";
20const std::string CounterexampleGeneratorSettings::minimalCommandMethodOptionName = "mincmdmethod";
21const std::string CounterexampleGeneratorSettings::encodeReachabilityOptionName = "encreach";
22const std::string CounterexampleGeneratorSettings::schedulerCutsOptionName = "schedcuts";
23const std::string CounterexampleGeneratorSettings::noDynamicConstraintsOptionName = "nodyn";
24
26 this->addOption(storm::settings::OptionBuilder(moduleName, counterexampleOptionName, false,
27 "Generates a counterexample for the given PRCTL formulas if not satisfied by the model.")
28 .setShortName(counterexampleOptionShortName)
29 .build());
30 std::vector<std::string> cextype = {"mincmd", "shortestpath"};
31 this->addOption(storm::settings::OptionBuilder(moduleName, counterexampleTypeOptionName, false,
32 "Generates a counterexample of the given type if the given PRCTL formula is not satisfied by the model.")
33 .setIsAdvanced()
34 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("type", "The type of the counterexample to compute.")
35 .setDefaultValueString("mincmd")
37 .build())
38 .build());
39 this->addOption(storm::settings::OptionBuilder(moduleName, shortestPathMaxKOptionName, false, "Maximal number K of shortest paths to generate.")
40 .setIsAdvanced()
42 "maxk", "Upper bound on number of generated paths. Default value is 10.")
44 .build())
45 .build());
46 std::vector<std::string> method = {"maxsat", "milp"};
47 this->addOption(storm::settings::OptionBuilder(moduleName, minimalCommandMethodOptionName, true,
48 "Sets which method is used to derive the counterexample in terms of a minimal command/edge set.")
49 .setIsAdvanced()
50 .addArgument(storm::settings::ArgumentBuilder::createStringArgument("method", "The name of the method to use.")
51 .setDefaultValueString("maxsat")
53 .build())
54 .build());
55 this->addOption(storm::settings::OptionBuilder(moduleName, encodeReachabilityOptionName, true,
56 "Sets whether to encode reachability for MAXSAT-based counterexample generation.")
57 .setIsAdvanced()
58 .build());
59 this->addOption(storm::settings::OptionBuilder(moduleName, schedulerCutsOptionName, true,
60 "Sets whether to add the scheduler cuts for MILP-based counterexample generation.")
61 .setIsAdvanced()
62 .build());
63 this->addOption(storm::settings::OptionBuilder(moduleName, noDynamicConstraintsOptionName, true,
64 "Disables the generation of dynamic constraints in the MAXSAT-based counterexample generation.")
65 .setIsAdvanced()
66 .build());
67}
68
70 return this->getOption(counterexampleOptionName).getHasOptionBeenSet();
71}
72
74 return this->getOption(counterexampleTypeOptionName).getHasOptionBeenSet();
75}
76
78 return this->getOption(counterexampleTypeOptionName).getArgumentByName("type").getValueAsString() == "mincmd";
79}
80
82 return this->getOption(counterexampleTypeOptionName).getArgumentByName("type").getValueAsString() == "shortestpath";
83}
84
86 return this->getOption(shortestPathMaxKOptionName).getArgumentByName("maxk").getValueAsUnsignedInteger();
87}
88
90 return this->getOption(minimalCommandMethodOptionName).getArgumentByName("method").getValueAsString() == "milp";
91}
92
94 return this->getOption(minimalCommandMethodOptionName).getArgumentByName("method").getValueAsString() == "maxsat";
95}
96
98 return this->getOption(encodeReachabilityOptionName).getHasOptionBeenSet();
99}
100
102 return this->getOption(schedulerCutsOptionName).getHasOptionBeenSet();
103}
104
106 return !this->getOption(noDynamicConstraintsOptionName).getHasOptionBeenSet();
107}
108
110 STORM_LOG_THROW(isCounterexampleSet() || !isCounterexampleTypeSet(), storm::exceptions::InvalidSettingsException,
111 "Counterexample type was set but counterexample flag '-cex' is missing.");
112 // Ensure that the model was given either symbolically or explicitly.
116 storm::exceptions::InvalidSettingsException, "For the generation of a minimal command set, the model has to be specified in the PRISM/JANI format.");
117
120 "Encoding reachability is only available for the MaxSat-based minimal command set generation, so selecting it has no effect.");
122 "Using scheduler cuts is only available for the MaxSat-based minimal command set generation, so selecting it has no effect.");
123 }
124
125 return true;
126}
127
128} // namespace modules
129} // namespace settings
130} // 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...
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...
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_WARN_COND(cond, message)
Definition macros.h:38
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18