Browse Source

Changed ltl2da option to slightly more descriptive ltl2datool (this is also the name of the corresponding option in PRISM)

tempestpy_adaptions
Tim Quatmann 3 years ago
committed by Stefan Pranger
parent
commit
c8e9b43100
  1. 20
      src/storm/environment/modelchecker/ModelCheckerEnvironment.cpp
  2. 11
      src/storm/environment/modelchecker/ModelCheckerEnvironment.h
  3. 5
      src/storm/modelchecker/helper/ltl/SparseLTLHelper.cpp
  4. 12
      src/storm/settings/modules/ModelCheckerSettings.cpp
  5. 6
      src/storm/settings/modules/ModelCheckerSettings.h

20
src/storm/environment/modelchecker/ModelCheckerEnvironment.cpp

@ -14,8 +14,8 @@ namespace storm {
ModelCheckerEnvironment::ModelCheckerEnvironment() { ModelCheckerEnvironment::ModelCheckerEnvironment() {
auto const& mcSettings = storm::settings::getModule<storm::settings::modules::ModelCheckerSettings>(); auto const& mcSettings = storm::settings::getModule<storm::settings::modules::ModelCheckerSettings>();
if (mcSettings.isLtl2daSet()) {
ltl2da = mcSettings.getLtl2da();
if (mcSettings.isLtl2daToolSet()) {
ltl2daTool = mcSettings.getLtl2daTool();
} }
} }
@ -31,20 +31,20 @@ namespace storm {
return multiObjectiveModelCheckerEnvironment.get(); return multiObjectiveModelCheckerEnvironment.get();
} }
bool ModelCheckerEnvironment::isLtl2daSet() const {
return ltl2da.is_initialized();
bool ModelCheckerEnvironment::isLtl2daToolSet() const {
return ltl2daTool.is_initialized();
} }
boost::optional<std::string> const& ModelCheckerEnvironment::getLtl2da() const {
return ltl2da;
std::string const& ModelCheckerEnvironment::getLtl2daTool() const {
return ltl2daTool.get();
} }
void ModelCheckerEnvironment::setLtl2da(std::string const& value) {
ltl2da = value;
void ModelCheckerEnvironment::setLtl2daTool(std::string const& value) {
ltl2daTool = value;
} }
void ModelCheckerEnvironment::unsetLtl2da() {
ltl2da = boost::none;
void ModelCheckerEnvironment::unsetLtl2daTool() {
ltl2daTool = boost::none;
} }

11
src/storm/environment/modelchecker/ModelCheckerEnvironment.h

@ -21,15 +21,16 @@ namespace storm {
MultiObjectiveModelCheckerEnvironment& multi(); MultiObjectiveModelCheckerEnvironment& multi();
MultiObjectiveModelCheckerEnvironment const& multi() const; MultiObjectiveModelCheckerEnvironment const& multi() const;
bool isLtl2daSet() const;
boost::optional<std::string> const& getLtl2da() const;
void setLtl2da(std::string const& value);
void unsetLtl2da();
bool isLtl2daToolSet() const;
std::string const& getLtl2daTool() const;
void setLtl2daTool(std::string const& value);
void unsetLtl2daTool();
private: private:
SubEnvironment<MultiObjectiveModelCheckerEnvironment> multiObjectiveModelCheckerEnvironment; SubEnvironment<MultiObjectiveModelCheckerEnvironment> multiObjectiveModelCheckerEnvironment;
boost::optional<std::string> ltl2da;
boost::optional<std::string> ltl2daTool;
}; };
} }

5
src/storm/modelchecker/helper/ltl/SparseLTLHelper.cpp

@ -595,10 +595,9 @@ namespace storm {
// Convert LTL formula to a deterministic automaton // Convert LTL formula to a deterministic automaton
std::shared_ptr<storm::automata::DeterministicAutomaton> da; std::shared_ptr<storm::automata::DeterministicAutomaton> da;
if (env.modelchecker().isLtl2daSet()) {
if (env.modelchecker().isLtl2daToolSet()) {
// Use the external tool given via ltl2da // Use the external tool given via ltl2da
std::string ltl2da = env.modelchecker().getLtl2da().get();
da = storm::automata::LTL2DeterministicAutomaton::ltl2daExternalTool(*ltlFormula, ltl2da);
da = storm::automata::LTL2DeterministicAutomaton::ltl2daExternalTool(*ltlFormula, env.modelchecker().getLtl2daTool());
} }
else { else {
// Use the internal tool (Spot) // Use the internal tool (Spot)

12
src/storm/settings/modules/ModelCheckerSettings.cpp

@ -14,23 +14,23 @@ namespace storm {
const std::string ModelCheckerSettings::moduleName = "modelchecker"; const std::string ModelCheckerSettings::moduleName = "modelchecker";
const std::string ModelCheckerSettings::filterRewZeroOptionName = "filterrewzero"; const std::string ModelCheckerSettings::filterRewZeroOptionName = "filterrewzero";
const std::string ModelCheckerSettings::ltl2daName = "ltl2da";
const std::string ModelCheckerSettings::ltl2daToolOptionName = "ltl2datool";
ModelCheckerSettings::ModelCheckerSettings() : ModuleSettings(moduleName) { ModelCheckerSettings::ModelCheckerSettings() : ModuleSettings(moduleName) {
this->addOption(storm::settings::OptionBuilder(moduleName, filterRewZeroOptionName, false, "If set, states with reward zero are filtered out, potentially reducing the size of the equation system").setIsAdvanced().build()); this->addOption(storm::settings::OptionBuilder(moduleName, filterRewZeroOptionName, false, "If set, states with reward zero are filtered out, potentially reducing the size of the equation system").setIsAdvanced().build());
this->addOption(storm::settings::OptionBuilder(moduleName, ltl2daName, false, "If set, use an external tool to convert LTL formulas to state-based deterministic automata in HOA format").setIsAdvanced().addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "A script that can be called with a prefix formula and a name for the output automaton.").build()).build());
this->addOption(storm::settings::OptionBuilder(moduleName, ltl2daToolOptionName, false, "If set, use an external tool to convert LTL formulas to state-based deterministic automata in HOA format").setIsAdvanced().addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "A script that can be called with a prefix formula and a name for the output automaton.").build()).build());
} }
bool ModelCheckerSettings::isFilterRewZeroSet() const { bool ModelCheckerSettings::isFilterRewZeroSet() const {
return this->getOption(filterRewZeroOptionName).getHasOptionBeenSet(); return this->getOption(filterRewZeroOptionName).getHasOptionBeenSet();
} }
bool ModelCheckerSettings::isLtl2daSet() const {
return this->getOption(ltl2daName).getHasOptionBeenSet();
bool ModelCheckerSettings::isLtl2daToolSet() const {
return this->getOption(ltl2daToolOptionName).getHasOptionBeenSet();
} }
std::string ModelCheckerSettings::getLtl2da() const {
return this->getOption(ltl2daName).getArgumentByName("filename").getValueAsString();
std::string ModelCheckerSettings::getLtl2daTool() const {
return this->getOption(ltl2daToolOptionName).getArgumentByName("filename").getValueAsString();
} }
} // namespace modules } // namespace modules

6
src/storm/settings/modules/ModelCheckerSettings.h

@ -27,14 +27,14 @@ namespace storm {
* *
* @return True iff the external ltl2da has been set. * @return True iff the external ltl2da has been set.
*/ */
bool isLtl2daSet() const;
bool isLtl2daToolSet() const;
/*! /*!
* Retrieves the external ltl2da tool that is used for converting LTL formulas to deterministic automata. * Retrieves the external ltl2da tool that is used for converting LTL formulas to deterministic automata.
* *
* @return The executable to use for converting LTL formulas to deterministic automata. * @return The executable to use for converting LTL formulas to deterministic automata.
*/ */
std::string getLtl2da() const;
std::string getLtl2daTool() const;
// The name of the module. // The name of the module.
static const std::string moduleName; static const std::string moduleName;
@ -42,7 +42,7 @@ namespace storm {
private: private:
// Define the string names of the options as constants. // Define the string names of the options as constants.
static const std::string filterRewZeroOptionName; static const std::string filterRewZeroOptionName;
static const std::string ltl2daName;
static const std::string ltl2daToolOptionName;
}; };
} // namespace modules } // namespace modules

Loading…
Cancel
Save